Difference between revisions of "DAP4: Capabilities and Versioning"

From OPeNDAP Documentation
m (Examples)
m (Raw DAP Dataset URLs Return Capabilities Documents)
Line 61: Line 61:
 
The URL of a link with this relation type can be used to GET the dataset capabilities document for the dataset.
 
The URL of a link with this relation type can be used to GET the dataset capabilities document for the dataset.
  
An example of an HTTP request for an XML encoded dataset capabilities document is given [[Example: Server Capabilities Request-Response|below]].
+
An example of an HTTP request for an XML encoded dataset capabilities document is given [[#Server Capabilities Document Request-Response|below]].
  
 
=== DAP4 DDX ===
 
=== DAP4 DDX ===

Revision as of 14:45, 24 April 2012

<-- back to OPULS Development

--EthanDavis 13:32, 16 April 2012 (PDT)

1 Background

Providing OPeNDAP clients with information on the particular capabilities of a given server and given dataset has been discussed many times. Types of capabilities include supported DAP versions, supported server-side functions. Another possible capability would be support for multiple encodings of the various OPeNDAP services. Providing capabilities documents can also make it easier to plan for extensibility and the future evolution of OPeNDAP.

Negotiating versions using HTTP headers or URL keywords is described in DAP 4.0 Design doc. Advertising DAP protocol services is described in the DAP Service Terminus document.

2 Problem addressed

The proposal attempts to address the following requirements:

  • Support for multiple versions of DAP protocol in a backwards compatible way
  • Support for extensibility and evolution of protocol
  • Support for multiple encoding formats (media types) for each resource type
  • Support description of server and dataset capabilities (e.g., server-side processing capabilities)

3 Proposed solution

Provide dataset capabilities documents from the raw DAP dataset URL. A dataset's capabilities document includes links to the various OPeNDAP services for that dataset. Each link is described with a link relationship type and a media type. The link relationship type indicates what type of resource will be returned. The media type indicates the document type in which the returned resource will be encoded.

Providing a dataset capabilities document with links to both DAP2 and DAP4 resources allows for DAP2 backward compatibility and will support protocol extensibility and future evolution of the protocol.

3.1 Raw DAP Dataset URLs Return Capabilities Documents

A GET request on a DAP dataset URL (e.g., http://server.org/some/path/data.nc) returns the capabilities document for the dataset. To take advantage of web caching, capabilities documents should try to be light weight (i.e., quick creation) and as stable as possible.

A dataset capabilities document must contain a server section and a dataset section.

The server section should include

  • a link to the full server capabilities document (if applicable)
  • a list of the DAP versions the server supports
  • the implementation version (e.g., "TDS 4.3.57" or "Hyrax 1.7.45")
  • a list of extensions the server supports

The dataset section should include

  • a link to the full dataset capabilities document (this document)
  • links to all available OPeNDAP services for the dataset
  • a list of extensions supported for this dataset (links?)
  • a link to a constraint expression document detailing the constraint supported for this dataset
  • a list of the types of processing instructions supported for this dataset

Dataset capabilities documents can be encoded in the following media types:

  • application/vnd.opendap.org.capabilities+xml
  • application/vnd.opendap.org.capabilities+json
  • application/vnd.opendap.org.capabilities+pbuf

Definitions of these media types can be found in :

  • The DAP4 Capabilities XML schema (link) which is declared in the namespace http://opendap.org/ns/dap/capabilities.
  • The DAP4 Capabilities JSON definition (link).
  • The DAP4 Capabilities protobuf definition (link).

A link to a Dataset Capabilities document can be identified by the following link relationship type:

  • http://opendap.org/rel/dap/dataset

The URL of a link with this relation type can be used to GET the dataset capabilities document for the dataset.

An example of an HTTP request for an XML encoded dataset capabilities document is given below.

3.2 DAP4 DDX

A DAP4 DDX document describes the structure of a dataset and contains other metadata for that dataset. It must contain a link to the DAP4 Data and to a CE document that describes the constraints supported for this dataset.

DAP4 DDX documents can be encoded in the following media types:

  • application/vnd.opendap.org.dap4.ddx
  • application/vnd.opendap.org.dap4.ddx+pbuf

Definitions of these media types can be found in:

  • The DAP4 DDX XML schema (link) which is declared in the namespace http://opendap.org/ns/dap4/ddx.
  • The DAP4 DDX JSON definition (link).
  • The DAP4 DDX protobuf definition (link).

A link to a DAP4 DDX document can be identified by the following link relationship type:

  • http://opendap.org/rel/dap4/ddx

The URL of a link with this relation can be used to GET a DAP4 DDX resource.

3.3 DAP4 Data

A DAP4 Data resource contains a subset of data from the dataset. They may be encoded in any of the following media types:

  • application/vnd.opendap.org.dap4.data
  • application/vnd.opendap.org.dap4.data+ascii
  • application/vnd.opendap.org.dap4.data+json
  • application/vnd.opendap.org.dap4.data+ncstream

Definitions of these media types can be found in:

  • The DAP4 Data encoding specification (link).
  • The DAP4 Data ASCII/UTF-8 encoding specification (link).
  • The DAP4 Data JSON definition (link).
  • The DAP4 Data ncstream/cdmremote definition (link).

A link to a DAP4 DDX document can be identified by the following link relationship type:

http://opendap.org/rel/dap4/data

The URL of a link with this relation can be used to GET or POST a DAP4 data resource. (POST is used if a dataset session is desired, i.e., to freeze dynamically changing datasets, or if an asynchronous response is expected.)

3.4 DAP4 Constraint Expression

A DAP4 Constraint Expression document contains a constraint that is to be applied to the dataset. They may be encoded in any of the following media types:

  • application/vnd.opendap.org.dap4.ce
  • application/vnd.opendap.org.dap4.ce+xml

Definitions of these media types can be found in:

  • The DAP4 CE URL encoding specification (link).
  • The DAP4 CE XML schema (link) which is declared in the namespace http://opendap.org/ns/dap4/ce.
  • The DAP4 Data JSON definition (link).
  • The DAP4 Data ncstream/cdmremote definition (link).

A link to a DAP4 CE document can be identified by the following link relationship type:

  • http://opendap.org/rel/dap4/ce

The URL of a link with this relation can be used to GET a DAP4 constraint expression document.

Generally constraint expression are only used as part of a data request. This link relation type is given in case stand-alone constraint expression resources are found useful.

NOTE: Could this document describe the types of constraints that can be applied to particular variables in a dataset? Is such a thing needed? If so, should it be a separate resource type.

3.5 DAP4 Server Capabilities Documents

3.6 DAP2 DAS

application/vnd.opendap.org.dap2.das

A representation of this media type contains a DAP2 DAS document.

3.7 DAP2 DDS

application/vnd.opendap.org.dap2.dds

A representation of this media type contains a DAP2 DDS document.

3.8 DAP2 DDX

application/vnd.opendap.org.dap2.ddx

A representation of this media type contains a DAP2 DDX document declared in the namespace http://opendap.org/nc/dap2/ddx.

3.9 DAP2 Data

  • application/vnd.opendap.org.dap2.data
  • application/vnd.opendap.org.dap2.data+ascii

A representation of one of these media types contains DAP2 data. See the DAP2 specification for details.

3.10 DAP2 Constraint Expression

  • application/vnd.opendap.org.dap2.ce

A representation of this media type contains a DAP2 constraint expression. Generally used as a DAP2 data URL query string. See the DAP2 specification for details.


3.11 Extension Resource Types

A number of extensions to the core DAP4 protocol have been discussed. Here are a few extensions and some resource types that we might consider:

3.12 DAP4 Asynchronous Request/Response

See DAP4: Asynchronous Request/Response Proposal

3.13 DAP4 Server-Side Processing Instructions

  • application/vnd.opendap.org.dap4.processing+ferret
  • application/vnd.opendap.org.dap4.processing+grads
  • application/vnd.opendap.org.dap4.processing+jython
  • application/vnd.opendap.org.dap4.processing+jvm
  • http://opendap.org/rel/dap4/processing

4 Rationale for the solution

  • Allows servers full control of their URL space
    • DAP4 URLs are identified by their link type rather than a hard wired "file extension".
    • On the other hand, file extensions can also be supported.

5 Discussion




6 Examples

6.1 Server Capabilities Document Request-Response

Client uses DAP dataset URL, http://server.org/dap/path/data.nc, to GET the dataset capabilities resource as an XML document:

GET /dap/path/data.nc HTTP/1.1
Host: server.org
Accept: application/vnd.opendap.org.capabilities+xml

The response might look like like:

200 OK
Content-Type: application/vnd.opendap.org.capabilities+xml;charset=UTF-8

<capabilities xmlns="http://opendap.org/ns/dap/capabilities">
  <server rel="http://opendap.org/rel/dap/server"
          type="application/vnd.opendap.org.capabilities+xml,
                application/vnd.opendap.org.capabilities+json,
                application/vnd.opendap.org.capabilities+pbuf"
          href="http://server/dap/capabilities">
    <protocolVersions>
      http://opendap.org/rel/dap2
      http://opendap.org/rel/dap3
      http://opendap.org/rel/dap4
    </protocolVersions>
    <implVersion>TDS 4.3.54</implVersion>
    <supportedExt>...</supportedExt>
  </server>
  <dataset rel="self"
           type="application/vnd.opendap.org.capabilities+xml,
                 application/vnd.opendap.org.capabilities+json,
                 application/vnd.opendap.org.capabilities+pbuf"
           href="http://server/dap/path/data.nc">
    <version name="dap2">

      <serviceLink rel="http://opendap.org/rel/dap2/das"
                   type="application/vnd.opendap.org.dap2.das"
                   href="http://server/some/path/data.nc.das"/>
      <serviceLink rel="http://opendap.org/rel/dap2/dds"
                   type="application/vnd.opendap.org.dap2.dds"
                   href="http://server/dap/path/data.nc.dds"/>
      <serviceLink rel="http://opendap.org/rel/dap2/ddx"
                   type="application/vnd.opendap.org.dap2.ddx+xml"
                   href="http://server/dap/path/data.nc.ddx"/>
      <serviceLink rel="http://opendap.org/rel/dap2/dods"
                   type="application/vnd.opendap.org.dap2.dods,
                         application/vnd.opendap.org.dap2.dods+ascii"
                   href="http://server/dap/path/data.nc.dods"/>
      <constraintExp ...>...</constraintExp>
      <processing ...>...</processing>
    </version>
    <version name="dap4">
      <serviceLink rel="http://opendap.org/rel/dap4/description"
                   type="application/vnd.opendap.org.dap4.description+xml,
                         application/vnd.opendap.org.dap4.description+json,
                         application/vnd.opendap.org.dap4.description+pbuf"
                   href="http://server/dap/path/data.nc.ddx4"/>
      <serviceLink rel="http://opendap.org/rel/dap4/data"
                   type="application/vnd.opendap.org.dap4.data,
                         application/vnd.opendap.org.dap4.data+ascii,
                         application/vnd.opendap.org.dap4.data+json,
                         application/vnd.opendap.org.dap4.data+ncstream"
                   href="http://server/dap/path/data.nc.data">
        <constraintExp...>...</constraintExp>
        <processing ...>...</processing>
      </serviceLink>
    </version>
  </dataset>
</capabilities>

6.2 Constrained Data Request-Response

Request:

GET /dap/path/data.nc?x,y,temp HTTP/1.1
Host: server.org
Accept: application/vnd.opendap.org.dap4.data

Response:

200 OK
Content-Type: application/vnd.opendap.org.dap4.data
 
<ddx>...</ddx>...BINARY DATA...

6.3 Create New Dataset with Constrained Data Request-Response

Request:

POST /dap/path/data.nc HTTP/1.1
Host: server.org
Content-Type: application/vnd.opendap.org.dap4.ce+xml;charset=UTF-8
 
<constraintExp>...</constraintExp>

Response:

201 Created
Content-Type: application/vnd.opendap.org.dap4.capabilities+xml;charset=UTF-8
 
<capabilities xmlns="http://opendap.org/ns/dap/capabilities">
  <server ...>...</server>
  <dataset rel="self"
           type="application/vnd.opendap.org.capabilities+xml,
                 application/vnd.opendap.org.capabilities+json,
                 application/vnd.opendap.org.capabilities+pbuf"
           href="http://server/dap/path/data.nc-ABCD">
    <source>
      <dataset type="application/vnd.opendap.org.capabilities+xml,
                     application/vnd.opendap.org.capabilities+json,
                     application/vnd.opendap.org.capabilities+pbuf"
               href="http://server/dap/path/data.nc" />
      <constraintExp>
        ...
      </constraintExp>
    </source>
    <version name="dap2">
      ...
    </version>
    <version name="dap4">
      ...
    </version>
  </dataset>
</capabilities>

7 Some References