DAP4 Dataset Services Response: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
(Created page with "DevelopmentDAP4 == Overview == We intend to provide a 'Services' or 'Capabilities' response for DAP4. Currently DAP servers provide a...")
 
 
(203 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Development|Development]][[Category:DAP4|DAP4]]
[[Category:Development|Development]][[Category:DAP4|DAP4]]
== Overview ==


We intend to provide a 'Services' or 'Capabilities' response for DAP4.
[[OPULS_Development | <-- back to OPULS Development]]


Currently DAP servers provide a number of  dataset level responses (services). These include DAP services such as the DDS, DAS, and DDX, plus other services that have been added over time such as the RDF and ISO responses. There is currently no way for a user (or software agent) to discover which of these many services might be available for a particular dataset.  While THREDDS catalogs do provide a mechanism for determining which services are associated with which datasets, they don't actually provide a mechanism for discovering the details of the various service URLs. A THREDDS catalog might identify a DAP service, but the URL that can be assembled from the THREDDS catalog for that service is limited to just the base dataset URL. Typically dereferencing this URL will provide one of two things - either the underlying data file (for example a netcdf file) or an HTTP 403 error if direct access to the underlying files has been disabled in the server configuration.
Author: [[User:Ndp|ndp]]
 
== Background ==
 
Legacy DAP2 servers provide a number of  dataset level responses (services). These include DAP2 services such as the DDS, DAS, and DDX, plus other services that have been added over time such as the RDF and ISO responses. There is no method defined by the DAP2 protocol for a user (or software agent) to discover which of these many services might be available for a particular dataset.  While THREDDS catalogs do provide a mechanism for determining which services are associated with which datasets, they don't actually provide a mechanism for discovering the details of the various service URLs. A THREDDS catalog might identify a DAP2 service, but the URL that can be assembled from the THREDDS catalog for that service is limited to just the base dataset URL. Typically dereferencing this URL will provide one of two things - either the underlying data file (for example a netcdf file) or an HTTP 403 error if direct access to the underlying files has been disabled in the server configuration.


'''Example:'''
'''Example:'''


This URL points to a dataset on a DAP server:
This URL points to a dataset on a DAP2 server:
<font size="2">
<font size="2">
  http://test.opendap.org:8080/opendap/data/nc/fnoc1.nc
  http://test.opendap.org:8080/opendap/data/nc/fnoc1.nc
</font>
</font>


Dereferencing the link will not connect you to a DAP service or DAP response. It will only return the underlying netcdf file. The only way to know that DAP services exist for this is by reading the URL path and recognizing that it is likely an instance of a DAP server based on the position of the 'opendap' string in the URL.  
Dereferencing the link will not connect you to a DAP2 service or DAP2 response. It will (likely) return the underlying netcdf file. The only way to know that DAP2 services exist for this is by reading the URL path and recognizing that it is probably an instance of a DAP2 server based on the composition of the URL. In fact, there is no guarantee that dereferencing this URL will even yield the underlying file, as that behavior is a configuration option for some server implementations. If that access is not allowed in the configuration, then dereferencing the URL will simply return an HTTP 403 (forbidden) error.
 
== Dataset Services Response ==
 
The Dataset Services Response provides a 'Services' or 'Capabilities' response for DAP4. Dereferencing an unadorned DAP4 dataset resource URL will return a document describing the DAP services available for the dataset. This is a REQUIRED response and the only valid response for an 'unadorned' dataset resource URL. We will refer to this response as the 'Dataset Services Response' or 'DSR' in the 'DAP4 Web Services' specification and the remainder of this document.
 
At minimum the DSR document MUST provide, for each service available for the dataset:
 
* A human readable title of that service (e.g., The Dataset Metadata Response service for the dataset)
* One or more links that can be dereferenced to get the various representations of the response for the dataset.
* An unambiguous, unique to the service type, resource role ID that serves as a way to clearly identify what each service does. (Note: ''Resource roles for all DAP4 services are defined, as well as for several other legacy DAP2 related services in the 'DAP4 Specification, Volume 2 Web Services'. Defining a resource role for a new service will be the responsibility of the service creator.'')
* A brief description of the service
 
The response should also include:
* A link to a complete, human readable, description of the service.
* A reference to an XSLT that a browser would use to render the description into HTML for a presentation view.
* Descriptions and syntax of server side functions available for the dataset
 
=== Service Access ===
 
A service is accessed by dereferencing one of the access URLs held in the <font size="2"><code>'''href'''</code></font> attribute of a <font size="2"><code>'''<dsr:link>'''</code></font> elements, which is typically constructed by adding some type of suffix to the dataset's referent (aka base) URL. The way in which the query string (aka constraint expression) is used is defined by each service, and there is no requirement for inter-service query string API conformity.
 
A more extensive discussion of the various services that might appear in a DatasetServices document can be found in [[DAP4:_Specification_Volume_2| DAP4 Volume 2, Web Services]].
 
'''Note:''' If a client understands how to modify/augment the dataset resource URL (as described in the  [[DAP4:_Specification_Volume_2| DAP4 Volume 2, Web Services]] ) such that it becomes a DAP response URL then it need never obtain the Dataset Services response.
 
===  Dataset Services Response Encoding  ===
 
c.f. [[DAP4:_Specification_Volume_2| DAP4 Volume 2, Web Services]]
 
''In this section the namespace prefix <font size="2"><code>'''dsr'''</code></font>  is associated with the namespace '''<font size="2"><code><nowiki>http://xml.opendap.org/ns/DAP/4.0/dataset-services#</nowiki></code></font>'''.''
 
==== dsr:DatasetServices element ====
 
The Dataset Services Response MUST contain a top level <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element. This <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element MUST contain:
* An <font size="2"><code>'''xml:base'''</code></font> attribute whose value is the resource URL that was dereferenced to request the DSR response.
* A list of DAP versions supported by server
*: These appear as one or more child <font size="2"><code>'''<dsr:DapVersion>'''</code></font> elements of the <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element.
* The implementation version of the server that produced the DSR.
*: This appears as a single <font size="2"><code>'''<dsr:ServerSoftwareVersion>'''</code></font> child element of the <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element.
* A list of all available DAP4 services for the dataset
*: This is represented as 3 or more <font size="2"><code>'''[[#Service_Element | <dsr:Service>]]'''</code></font> elements. (There are 3 required services for a DAP4 server.)
* A list of supported extensions
** Resource type extensions
** Media type extensions
** Server-side function extensions
 
The <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element SHOULD contain:
* A <font size="2"><code>'''title'''</code></font> attribute whose value is a human readable title for the dataset.
 
The <font size="2"><code>'''<dsr:DatasetServices>'''</code></font> element MAY contain:
* A <font size="2"><code>'''<dsr:Description>'''</code></font> element whose value is a human readable description of the dataset.
 
==== dsr:DapVersion Element ====
The <font size="2"><code>'''<dsr:DapVersion>'''</code></font> element contains a single DAP version value as a text string. The DAP version is represented as two integer values separated by a period, MM.mm where the first value (MM) is the major version of the DAP protocol, and the second value (mm) is the minor version. Multiple <font size="2"><code>'''<dsr:DapVersion>'''</code></font> elements are used to represent that server can support multiple versions of the DAP protocol, one instance for each supported version.
 
Example:
<font size="2">
<source lang="xml" >
<DapVersion>4.0</DapVersion>
<DapVersion>3.2</DapVersion>
<DapVersion>2.0</DapVersion>
</source>
</font>
 
==== dsr:ServerSoftwareVersion element ====
 
The <font size="2"><code>'''<dsr:ServerSoftwareVersion>'''</code></font> element has no attributes and may contain as little as a simple text string (e.g., "TDS 4.3.57" or "Hyrax 1.7.45"), or it may contain any well-formed XML content not in the <font size="2"><code>'''dsr'''</code></font> namespace that the server implementer sees fit to use to describe the software version of their server implementation.
 
==== dsr:Service element ====
 
Each DAP4 web service is described by a <font size="2"><code>'''<dsr:Service>'''</code></font> element with:
* An optional <font size="2"><code>'''title'''</code></font> attribute whose value is a simple human readable title for the service.
* An required <font size="2"><code>'''role'''</code></font> attribute whose value is a unique to the service type, resource role ID (a URI) that serves as a way to clearly identify what each service does. This is intended to allow people and software to unambiguously identify specific services, irrespective of their human readable title. The idea is that that the role attribute tells you what is going to happen when you dereference the URL held in the <font size="2"><code>'''<dsr:link>'''</code></font> element. Each service has a single role and all of the links (alternate representations) must fulfill the same role.
* An optional <font size="2"><code>'''<dsr:Description>'''</code></font> element .
* One or more <font size="2"><code>'''<dsr:link>'''</code></font> elements.
 
===== Regarding the <font size="3"><code>'''role'''</code></font> attribute =====
 
With regards to multiple representations of a service response and the <font size="2"><code>'''role'''</code></font>  attribute: While there may be many alternate representations of a response, not all will fufill the same <font size="2"><code>'''role'''</code></font>. Representations fulfilling the same <font size="2"><code>'''role'''</code></font> should be bundled together in their own '''Service''' with the appropriate <font size="2"><code>'''role'''</code></font> value. For example the DMR can be mapped to the ISO19115 metadata space, but IS0-19115 responses are clearly outside of the <font size="2"><code>'''role'''</code></font> of the regular DMR service, which returns a DAP4 metadata response. One could view it as the two roles described different domains.
 
==== dsr:Description element ====
Each <font size="2"><code>'''<dsr:Description>'''</code></font> element MUST contain:
* An optional <font size="2"><code>'''href'''</code></font> attribute whose value is a URL string that points to a human readable document describing the service.
* The required text content of the <font size="2"><code>'''dsr:Description'''</code></font> element MUST be a human readable description of the service.
 
==== dsr:link element ====
 
Each <font size="2"><code>'''<dsr:link>'''</code></font> element MUST contain:
 
* A required <font size="2"><code>'''type'''</code></font> attribute whose value is the media-type for the normative representation returned by that URL held in the <font size="2"><code>'''href'''</code></font> attribute.
* A required attribute called <font size="2"><code>'''href'''</code></font> whose value is a URL that when dereferenced will return the service response in the media type described by the value of the <font size="2"><code>'''type'''</code></font> attribute.
* An optional attribute called <font size="2"><code>'''description'''</code></font> whose value is a human readable string that provides a brief description of the <font size="2"><code>'''<dsr:link>'''</code></font> elements semantics.
* Zero or more <font size="2"><code>'''<dsr:alt>'''</code></font> elements, one for each and every alternate representation of the response that can be requested using [http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12.1 HTTP server-driven content negotiation] in conjunction with the <font size="2"><code>'''href'''</code></font> URL. Each <font size="2"><code>'''<dsr:alt>'''</code></font> element MUST contain:
** A required <font size="2"><code>'''type'''</code></font> attribute whose value is the MIME type that would be used in the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 HTTP '''Accept''' header] to request that representation from the server.
 
=== Extensions ===
 
Server extensions are simple descriptions of server behaviors that fall outside of the services descriptions provided so far. There are three types of extensions: <font size="2"><code>'''function'''</code></font>, <font size="2"><code>'''functionGroup'''</code></font>, and <font size="2"><code>'''extension'''</code></font>.
 
A linear regression, a re-gridding operation, and a coordinate re-projection are all examples of a <font size="2"><code>'''function'''</code></font>. A collection of functions that allows the user to perform geocentric manipulations of the data (such as re-gridding operations, reprojection operations) taken together could define a <font size="2"><code>'''functionGroup'''</code></font>.  An <font size="2"><code>'''extension'''</code></font> is a server behavior that does not operate directly on the data values, but may provide other types of services and functionality for the client.
 
It is beyond the scope of this specification to attempt to describe the syntax of usage of a  <font size="2"><code>'''function'''</code></font> in some general way. Rather we have chosen to provide a simple mechanism (the <font size="2"><code>'''role'''</code></font> attribute) to alert client software implementations that the server supports specific additional behaviors they can utilize, along with more descriptive elements through which humans can be alerted to the presence of server features and where to find out more about them.
 
==== dsr:function ====
 
A function extension always describes an operation that applies to the Data Response and the Dataset Metadata Response (because some functions might alter the syntacic structure of the data the change would be previewed by applying the function to the DMR). 
 
Each <font size="2"><code>'''<dsr:function>'''</code></font> MUST contain:
* A <font size="2"><code>'''name'''</code></font> attribute whose value is the name of the function as it would be used in a DR or DMR request.
* A <font size="2"><code>'''role'''</code></font> attribute whose value is a URI that universally defines the function.
* A <font size="2"><code>'''<dsr:Description>'''</code></font> element whose value is a human readable description of the function and a link to detailed documentation of the function and its usage.
 
A common example of a function would be the DAP2 (and DAP4)  geogrid function that allows users to be sub-sampled gridded data using georeferenced values.
 
==== dsr:functionGroup ====


There is no guarantee that dereferencing this URL will even yield the underlying file, as that behavior is a configuration option for the server. If that access is not allowed in the configuration, then dereferencing the URL will simply return an HTTP 403 (forbidden) error.
A function group identifies that the server supports a group of functions. Rather than enumerating a large list of related functions, the functionGroup provides the user with the information that the server supports a collection of related functions.


== Possible Technologies ==
Each <font size="2"><code>'''<dsr:functionGroup>'''</code></font> MUST contain:
* A <font size="2"><code>'''name'''</code></font> attribute whose value is the human readable name of the collection of functions.
* A <font size="2"><code>'''role'''</code></font> attribute whose value is a URI that universally defines the function group.
* A <font size="2"><code>'''<dsr:Description>'''</code></font> element whose value is a human readable description of the function group and a link to detailed documentation regarding the functions in the function group and their usage.


I looked at [http://en.wikipedia.org/wiki/Web_Services_Description_Language Web Services Description Language (WSDL)],    [http://en.wikipedia.org/wiki/Web_Application_Description_Language Web Application Description Language (WADL)], and  OGC GetCapabilities as possible syntaxes to leverage. All three make assumptions about the structure of the URL and constraint expression (aka query string) that would require an extension to an existing standard be written to support our existing syntax.
An example of a function group would be a server that implemented a functional syntax for all of the functions found in the [http://ferret.wrc.noaa.gov/Ferret/ Ferret] application.


== Proposal ==
==== dsr:extension ====
An extension is a mechanism for indicating that the server supports a certain behavior. This behavior MUST NOT be an operation/computation on the data (other wise it would be a <font size="2"><code>'''dsr:function'''</code></font>or a <font size="2"><code>'''dsr:functionGroup'''</code></font>), but rather some other behavior that the server can undertake.


I propose that base DAP URLs should return an XML document describing the DAP services available for the dataset.  
Each <font size="2"><code>'''<dsr:extension>'''</code></font> MUST contain:
* A <font size="2"><code>'''name'''</code></font> attribute whose value is the human readable name of the extension.
* A <font size="2"><code>'''role'''</code></font> attribute whose value is a URI that universally defines the extension.
* A <font size="2"><code>'''<dsr:Description>'''</code></font> element whose value is a human readable description of the extension and a link to detailed documentation regarding the extension and it's behavior and  usage.


At minimum this document should provide:
An example of an extension would be the DAP4 asynchronous response support. Some servers will support this functionality, and the functionality is not defined as an operation on the data itself, but in terms of the transaction procedures for accessing the data.


* A human readable title of the service (DDX, DDS, etc.)
=== Example:  A Minimal DSR ===
* A link that can be dereferenced to get the service response for the dataset in question.
 
* An unambiguous, unique to the service, xlink:role identifier that serves as a way to clearly identify which service on the list purports to do what well know thing.
This example contains only the required components of the DSR document from a minimal DAP4 server implementation.
* A brief description of the service
 
* A link to a complete, human readable, description of the service response and it's semantics
<font size="2">
* A reference to an XSLT that a browser would use to render the description into HTML for a presentation view.
<source lang="xml" >
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DatasetServices xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    xml:base="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
 
    <DapVersion>4.0</DapVersion>
   
    <ServerSoftwareVersion>Hyrax-2.7.9</ServerSoftwareVersion>
       
    <Service title="DAP4 Dataset Services" role="http://services.opendap.org/dap4/dataset-services">
        <link type="application/vnd.opendap.org.dataset-services+xml"
              href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
              <alt type="text/xml"/>
        </link>
        <link type="text/xml"  href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xml"/>
    </Service>
 
    <Service title="DAP4 Dataset Metadata"  role="http://services.opendap.org/dap4/dataset-metadata">
        <link type="application/vnd.org.opendap.dap4.dataset-metadata+xml"
              href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr">
              <alt type="text/xml"/>
        </link>
        <link type="text/xml" href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr.xml"/>
    </Service>
 
    <Service title="DAP4 Data" role="http://services.opendap.org/dap4/data">
        <link type="application/vnd.org.opendap.dap4.data" href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap" />
    </Service>
 
   
</DatasetServices>
</source>
</font>
 
=== Example: A fully featured and annotated DSR document ===
 
This example contains all of the optional components for a hypothetical DAP4 server that also supports DAp2 requests, server side functions, and asynchronous transactions.
 
<font size="2">
<source lang="xml" >
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/opendap/xsl/serviceDescription.xsl"?>
<DatasetServices xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
                xml:base="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc">
 
    <Description>Our friend fnoc1.nc</Description>
 
    <!-- ##################################################################################### -->
    <!--      DAP versions this server supports                                              -->
    <!-- ..................................................................................... -->
    <DapVersion>4.0</DapVersion>
    <DapVersion>3.2</DapVersion>
    <DapVersion>2.0</DapVersion>
   
    <!-- ##################################################################################### -->
    <!--  The software version of the server that is providing the DAP4 Dataset Services      -->
    <!--  response.                                                                          -->
    <!-- The ServerSoftwareVersion element may contain text, or any XML element content as    -->
    <!-- long as the XML is not in the document namespace                                      -->
    <!-- ..................................................................................... -->
    <ServerSoftwareVersion>Hyrax-2.7.9</ServerSoftwareVersion>
   
   
    <!-- ##################################################################################### -->
    <!--      Required DAP4 Services                                                          -->
    <!-- ..................................................................................... -->
 
    <Service title="DAP4 Dataset Services" role="http://services.opendap.org/dap4/dataset-services">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Services_Description_Service">An index of the Services available for this data resource.</Description>
 
        <link description="Normative form of the DSR"
              type="application/vnd.opendap.org.dataset-services+xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc">
              <alt type="text/html"/>
              <alt type="text/xml"/>
        </link>
       
        <link description="HTML representation of the DSR" 
              type="text/html"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.html"/>
             
        <link description="Normative DSR with generic Content-Type"
              type="text/xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.xml"/>
             
    </Service>
 
    <Service title="DAP4 Dataset Metadata"  role="http://services.opendap.org/dap4/dataset-metadata">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Service_-_The_metadata">The DAP4 metadata content for this data resource..</Description>
 
        <link description="Normative form of the DMR"
              type="application/vnd.org.opendap.dap4.dataset-metadata+xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr">
              <alt type="text/html"/>
              <alt type="text/xml"/>
              <alt type="application/rdf+xml"/>
        </link>
       
        <link description="Data Request Form"
              type="text/html"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.html"/>
             
        <link description="Normative DMR with generic Content-Type"
              type="text/xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.xml"/>
             
        <link description="RDF representation of DMR"
              type="application/rdf+xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.rdf"/>
    </Service>
 
    <Service title="DAP4 Data" role="http://services.opendap.org/dap4/data">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Data_Service">DAP4 Data object for this data resource.</Description>
        <link description="The normative form of the DAP4 Data Response"
              type="application/vnd.org.opendap.dap4.data" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap" >
              <alt type="text/plain"/>
              <alt type="text/xml"/>
              <alt type="application/x-netcdf"/>
        </link>
       
        <link description="A comma separated values (CSV) representation of the DAP4 Data Response object."
              type="text/plain" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.ascii" />
        <link description="XML representation of the DAP4 Data Response object."
              type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.xml" />
        <link description="NetCDF-3 representation of the DAP4 Data Response object."
              type="application/x-netcdf" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.nc" />
    </Service>
 
    <!-- ##################################################################################### -->
    <!--  Optional DAP4 Related Services                                                      -->
    <!-- ..................................................................................... -->
 
    <Service title="ISO-19115 Metadata Service" role="http://services.opendap.org/dap4/iso-19115">
        <link description="Dataset metadata as ISO-19115"
              type="text/xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.iso">
              <alt type="text/html"/>
        </link>
        <link description="ISO-19115 conformance score"
              type="text/html"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.rubric">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_Conformance_Score_Service">ISO-19115 conformance score for the DMR.</Description>
    </Service>
 
    <Service title="File Access" role="http://services.opendap.org/dap4/file">
        <link type="text/xml ## This value depends on the file being accessed." 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.file">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Native_File_Access_Service">Access to dataset file.</Description>
    </Service>
 
 
 
    <!-- ##################################################################################### -->
    <!--      DAP2 Services                                                                  -->
    <!-- ..................................................................................... -->
    <Service title="DAP2 Data" role="http://services.opendap.org/dap2/dods">
        <link type="application/octet-stream"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dods">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Data_Service">DAP2 Data Object.</Description>
    </Service>
 
    <Service title="DDX" role="http://services.opendap.org/dap2/ddx">
        <link type="text/xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.ddx">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDX_Service">OPeNDAP Data Description and Attribute XML Document.</Description>
    </Service>


[[User:Jimg|Jimg]] 12:47, 3 February 2012 (PST) This proposed feature is an example of [http://tools.ietf.org/html/draft-ietf-httpbis-p3-payload-16#section-5.2 agent-driven content negotiation]. To wit:
    <Service title="DDS" role="http://services.opendap.org/dap2/dds">
<blockquote>With agent-driven negotiation, selection of the best representation for a response is performed by the user agent after receiving an initial response from the origin server.  Selection is based on a list of the available representations of the response included within the header fields or body of the initial response, with each representation identified by its own URI.</blockquote>
        <link type="text/plain"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dds">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDS_Service">OPeNDAP Data Description Structure.</Description>
    </Service>


Additionally this dataset services description document might contain:
    <Service title="DAS" role="http://services.opendap.org/dap2/das" >
        <link type="text/plain"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.das">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DAS_Service">OPeNDAP Dataset Attribute Structure.</Description>
    </Service>


* Descriptions and syntax of server side functions available for the dataset


=== Static or Dynamic Response? ===
    <Service title="INFO" role="http://services.opendap.org/dap2/info">
        <link type="text/html"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.info">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Info_Service">OPeNDAP Dataset Information Page.</Description>
    </Service>


As the DAP servers evolve to support user authentication and sessions the content of the dataset services description document should become dynamic. By this I mean that some services and server functions might be available only to certain users. If an authenticated user asks for a particular dataset services description document they would see all the the services available to them, which might differ significantly from those available to a different user. As powerful server side functions such as re-gridding and re-projection become available we anticipate that data providers may not wish to allow just anyone to utilize them because of the potential burden they may place on the data center's computing resources.
    <Service title="Server Version" role="http://services.opendap.org/dap4/version">
        <link type="text/xml"
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.ver">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Server_Version_Service">An XML document containing information about the software version of the server..</Description>
    </Service>


It may be that some services may not be available for all datasets. This argues (along with the previous comment about users and roles) that the service description needs to be generated dynamically and that it should be context sensitive w.r.t. user, role, and dataset.


Implementation of a ''dynamic'' services response implies that the software generating that response ''can'' get information about what is applicable for a given user and a given dataset, where the latter could be quite complicated. The alternative is to have all possible responses described in the services description with the understanding that they might return an error code under one set of circumstances. This would be far easier for servers, and likely require no additional logic in clients (because they will have to account that unforeseen errors will happen in any case). The opposing argument is that presenting information known to be false is a poor practice - and it's hard not to agree.
    <!-- ##################################################################################### -->
    <!--      Server Side Functions                                                          -->
    <!-- ..................................................................................... -->


I suggest that we split this into two cases:
; Authenticated/privileged versus anonymous users: For this case, the response should be dynamic and reflect what the user can actually do.
; Datasets for which server-side functions are/are-not applicable: For this case, however, the response should not attempt to determine what is applicable to a particular dataset, but that it optionally can indicate that a particular function ''can'', with certainty, be applied.


These are two fundamentally different cases because the semantics or the first are under our control, while those of the latter are not. In the first cases, the server defines the classes of users and the sets that describe their capabilities. It is possible for the server to know that a given user can never run a regridding operation, for example, because they lack the authorization to do so. However, for datasets, determining which functions are applicable, for example, requires ''understanding the semantics of the metadata bound to that dataset'' which can be done in some cases, but not all.
    <function name="geogrid" role="http://services.opendap.org/dap4/server-side-function/geogrid">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#geogrid">Allows a DAP Grid variable to be sub-sampled using georeferenced values.</Description>
    </function>


==== How this limits the response's utility, plus a solution ====
    <function name="grid" role="http://services.opendap.org/dap4/server-side-function/grid">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#grid">Allows a DAP Grid variable to be sub-sampled using the values of the coordinate axes.</Description>
    </function>


The problem with not providing a list of functions that is known to be applicable to a dataset, is that limits an important source of semantic information about those datasets. If we know that a regridding function can be allied to dataset X, then we know a fair amount that dataset. In addition, it is possible that the service response could include, at some future time, either directly or via inference, semantic information based on server-side operations that were known to be possible.  
    <function name="linear_scale" role="http://services.opendap.org/dap4/server-side-function/linear-scale">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#linear_scale">Applies a linear scale transform to the named variable.</Description>
    </function>


If we extend the ''Function'' element of the service response so that the element listing a function contains an attribute that indicates that the server knows that this function can definitely be used with the dataset, then we can support semantic systems without forcing the server to know about the applicability of each function to each dataset. I would suggest that we add the attribute ''applicability'' and support the three values of ''yes'', ''no'', and ''unknown'' with the latter being the default value.
    <function name="version" role="http://services.opendap.org/dap4/server-side-function/version">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#version">Returns version information for each server side function.</Description>
    </function>
 
    <!-- ##################################################################################### -->
    <!--      Server Side Function Group                                                      -->
    <!-- ..................................................................................... -->


== [[DAP4_Web_Services | Services]]  ==  
    <functionGroup name="ferret" role="http://pmel.noaa.gov/dap4extension/ferret" >
        <Description href="http://ferret.pmel.noaa.gov/Ferret/documentation">This server supports ferret functions.</Description>
    </functionGroup>


A Service is represented by:
    <!-- ##################################################################################### -->
* A simple human readable name called 'title'.
    <!--      Extensions                                                                      -->
* An access URL and an associated media-type returned by that URL.
    <!-- ..................................................................................... -->
* A unique "namespace" like id that is used to define an xlink:role attribute. This is intended to allow people and software to unambiguously identify specific services, irrespective of their human readable title. The idea is that that the xlink:role tells you what is going to happen when you go to xlink:href.
* An optional description.


A service is accessed by dereferencing its access URL, which is typically constructed by adding some type of suffix to  the dataset's referent (aka base) URL. The way in which the query string (aka constraint expression) is used is defined by each service, and there is no requirement for inter-service query string API conformity.
    <extension name="async" role="http://opendap.org/extension/async">
        <Description href="http://docs.opendap.org/index.php/DAP4:_Asynchronous_Request-Response_Proposal_v3">The server supports asynchronous transactions.</Description>
    </extension>
   
   
</DatasetServices>
</source>
</font>


A more extensive discussion of the various services that might appear in a DatasetServices document can be found on the [[DAP4 Web Services]] page.
== Rationale for the solution ==


== Prototype #1 ==
The solution provides DAP4 servers with an interface that allows for both server-driven and agent driven content negotiation as described in [[http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html  section 12 of the HTTP 1.1 specification]].  Providing the Dataset Services Response in XML allows many downstream applications to ingest the content and leaves open the option for server implementers to add XSLT references to the document so that clients like browsers can easily build a presentation view of the information. <!-- Using the Atom 1.0 appears to involve no additional overhead and will enable other uses for the response. -->


I implemented a prototype DatasetServices document for Hyrax. It is not dynamic - all datasets and all users get the same basic response (delta the embedded URL's that return the various service responses).
== Discussion ==
<!-- It is possible to embed in the above a reference to a XSLT that will transform the above XML into HTML similar to the following (with the caveat that this image is actually of a similar, but not identical, XML response): -->
Here is one idea for the HTML version of the DSR; it could be generated by the server using XSLT on the XML or by the browser when the user explicitly requests the ''.xml'' variant of the response (by embedding a reference to the XSL transform in that response document):


It looks like this:
[[File:ServiceDescriptionPrototype-01.png]]
 
 
<!--
<font size="2">
<font size="2">
<source lang="xml" >
<source lang="xml" >
Line 83: Line 416:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/opendap/xsl/serviceDescription.xsl"?>
<?xml-stylesheet type="text/xsl" href="/opendap/xsl/serviceDescription.xsl"?>
<DatasetServices  
<DatasetServices xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
     xmlns:xlink="http://www.w3.org/1999/xlink"  
     xmlns:xlink="http://www.w3.org/1999/xlink"  
     xml:base="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
     xml:base="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
      
      
     <Service title="Data Request Form" >
     <Service title="DAP4 Dataset Services" xlink:role="http://services.opendap.org/dap4/dataset-services#">
        <link type="application/vnd.opendap.org.dataset-services+xml"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
        <link type="text/html"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.html">
         <link type="text/xml"  
         <link type="text/xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.html"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xml">
            xlink:role="http://services.opendap.org/dap4/data-request-form#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Services_Description_Service">An XML document itemizing the Services available for this dataset.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_HTML_DATA_Request_Form_Service">OPeNDAP HTML Data Request Form for data sub-setting and access.</Description>
     </Service>
     </Service>


     <Service title="Dataset">
 
     <Service title="DAP4 Dataset Metadata" xlink:role="http://services.opendap.org/dap4/dataset-metadata#">
        <link type="application/vnd.org.opendap.dap4.dataset-metadata+xml"
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr">
        <link description="Data Request Form"
            type="text/html"
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr.html">
         <link type="text/xml"  
         <link type="text/xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xml"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr.xml">
            xlink:role="http://services.opendap.org/dap4/dataset#">
        <link type="application/json"
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xml.json"
            xlink:role="http://services.opendap.org/dap4/dataset#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Service_-_The_metadata">DAP4 Dataset Description and Attribute XML Document.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Service_-_The_metadata">DAP4 Dataset Description and Attribute XML Document.</Description>
     </Service>
     </Service>


     <Service title="DAP4 Data">
     <Service title="DAP4 Data" xlink:role="http://services.opendap.org/dap4/data#">
         <link type="multipart/mixed"  
        <link type="application/vnd.org.opendap.dap4.data"
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap" >
             xlink:role="http://services.opendap.org/dap4/data#">
         <link type="text/plain"  
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap.ascii" >
        <link type="text/xml"  
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap.xml" >
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Data_Service">DAP4 Data object.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Data_Service">DAP4 Data object.</Description>
     </Service>
     </Service>


     <Service title="DAP2 Data">
     <Service title="DAP2 Data" xlink:role="http://services.opendap.org/dap2/dods#">
         <link type="application/octet-stream"  
         <link type="application/octet-stream"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dods"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dods">
            xlink:role="http://services.opendap.org/dap2/dods#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Data_Service">DAP2 Data Object.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Data_Service">DAP2 Data Object.</Description>
     </Service>
     </Service>


     <Service title="ASCII Data">
     <Service title="ASCII Data" xlink:role="http://services.opendap.org/dap4/ascii#">
         <link type="text/plain"  
         <link type="text/plain"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.asc"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.asc">
            xlink:role="http://services.opendap.org/dap4/ascii#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ASCII_Data_Service">The DAP4 Data response in ASCII form.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ASCII_Data_Service">The DAP4 Data response in ASCII form.</Description>
     </Service>
     </Service>


     <Service title="NetCDF-File">
     <Service title="NetCDF-File" xlink:role="http://services.opendap.org/dap4/netcdf-3#">
         <link type="application/x-netcdf"  
         <link type="application/x-netcdf"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.nc"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.nc">
            xlink:role="http://services.opendap.org/dap4/netcdf-3#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_NetCDF_File-out_Service">NetCDF file-out response.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_NetCDF_File-out_Service">NetCDF file-out response.</Description>
     </Service>
     </Service>


     <Service title="XML Data Response">
     <Service title="XML Data Response" xlink:role="http://services.opendap.org/dap4/xml-data#">
         <link type="text/xml"  
         <link type="text/xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdap"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdap">
            xlink:role="http://services.opendap.org/dap4/xml-data#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_XML_Data_Service">An XML document containing both the dataset's structural metadata along with data values.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_XML_Data_Service">An XML document containing both the dataset's structural metadata along with data values.</Description>
     </Service>
     </Service>


     <Service title="DDX">
     <Service title="DDX" xlink:role="http://services.opendap.org/dap2/ddx#">
         <link type="text/xml"  
         <link type="text/xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ddx"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ddx">
            xlink:role="http://services.opendap.org/dap2/ddx#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDX_Service">OPeNDAP Data Description and Attribute XML Document.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDX_Service">OPeNDAP Data Description and Attribute XML Document.</Description>
     </Service>
     </Service>


     <Service title="DDS">
     <Service title="DDS" xlink:role="http://services.opendap.org/dap2/dds#">
         <link type="text/plain"  
         <link type="text/plain"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dds"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dds">
            xlink:role="http://services.opendap.org/dap2/dds#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDS_Service">OPeNDAP Data Description Structure.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDS_Service">OPeNDAP Data Description Structure.</Description>
     </Service>
     </Service>


     <Service title="DAS"
     <Service title="DAS"
            xlink:role="http://services.opendap.org/dap2/das#" >
         <link type="text/plain"  
         <link type="text/plain"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.das"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.das">
            xlink:role="http://services.opendap.org/dap2/das#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DAS_Service">OPeNDAP Dataset Attribute Structure.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DAS_Service">OPeNDAP Dataset Attribute Structure.</Description>
     </Service>
     </Service>


     <Service title="RDF">
     <Service title="RDF" xlink:role="http://services.opendap.org/dap4/rdf#">
         <link type="application/rdf+xml"  
         <link type="application/rdf+xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rdf"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rdf">
            xlink:role="http://services.opendap.org/dap4/rdf#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_RDF_Service">An RDF representation of the Dataset response (DDX) document.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_RDF_Service">An RDF representation of the Dataset response (DDX) document.</Description>
     </Service>
     </Service>


     <Service title="INFO">
     <Service title="INFO" xlink:role="http://services.opendap.org/dap2/info#">
         <link type="text/html"  
         <link type="text/html"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.info"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.info">
            xlink:role="http://services.opendap.org/dap2/info#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Info_Service">OPeNDAP Dataset Information Page.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Info_Service">OPeNDAP Dataset Information Page.</Description>
     </Service>
     </Service>


     <Service title="Server Version">
     <Service title="Server Version" xlink:role="http://services.opendap.org/dap4/version#">
         <link type="text/xml"  
         <link type="text/xml"  
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ver"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ver">
            xlink:role="http://services.opendap.org/dap4/version#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Server_Version_Service">An XML document containing information about the software version of the server..</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Server_Version_Service">An XML document containing information about the software version of the server..</Description>
     </Service>
     </Service>


     <Service title="ISO-19115">
     <Service title="ISO-19115" xlink:role="http://services.opendap.org/dap4/iso-19115-metadata#">
         <link type="text/xml"  
         <link type="text/xml"  
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.iso"
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.iso">
            xlink:role="http://services.opendap.org/dap4/iso-19115-metadata#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_19115_Service">ISO 19115 Metadata Representation of the Dataset (DDX) response.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_19115_Service">ISO 19115 Metadata Representation of the Dataset (DDX) response.</Description>
     </Service>
     </Service>


     <Service title="ISO-19115-Score">
     <Service title="ISO-19115-Score" xlink:role="http://services.opendap.org/dap4/iso-19115-score#">
         <link type="text/html"  
         <link type="text/html"  
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rubric"
             xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rubric">
            xlink:role="http://services.opendap.org/dap4/iso-19115-score#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_Conformance_Score_Service">ISO 19115 Metadata Representation conformance score for this dataset.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_Conformance_Score_Service">ISO 19115 Metadata Representation conformance score for this dataset.</Description>
     </Service>
     </Service>


     <Service title="File Access"
     <Service title="File Access" xlink:role="http://services.opendap.org/dap4/file#">
         <link type="text/xml## This value depends on the file being accessed.
         <link type="text/xml ## This value depends on the file being accessed.
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.file"
              xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.file">
            xlink:role="http://services.opendap.org/dap4/file#">
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Native_File_Access_Service">Access to dataset file.</Description>
         <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Native_File_Access_Service">Access to dataset file.</Description>
    </Service>
    <Service title="Dataset Services Description">
        <link type="text/xml"
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml"
            xlink:role="http://services.opendap.org/dap4/dataset#">
        <link type="application/json"
            xlink:href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.json"
            xlink:role="http://services.opendap.org/dap4/dataset#">
        <Description xlink:href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Services_Description_Service">An XML document itemizing the Services available for this dataset.</Description>
     </Service>
     </Service>


Line 233: Line 552:
</source>
</source>
</font>
</font>
-->




I also put together a simple XSLT to make this a human friendly HTML. I added a reference to it in the XML document. When you point a browser at the resource URL (For example http://localhost:8080/opendap/data/nc/fnoc1.nc ) the Service Description response is returned as an XML file (above), the browser detects the xml-stylesheet reference, grabs the XSLT, uses it to convert the XML to HTML and renders it like this:
== Appendix: Dataset Services Response XML schema (<font color="orange">Under Construction</font>)==


[[File:ServiceDescriptionPrototype-01.png]]
This schema works, but it rigidly enforces the order of the content. We may want to rewrite to be more lenient.


== <strike><font color="grey">Prototype #2</font>  </strike>==
<font size="2">
<strike>
<source lang="xml" >
<font color="grey">
This prototype response is based on the OGC Web Services Common Standard (OWS) GetCapabilities response.


<font size="2">
<?xml version="1.0" encoding="UTF-8"?>
<source lang="xml">
<xs:schema
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    targetNamespace="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
<Capabilities xmlns="http://www.opengis.net/wcs/1.1" updateSequence="1288821006000">
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xml="http://www.w3.org/XML/1998/namespace"
    xmlns:dsr="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    elementFormDefault="qualified"  
    attributeFormDefault="unqualified">
   
    <xs:import  namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
    <!--
    -->
    <xs:element name="DatasetServices" type="DatasetServicesType"/>
    <xs:element name="DapVersion" type="DapVersionType"/>
    <xs:element name="ServerSoftwareVersion" type="AnyContentType"/>
    <xs:element name="Service" type="ServiceType"/>
    <xs:element name="Description" type="DescriptionType"/>
    <xs:element name="link" type="linkType"/>
    <xs:element name="alt" type="altType"/>
    <xs:element name="function" type="ExtensionType"/>
    <xs:element name="functionGroup" type="ExtensionType"/>
    <xs:element name="extension" type="ExtensionType"/>
     <!--
     <!--
   
   
    Service Identification
   
   
     -->
     -->
     <ows:ServiceIdentification xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
     <xs:complexType name="DatasetServicesType">
        <ows:Title>OPeNDAP DAP Service</ows:Title>
        <xs:annotation>
         <ows:Abstract>A server to DAP access to datasets datasets</ows:Abstract>
            <xs:documentation>DatasetServices root element type</xs:documentation>
         <ows:Keywords>
         </xs:annotation>
             <ows:Keyword>OPeNDAP</ows:Keyword>
         <xs:sequence>
             <ows:Keyword>nectcdf</ows:Keyword>
             <xs:element ref="DapVersion" minOccurs="1" maxOccurs="unbounded"/>
             <ows:Keyword>DAP</ows:Keyword>
             <xs:element ref="ServerSoftwareVersion" minOccurs="1" maxOccurs="1"/>
        </ows:Keywords>
             <xs:element ref="Description" minOccurs="0" maxOccurs="1"/>
        <ows:ServiceType>DAP</ows:ServiceType>
            <xs:element ref="Service" minOccurs="3" maxOccurs="unbounded"/>
        <ows:ServiceTypeVersion>4.0.0</ows:ServiceTypeVersion>
            <xs:element ref="function" minOccurs="0" maxOccurs="unbounded"/>
        <ows:Fees>NONE</ows:Fees>
            <xs:element ref="functionGroup" minOccurs="0" maxOccurs="unbounded"/>
        <ows:AccessConstraints>NONE</ows:AccessConstraints>
            <xs:element ref="extension" minOccurs="0" maxOccurs="unbounded"/>
    </ows:ServiceIdentification>
         </xs:sequence>
    <ows:ServiceProvider xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
         <xs:attribute ref="xml:base"  use="required"/>
         <ows:ProviderName>OPeNDAP Inc.</ows:ProviderName>
    </xs:complexType>
         <ows:ProviderSite xlink:href="http://www.opendap.org"/>
    <!--
        <ows:ServiceContact>
            <ows:IndividualName>Anonymous Smith</ows:IndividualName>
    -->
            <ows:PositionName>Sys. Admin.</ows:PositionName>
    <xs:complexType name="ServiceType">  
            <ows:ContactInfo>
        <xs:annotation>
                <ows:Phone>
            <xs:documentation>DatasetServices Service type</xs:documentation>
                    <ows:Voice>123-456-7890</ows:Voice>
        </xs:annotation>
                    <ows:Facsimile>234-567-8901</ows:Facsimile>
        <xs:sequence>
                </ows:Phone>
            <xs:element ref="Description" minOccurs="0" maxOccurs="1"/>
                <ows:Address>
            <xs:element ref="link" minOccurs="1" maxOccurs="unbounded"/>
                    <ows:DeliveryPoint>165 Fictitious Dr.</ows:DeliveryPoint>
        </xs:sequence>
                    <ows:City>AnywhereButHere</ows:City>
        <xs:attribute name="title" type="xs:string" use="optional"/>
                    <ows:AdministrativeArea>Rhode Island</ows:AdministrativeArea>
        <xs:attribute name="role" type="xs:anyURI" use="required"/>
                    <ows:PostalCode>02882</ows:PostalCode>
    </xs:complexType>
                    <ows:Country>USA</ows:Country>
    <!--
                    <ows:ElectronicMailAddress>support[a.t]opendap[d.o.t]org</ows:ElectronicMailAddress>
       
                </ows:Address>
    -->  
                <ows:OnlineResource xlink:href="http://your.domain.org/"/>
    <xs:simpleType name="DapVersionType">
                <ows:HoursOfService>24x7x365</ows:HoursOfService>
        <xs:restriction base="xs:string">
                <ows:ContactInstructions>email</ows:ContactInstructions>
             <xs:pattern value="\d{1,}.\d{1,}"></xs:pattern>
            </ows:ContactInfo>
         </xs:restriction>
             <ows:Role>Developer</ows:Role>
     </xs:simpleType>
         </ows:ServiceContact>
     </ows:ServiceProvider>
     <!--
     <!--
   
       
   
    Operations Metadata
   
   
     -->
     -->
     <ows:OperationsMetadata xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
     <xs:complexType name="DescriptionType">
        <ows:Operation name="DAP4 Data">
         <xs:simpleContent>
            <ows:DCP>
             <xs:extension base="xs:string">
                <ows:HTTP>
                 <xs:attribute name="href" type="xs:anyURI"/>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.dap"/>
             </xs:extension>
                </ows:HTTP>
         </xs:simpleContent>
            </ows:DCP>
     </xs:complexType>
            <ows:Parameter name="Format">
                <ows:AllowedValues>
                    <ows:Value>application/x-netcdf-cf1.0</ows:Value>
                    <ows:Value>application/x-dap-3.2</ows:Value>
                </ows:AllowedValues>
            </ows:Parameter>
        </ows:Operation>
        <ows:Operation name="DAP2 Data">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.dods"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetDDX">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.ddx"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetDDS">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.dds"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetDAS">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.das"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetHtmlDataRequestForm">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.html"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetInfoPage">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.info"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetRDF">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.rdf"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetNetcdfFile">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.nc"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetIso">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.iso"/>
                </ows:HTTP>
            </ows:DCP>
         </ows:Operation>
        <ows:Operation name="GetIsoRubric">
             <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.rubric"/>
                 </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="DataFileAccess">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc.file"/>
                </ows:HTTP>
            </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetCapabilities">
            <ows:DCP>
                <ows:HTTP>
                    <ows:Get xlink:href="http://test.opendap.org:8090/opendap/data/nc/fnoc1.nc"/>
                </ows:HTTP>
             </ows:DCP>
         </ows:Operation>
     </ows:OperationsMetadata>
     <!--
     <!--
   
   
    Contents
          
          
    -->
    <xs:complexType name="altType">
        <xs:attribute name="type" type="xs:string"/>
    </xs:complexType>
    <!--
       
    -->
    <xs:complexType name="linkType">
        <xs:annotation>
            <xs:documentation>DatasetServices link type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="alt" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="href" type="xs:string" use="required"/>
        <xs:attribute name="type" type="xs:string" use="required"/>
        <xs:attribute name="description" type="xs:string" use="optional"/>       
    </xs:complexType>
    <!--
    -->
    <xs:complexType  name="AnyContentType" mixed="true">
        <xs:annotation>
            <xs:documentation>
                An element of this type may contain arbitrary XML or text content.
                The resulting content is may be ignored by DAP software. Other software
                might find the information useful. The XML elements must
                satisfy the requirements for 'lax' processing under schema 1.0.
                In practice, that means just about anything.
                ( <xs:any/>+ )
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:any namespace="##any" minOccurs="0" processContents="lax"/>
        </xs:sequence>
        <xs:anyAttribute processContents="lax" namespace="##any"/>
    </xs:complexType> 
    <!--
    -->
    <xs:complexType name="ExtensionType">
        <xs:annotation>
            <xs:documentation>Server Extension Type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="Description" minOccurs="1" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="role" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!--
    -->
      
      
    -->
</xs:schema>
    <Contents>
 
        <Dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xml.opendap.org/ns/DAP2" name="fnoc1.nc" xsi:schemaLocation="http://xml.opendap.org/ns/DAP2 http://xml.opendap.org/dap/dap2.xsd">
            <Attribute name="NC_GLOBAL" type="Container">
                <Attribute name="base_time" type="String">
                    <value>88- 10-00:00:00</value>
                </Attribute>
                <Attribute name="title" type="String">
                    <value> FNOC UV wind components from 1988- 10 to 1988- 13.</value>
                </Attribute>
            </Attribute>
            <Attribute name="DODS_EXTRA" type="Container">
                <Attribute name="Unlimited_Dimension" type="String">
                    <value>time_a</value>
                </Attribute>
            </Attribute>
            <Array name="u">
                <Attribute name="units" type="String">
                    <value>meter per second</value>
                </Attribute>
                <Attribute name="long_name" type="String">
                    <value>Vector wind eastward component</value>
                </Attribute>
                <Attribute name="missing_value" type="String">
                    <value>-32767</value>
                </Attribute>
                <Attribute name="scale_factor" type="String">
                    <value>0.005</value>
                </Attribute>
                <Attribute name="DODS_Name" type="String">
                    <value>UWind</value>
                </Attribute>
                <Attribute name="b" type="Byte">
                    <value>128</value>
                </Attribute>
                <Attribute name="i" type="Int32">
                    <value>32000</value>
                </Attribute>
                <Attribute name="WOA01" type="Url">
                    <value>"http://localhost/junk"</value>
                </Attribute>
                <Int16/>
                <dimension name="time_a" size="16"/>
                <dimension name="lat" size="17"/>
                <dimension name="lon" size="21"/>
            </Array>
            <Array name="v">
                <Attribute name="units" type="String">
                    <value>meter per second</value>
                </Attribute>
                <Attribute name="long_name" type="String">
                    <value>Vector wind northward component</value>
                </Attribute>
                <Attribute name="missing_value" type="String">
                    <value>-32767</value>
                </Attribute>
                <Attribute name="scale_factor" type="String">
                    <value>0.005</value>
                </Attribute>
                <Attribute name="DODS_Name" type="String">
                    <value>VWind</value>
                </Attribute>
                <Int16/>
                <dimension name="time_a" size="16"/>
                <dimension name="lat" size="17"/>
                <dimension name="lon" size="21"/>
            </Array>
            <Array name="lat">
                <Attribute name="units" type="String">
                    <value>degree North</value>
                </Attribute>
                <Float32/>
                <dimension name="lat" size="17"/>
            </Array>
            <Array name="lon">
                <Attribute name="units" type="String">
                    <value>degree East</value>
                </Attribute>
                <Float32/>
                <dimension name="lon" size="21"/>
            </Array>
            <Array name="time">
                <Attribute name="units" type="String">
                    <value>hours from base_time</value>
                </Attribute>
                <Float32/>
                <dimension name="time" size="16"/>
            </Array>
            <dataBLOB href=""/>
        </Dataset>
    </Contents>
</Capabilities>
</source>
</source>
</font>
</font>


== fini ==


The first section ows:ServiceIdentification preserves the intended semantics of GetCapabilities very well, as the section really has little to do with any particular web service (REST or otherwise) and everything to do with who to contact about the service instance. Populating the Contents section with the DDX object is similarly well mapped to the original intent: "''The Contents section of a service metadata document normally contains metadata about the data served by this server''" (OGC 06-121r9 section 7.4.8)
Contains cruft in comments...


However, while this document does supply the necessary links to get to the various products associated with the DAP service it does so at the expense of changing the semantics of the components of the OperationsMetadata part of the response.  As far as I can tell in OGC parlance each operation in this section would be bound to the request parameter in the constraint expression. Consider this DescribeCoverage request:


<code><font size="2">
<!--
<nowiki>http://test.opendap.org:8090/WCS?service=WCS&version=1.1.2&</nowiki>'''request=DescribeCoverage'''&identifiers=S1/opendap/ioos/200803061600_HFRadar_USEGC_6km_rtv_SIO.ncml
I also put together a simple XSLT to make this a human friendly HTML. I added a reference to it in the XML document. When you point a browser at the resource URL (For example http://localhost:8080/opendap/data/nc/fnoc1.nc ) the Service Description response is returned as an XML file (above), the browser detects the xml-stylesheet reference, grabs the XSLT, uses it to convert the XML to HTML and renders it like this:
</font></code>


Obviously this interpretation of the semantics of the ows:Operation elements doesn't fit with the intended semantics in our example.  
[[File:ServiceDescriptionPrototype-01.png]]


Also, the OWS allows for the optional inclusion of any number of ows:Parameter and ows:Constraint elements that can be used with each operation. In the schema these parameter and constraint objects are both of type ows:DomainType. The DomainType contains a description of a domain using the following terms:
== Rationale for the solution ==
* PossibleValues
** AllowedValues - expressed as a list of allowed values and/or range(s) of allowed values.
** AnyValue - Any value is allowed
** NoValues - no values allowed
** ValuesReference - Reference to externally specified list of all the valid values and/or ranges of values for this quantity.
* Meaning - Some kind of annotation about what the "meaning" of this parameter/constraint expression is.
* DataType (where data type is expressed as a an "xlink:href attribute that references a URN for a well-known data type",
* ValuesUnit - The units of the values of this parameter/constraint expression expressed as an "xlink:href attribute that references a URN for a well-known unit of measure (uom).
* Metadata - where metadata is defined as either links to metadata documents or simply as text embedded in ows:Metadata elements. 


I am not at all clear the distinction is between the ows:Parameter and ows:Constraint. It is my thinking that each of them represent a possible term in the query part of a URL. For exampleL ''?p=43&z=foobar'' could be seen as an ows:Parameter with name "p" and an ows:Constraint with name "z".  
The solution provides DAP4 servers with an interface that allows for both server-driven and agent driven content negotiation as described in [[http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html  section 12 of the HTTP 1.1 specification]].  Providing the DatasetServices response in XML allows many downstream applications to ingest the content and leaves open the option for server implementers to add XSLT references to the document so that clients like browsers can easily build a presentation view of the information.


== Discussion ==


In DAP our constraint expressions (CEs) are fluid*: Every dataset has it's own set of left-operands (the names of the variables in the dataset) and valid parameters for server side functions (the names of the variables in the dataset).


The projection section of the DAP CE doesn't make use of an equals sign, but instead uses a comma separated list of these things:
=== Using Atom 1.0 ===


* some/all the names of the variables in the dataset which may be followed by array/sequence subset markup on some/all variables
The proposed encoding for this information is to use [http://en.wikipedia.org/wiki/Atom_(standard) Atom 1.0]. The advantages of this encoding are several and the detractions are close to nil. Atom 1.0 provides the DAP with a widely-used standard for representing information that is very general in nature (that data are accessible using a set of web services, each of which provides a sightly different kind of response and can be accessed using a different URL). Furthermore, we can use this same response in other responses a server might like to provide such as a ''data cast'' provides to subscribers or an OpenSearch result. Using Atom is important in those contexts because a response that it not specific to DAP is a requirement. At the same time, because the Atom specification does not impose needless or complex additional requirements, the cost of using it is low. In fact the only information in Atom 1.0 that is not listed above is a the name and email of an ''author'' for the ''entry''. While this might be rationalization, including that information could help a number of users who send email to support lists asking about dataset ''X'' simply because they don't know where/who else to ask.
* server side functions which may take variable names and other explicit values as parameters. The acceptable range of these explicitly valued parameters may be a function of some variables range, or not.


to make the projection.  
Using Atom, A DAP4 web service is described by:
* An 'entry' that serves to group a set of ''link'' elements that reference different services to a common set of information about the dataset. For the dataset, that information is:
** A simple human readable name called ''title''.
** An ''id'' that uniquely identifies the ''entry''.
** The last modified time for the dataset (''updated'').
** A person responsible for the dataset (''author'').
** An optional ''content'' element. (well, it's conditionally optional - see the [http://tools.ietf.org/html/rfc4287 Atom spec])
* For each service, a ''link'' element is used where the four attributes ''title'', '' rel'', ''type'', ''href'' are used as follows:
** ''title'' - A human-readable description of the service
** ''rel'' - See the [http://tools.ietf.org/html/rfc4287 Atom spec]
** ''type'' - A MIME-type that identifies the response as specific to OPeNDAP such as ''application/vnd.opendap.org.dap4.xdp+xml''
** ''href'' - The full URL used to get the response


Since the names, types, and ranges of variables typically change from one dataset to another the acceptable values in the query part of the request URL is different for every dataset.
For the Atom-based response, we propose to use MIME types as Ethan suggested (application/vnd.opendap.org.dap4.data etc.)  when describing services in the Dataset Services Response, and then, when the server provides those responses over HTTP it sets the content header to the [[DAP4_Web_Services_v3#Media_Types | lowest common mime type]].  
 
After reading over the schema and the supporting documentation at OGC I do not see how the syntax provided for parameters and constraints can be used to express the details of the DAP Constraint Expression.
 
Where does this leave us? While many developers are already familiar with the layout and content of the OWS GetCapabilities response, I think that the semantics of it's components don't lend themselves to describing the existing DAP REST service. We can make a valid document using the OGC components and schemas that contains the information that we want, but the meaning of the parts will fail to adhere to the meanings assigned in the OGC schemas and documentation. I fear this would probably cause more confusion, consternation, and gnashing of teeth than Prototype #1 where we simply created the minimum document needed to achieve our goal for providing a service description that itemizes all of the data products and services available for a particular dataset.
 
[[User:Jimg|Jimg]] 09:29, 31 January 2012 (PST) I agree. GetCapabilities is not a good fit for this feature.
 
<nowiki>*</nowiki>[[User:Jimg|Jimg]] 20:57, 14 February 2012 (PST) I started to write an explanation of the differences between our constraint expressions and the WCS query string, but I think the most important aspect is that the the two use a different syntax and the description of that series of tokens (some of which are a function of the service and some of which are a function of the data being served - in both cases ) is heavily tied to the syntax of the URL and it's Query String component.


For example, in the Dataset Services response we might describe the Dataset Metadata service like this:
<font size="2">
<source lang="xml" >
...
    <link title="DAP4 Dataset Metadata XML Document."
          rel="related"
          type="application/vnd.opendap.org.dap4.xdp+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdp"/>
...
</source>
</font>
</font>
</strike>
== Comments ==
[[User:Jimg|Jimg]] 16:22, 14 November 2011 (PST)
:We should think about making this a JSON response, or think about having ''http://server/file.nc'' return the XML and ''http://server/file.nc.json'' return JSON using an XSLT transform.
[[User:Jimg|Jimg]] 16:22, 14 November 2011 (PST)
: Nathan and I both conclude that the XML response should include the full URL and not do some weird hack where URLs are 'built'.
:While this might be specific to HTTP and the web, I think we should include in the design that a JSON version of this document will be returned if the client announces that it understands such thing (the default response will be XML with an embedded XSL stylesheet that provides a transform to HTML). The HTTP/1.1 request and response would look like:
<pre>
GET / HTTP/1.1
Host: api.example.com
Accept: application/vnd.example.link_templates+json


And when a DAP4 server responds to a client asking for http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdp the server would set the HTTP headers so that the Content-Type would be the  [[DAP4_Web_Services_v3#Media_Types | lowest common mime type]] (in this case ''text/xml'') . The server could put the more expressive type tag in the ''Content-Description'' header:
<font size="2">
<source lang="txt" >
HTTP/1.1 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.example.link_templates+json
Date: Mon, 23 May 2005 22:38:34 GMT
Cache-Control: max-age=3600
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Connection: close
Content-Type: test/xml
</pre>
Content-Description: application/vnd.opendap.org.dap4.xdp+xml; url=http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdp
Content-Encoding: gzip
X-DAP: 4.0
</source>
</font>


:Where the request header ''Accept:'' is the key bit. See the post Ethan referenced for more information about this: [http://www.mnot.net/blog/2011/10/25/web_api_versioning_smackdown Web API Versioning Smackdown]
For normative information on Atom, see [http://tools.ietf.org/html/rfc5023 RFC 5023] and [http://tools.ietf.org/html/rfc4287 RFC 4287].


==== Example: Validated Atom Document with one atom:entry for a dataset, and an atom:link for each service ====


[[User:dmh|Dennis]] 4/12/2012
<font size="2">
: I would like to propose an (possibly off-the-wall) alternate response format based on treating the service terminus as a DAP4 dataset more or less like any other dataset. This means that the response would be a DDX plus content. The DDX would encode the capabilities of the server using the DAP4 notions of group, variable, attribute, etc. The specific values would be returned as the associated content. This would allow us to use our (yet to be defined) query capability to extract specific capability values. It would also (IMO) simplify programmatic access to the server capability information.
<source lang="xml" >


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entry xmlns="http://www.w3.org/2005/Atom">


[[User:Ndp|ndp]] 20:17, 19 April 2012 (PDT)
    <title>DatasetServices: ECMWF_ERA-40_subset.ncml</title>


: I stood up  a prototype of the Dataset Services (a.k.a. the Service Terminus) on test.o.o. I quickly discovered the following mixed result: Now that the web pages contain links to all of the services, the crawler bots find them all!
    <id>http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml</id>


: This is great news because, well, the services are exposed and our experiment in improving  our servers RESTfulness succeeded.
    <updated>2003-12-13T18:30:02-05:00</updated>
   
    <author>
        <name>Nathan Potter</name>
        <email>johndoe@devnull.com</email>
    </author>
    <content type="xhtml" xml:lang="en" xml:base="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
        <div xmlns="http://www.w3.org/1999/xhtml">DAP Dataset Services for http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml</div>
    </content>


: This is bad news because the bots are asking for the ASCII, NetCDF file out, and XML data responses for everything on the server. Which is trashing it. By which I mean all of the servers memory and CPU resources are being consumed by bots. The server logs are full of BES client timeouts and broken pipes. Response times are in the gutter.
    <link title="Dataset Services Description"
          rel="self"
          type="application/atom+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml"/>
   
    <link title="DAP4 Dataset Metadata XML Document."
          rel="related"
          type="application/vnd.opendap.org.dap4.dmr+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr"/>
   
    <link title="DAP4 Data object."
          rel="enclosure"
          type="application/vnd.opendap.org.dap4.data"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap"/>


: This is an unintended consequence to our new Dataset Services response and I think we need to carefully consider how we might remediate this problem.
    <link title="OPeNDAP HTML Data Request Form for data sub-setting and access."
          rel="related"
          type="text/html"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.html" />


: On the one hand I think we want the catalog/web pages to be crawled and indexed. On the other we really don't want bots asking for all of the data in all of the ways it can be transmitted.
    <link title="DAP2 Data Object."
          rel="enclosure"
          type="application/vnd.opendap.org.dap2.data"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dods"/>
         
    <link title="DAP4 Data response in ASCII form."
          rel="enclosure"
          type="text/plain"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.asc"/>
         
    <link title="NetCDF-3 file-out response."
          rel="enclosure"
          type="application/x-netcdf"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.nc"/>
         
    <link title="XML Data Response"
          rel="enclosure"
          type="application/vnd.opendap.org.dap4.data+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xdap"/>
         
    <link title="DAP2 DDX document"
          rel="related"
          type="application/vnd.opendap.org.dap2.ddx+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ddx"/>
         
    <link title="DAP2 DDS document"
          rel="related"
          type="application/vnd.opendap.org.dap2.dds"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dds"/>
         
    <link title="DAP2 DAS document"
          rel="related"
          type="application/vnd.opendap.org.dap2.dds"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.das"/>
         
    <link title="RDF representation of the Dataset Metadata response."
          rel="related"
          type="application/rdf+xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rdf"/>
         
    <link title="DAP2 Dataset Information Page"
          rel="related"
          type="text/html"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.info"/>
         
    <link title="Server Version Document"
          rel="related"
          type="text/xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.ver"/>
         
    <link title="ISO 19115 Metadata Representation of the Dataset (DDX) response."
          rel="related"
          type="text/xml"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.iso"/>
         
    <link title="ISO 19115 Metadata Representation conformance score for this dataset."
          rel="related"
          type="text/html"
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.rubric"/>
         
    <link title="Dataset file access"
          rel="enclosure"
          type="text/xml" 
          href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.file"/>
         
</entry>
   


== Issues ==
</source>
 
</font>
* This a change in server behavior that will change the response content of file access URLs. These URLs are not part of the regular DAP URL pattern and their current behavior is a function of server configuration.
-->
* How might we describe the way to elicit DAP3.x and DAP4 versions of the responses in this description given that we currently rely on the XDAP-Accept HTTP header to inform the server of the version being requested? [[User:Jimg|Jimg]] 16:18, 14 November 2011 (PST) We can define a new set of extensions for these responses, especially since there are only two (ddx4 and dap4, e.g.). There are several other syntaxes that put this information in the URL, but if we use unique URLs to reference these new responses, then we don't break REST. This would mean that the XDAP-Accept: header would be dropped, but that's a separate discussion.
* [[User:Jimg|Jimg]] 10:42, 26 January 2012 (PST) I am now leaning toward using ''.ddx'' and ''.dap'' to be the way that DAP4 metadata and data are accessed, period. This means dropping the idea of version negotiation, which I think is a poor design for a web service. the extensions ''.das'', ''.dds'' and ''.dods''  woud return the tried and true DAP2 response objects and any server hat support the five extensions clearly support DAP2 and DAP4. No client will every ask for a DAP2 DDX and be surprised by getting DAP4 (which it won't be able to parse) because to do so would be nonsensical (and anti-causal, sort of...). The one hitch with this idea is that there are some DAP2++ clients out there that gobble up DDX responses...
*''<font color="red">I know we discussed additional issues, but I can't recall them. Please add them if you do!</font>''

Latest revision as of 17:20, 20 November 2013


<-- back to OPULS Development

Author: ndp

Background

Legacy DAP2 servers provide a number of dataset level responses (services). These include DAP2 services such as the DDS, DAS, and DDX, plus other services that have been added over time such as the RDF and ISO responses. There is no method defined by the DAP2 protocol for a user (or software agent) to discover which of these many services might be available for a particular dataset. While THREDDS catalogs do provide a mechanism for determining which services are associated with which datasets, they don't actually provide a mechanism for discovering the details of the various service URLs. A THREDDS catalog might identify a DAP2 service, but the URL that can be assembled from the THREDDS catalog for that service is limited to just the base dataset URL. Typically dereferencing this URL will provide one of two things - either the underlying data file (for example a netcdf file) or an HTTP 403 error if direct access to the underlying files has been disabled in the server configuration.

Example:

This URL points to a dataset on a DAP2 server:

http://test.opendap.org:8080/opendap/data/nc/fnoc1.nc

Dereferencing the link will not connect you to a DAP2 service or DAP2 response. It will (likely) return the underlying netcdf file. The only way to know that DAP2 services exist for this is by reading the URL path and recognizing that it is probably an instance of a DAP2 server based on the composition of the URL. In fact, there is no guarantee that dereferencing this URL will even yield the underlying file, as that behavior is a configuration option for some server implementations. If that access is not allowed in the configuration, then dereferencing the URL will simply return an HTTP 403 (forbidden) error.

Dataset Services Response

The Dataset Services Response provides a 'Services' or 'Capabilities' response for DAP4. Dereferencing an unadorned DAP4 dataset resource URL will return a document describing the DAP services available for the dataset. This is a REQUIRED response and the only valid response for an 'unadorned' dataset resource URL. We will refer to this response as the 'Dataset Services Response' or 'DSR' in the 'DAP4 Web Services' specification and the remainder of this document.

At minimum the DSR document MUST provide, for each service available for the dataset:

  • A human readable title of that service (e.g., The Dataset Metadata Response service for the dataset)
  • One or more links that can be dereferenced to get the various representations of the response for the dataset.
  • An unambiguous, unique to the service type, resource role ID that serves as a way to clearly identify what each service does. (Note: Resource roles for all DAP4 services are defined, as well as for several other legacy DAP2 related services in the 'DAP4 Specification, Volume 2 Web Services'. Defining a resource role for a new service will be the responsibility of the service creator.)
  • A brief description of the service

The response should also include:

  • A link to a complete, human readable, description of the service.
  • A reference to an XSLT that a browser would use to render the description into HTML for a presentation view.
  • Descriptions and syntax of server side functions available for the dataset

Service Access

A service is accessed by dereferencing one of the access URLs held in the href attribute of a <dsr:link> elements, which is typically constructed by adding some type of suffix to the dataset's referent (aka base) URL. The way in which the query string (aka constraint expression) is used is defined by each service, and there is no requirement for inter-service query string API conformity.

A more extensive discussion of the various services that might appear in a DatasetServices document can be found in DAP4 Volume 2, Web Services.

Note: If a client understands how to modify/augment the dataset resource URL (as described in the DAP4 Volume 2, Web Services ) such that it becomes a DAP response URL then it need never obtain the Dataset Services response.

Dataset Services Response Encoding

c.f. DAP4 Volume 2, Web Services

In this section the namespace prefix dsr is associated with the namespace http://xml.opendap.org/ns/DAP/4.0/dataset-services#.

dsr:DatasetServices element

The Dataset Services Response MUST contain a top level <dsr:DatasetServices> element. This <dsr:DatasetServices> element MUST contain:

  • An xml:base attribute whose value is the resource URL that was dereferenced to request the DSR response.
  • A list of DAP versions supported by server
    These appear as one or more child <dsr:DapVersion> elements of the <dsr:DatasetServices> element.
  • The implementation version of the server that produced the DSR.
    This appears as a single <dsr:ServerSoftwareVersion> child element of the <dsr:DatasetServices> element.
  • A list of all available DAP4 services for the dataset
    This is represented as 3 or more <dsr:Service> elements. (There are 3 required services for a DAP4 server.)
  • A list of supported extensions
    • Resource type extensions
    • Media type extensions
    • Server-side function extensions

The <dsr:DatasetServices> element SHOULD contain:

  • A title attribute whose value is a human readable title for the dataset.

The <dsr:DatasetServices> element MAY contain:

  • A <dsr:Description> element whose value is a human readable description of the dataset.

dsr:DapVersion Element

The <dsr:DapVersion> element contains a single DAP version value as a text string. The DAP version is represented as two integer values separated by a period, MM.mm where the first value (MM) is the major version of the DAP protocol, and the second value (mm) is the minor version. Multiple <dsr:DapVersion> elements are used to represent that server can support multiple versions of the DAP protocol, one instance for each supported version.

Example:

<DapVersion>4.0</DapVersion>
<DapVersion>3.2</DapVersion>
<DapVersion>2.0</DapVersion>

dsr:ServerSoftwareVersion element

The <dsr:ServerSoftwareVersion> element has no attributes and may contain as little as a simple text string (e.g., "TDS 4.3.57" or "Hyrax 1.7.45"), or it may contain any well-formed XML content not in the dsr namespace that the server implementer sees fit to use to describe the software version of their server implementation.

dsr:Service element

Each DAP4 web service is described by a <dsr:Service> element with:

  • An optional title attribute whose value is a simple human readable title for the service.
  • An required role attribute whose value is a unique to the service type, resource role ID (a URI) that serves as a way to clearly identify what each service does. This is intended to allow people and software to unambiguously identify specific services, irrespective of their human readable title. The idea is that that the role attribute tells you what is going to happen when you dereference the URL held in the <dsr:link> element. Each service has a single role and all of the links (alternate representations) must fulfill the same role.
  • An optional <dsr:Description> element .
  • One or more <dsr:link> elements.
Regarding the role attribute

With regards to multiple representations of a service response and the role attribute: While there may be many alternate representations of a response, not all will fufill the same role. Representations fulfilling the same role should be bundled together in their own Service with the appropriate role value. For example the DMR can be mapped to the ISO19115 metadata space, but IS0-19115 responses are clearly outside of the role of the regular DMR service, which returns a DAP4 metadata response. One could view it as the two roles described different domains.

dsr:Description element

Each <dsr:Description> element MUST contain:

  • An optional href attribute whose value is a URL string that points to a human readable document describing the service.
  • The required text content of the dsr:Description element MUST be a human readable description of the service.

dsr:link element

Each <dsr:link> element MUST contain:

  • A required type attribute whose value is the media-type for the normative representation returned by that URL held in the href attribute.
  • A required attribute called href whose value is a URL that when dereferenced will return the service response in the media type described by the value of the type attribute.
  • An optional attribute called description whose value is a human readable string that provides a brief description of the <dsr:link> elements semantics.
  • Zero or more <dsr:alt> elements, one for each and every alternate representation of the response that can be requested using HTTP server-driven content negotiation in conjunction with the href URL. Each <dsr:alt> element MUST contain:
    • A required type attribute whose value is the MIME type that would be used in the HTTP Accept header to request that representation from the server.

Extensions

Server extensions are simple descriptions of server behaviors that fall outside of the services descriptions provided so far. There are three types of extensions: function, functionGroup, and extension.

A linear regression, a re-gridding operation, and a coordinate re-projection are all examples of a function. A collection of functions that allows the user to perform geocentric manipulations of the data (such as re-gridding operations, reprojection operations) taken together could define a functionGroup. An extension is a server behavior that does not operate directly on the data values, but may provide other types of services and functionality for the client.

It is beyond the scope of this specification to attempt to describe the syntax of usage of a function in some general way. Rather we have chosen to provide a simple mechanism (the role attribute) to alert client software implementations that the server supports specific additional behaviors they can utilize, along with more descriptive elements through which humans can be alerted to the presence of server features and where to find out more about them.

dsr:function

A function extension always describes an operation that applies to the Data Response and the Dataset Metadata Response (because some functions might alter the syntacic structure of the data the change would be previewed by applying the function to the DMR).

Each <dsr:function> MUST contain:

  • A name attribute whose value is the name of the function as it would be used in a DR or DMR request.
  • A role attribute whose value is a URI that universally defines the function.
  • A <dsr:Description> element whose value is a human readable description of the function and a link to detailed documentation of the function and its usage.

A common example of a function would be the DAP2 (and DAP4) geogrid function that allows users to be sub-sampled gridded data using georeferenced values.

dsr:functionGroup

A function group identifies that the server supports a group of functions. Rather than enumerating a large list of related functions, the functionGroup provides the user with the information that the server supports a collection of related functions.

Each <dsr:functionGroup> MUST contain:

  • A name attribute whose value is the human readable name of the collection of functions.
  • A role attribute whose value is a URI that universally defines the function group.
  • A <dsr:Description> element whose value is a human readable description of the function group and a link to detailed documentation regarding the functions in the function group and their usage.

An example of a function group would be a server that implemented a functional syntax for all of the functions found in the Ferret application.

dsr:extension

An extension is a mechanism for indicating that the server supports a certain behavior. This behavior MUST NOT be an operation/computation on the data (other wise it would be a dsr:functionor a dsr:functionGroup), but rather some other behavior that the server can undertake.

Each <dsr:extension> MUST contain:

  • A name attribute whose value is the human readable name of the extension.
  • A role attribute whose value is a URI that universally defines the extension.
  • A <dsr:Description> element whose value is a human readable description of the extension and a link to detailed documentation regarding the extension and it's behavior and usage.

An example of an extension would be the DAP4 asynchronous response support. Some servers will support this functionality, and the functionality is not defined as an operation on the data itself, but in terms of the transaction procedures for accessing the data.

Example: A Minimal DSR

This example contains only the required components of the DSR document from a minimal DAP4 server implementation.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DatasetServices xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    xml:base="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">

    <DapVersion>4.0</DapVersion>
    
    <ServerSoftwareVersion>Hyrax-2.7.9</ServerSoftwareVersion>
        
    <Service title="DAP4 Dataset Services" role="http://services.opendap.org/dap4/dataset-services">
        <link type="application/vnd.opendap.org.dataset-services+xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml">
              <alt type="text/xml"/>
        </link>
        <link type="text/xml"  href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.xml"/>
    </Service>

    <Service title="DAP4 Dataset Metadata"  role="http://services.opendap.org/dap4/dataset-metadata">
        <link type="application/vnd.org.opendap.dap4.dataset-metadata+xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr">
              <alt type="text/xml"/>
        </link>
        <link type="text/xml" href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dmr.xml"/>
    </Service>

    <Service title="DAP4 Data" role="http://services.opendap.org/dap4/data">
        <link type="application/vnd.org.opendap.dap4.data" href="http://test.opendap.org:8090/opendap/hyrax/ECMWF_ERA-40_subset.ncml.dap" />
    </Service>

    
</DatasetServices>

Example: A fully featured and annotated DSR document

This example contains all of the optional components for a hypothetical DAP4 server that also supports DAp2 requests, server side functions, and asynchronous transactions.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/opendap/xsl/serviceDescription.xsl"?>
<DatasetServices xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#" 
                 xml:base="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc">

    <Description>Our friend fnoc1.nc</Description>

    <!-- ##################################################################################### -->
    <!--       DAP versions this server supports                                               --> 
    <!-- ..................................................................................... -->
    <DapVersion>4.0</DapVersion>
    <DapVersion>3.2</DapVersion>
    <DapVersion>2.0</DapVersion>
    
    <!-- ##################################################################################### -->
    <!--  The software version of the server that is providing the DAP4 Dataset Services       -->
    <!--   response.                                                                           --> 
    <!-- The ServerSoftwareVersion element may contain text, or any XML element content as     -->
    <!-- long as the XML is not in the document namespace                                      -->
    <!-- ..................................................................................... -->
    <ServerSoftwareVersion>Hyrax-2.7.9</ServerSoftwareVersion>
    
    
    <!-- ##################################################################################### -->
    <!--       Required DAP4 Services                                                          --> 
    <!-- ..................................................................................... -->

    <Service title="DAP4 Dataset Services" role="http://services.opendap.org/dap4/dataset-services">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Services_Description_Service">An index of the Services available for this data resource.</Description>

        <link description="Normative form of the DSR" 
              type="application/vnd.opendap.org.dataset-services+xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc">
              <alt type="text/html"/>
              <alt type="text/xml"/>
        </link>
        
        <link description="HTML representation of the DSR"  
              type="text/html" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.html"/>
              
        <link description="Normative DSR with generic Content-Type" 
              type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.xml"/>
              
    </Service>

    <Service title="DAP4 Dataset Metadata"  role="http://services.opendap.org/dap4/dataset-metadata">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Dataset_Service_-_The_metadata">The DAP4 metadata content for this data resource..</Description>

        <link description="Normative form of the DMR" 
              type="application/vnd.org.opendap.dap4.dataset-metadata+xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr">
              <alt type="text/html"/>
              <alt type="text/xml"/>
              <alt type="application/rdf+xml"/>
        </link>
        
        <link description="Data Request Form" 
              type="text/html" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.html"/>
              
        <link description="Normative DMR with generic Content-Type" 
              type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.xml"/>
              
        <link description="RDF representation of DMR" 
              type="application/rdf+xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.rdf"/>
    </Service>

    <Service title="DAP4 Data" role="http://services.opendap.org/dap4/data">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Data_Service">DAP4 Data object for this data resource.</Description>
        <link description="The normative form of the DAP4 Data Response"
              type="application/vnd.org.opendap.dap4.data"  
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap" >
              <alt type="text/plain"/>
              <alt type="text/xml"/>
              <alt type="application/x-netcdf"/>
        </link>
        
        <link description="A comma separated values (CSV) representation of the DAP4 Data Response object."
              type="text/plain"  
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.ascii" />
        <link description="XML representation of the DAP4 Data Response object."
              type="text/xml"   
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.xml" />
        <link description="NetCDF-3 representation of the DAP4 Data Response object."
              type="application/x-netcdf"   
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dap.nc" />
    </Service>

    <!-- ##################################################################################### -->
    <!--   Optional DAP4 Related Services                                                      --> 
    <!-- ..................................................................................... -->

    <Service title="ISO-19115 Metadata Service" role="http://services.opendap.org/dap4/iso-19115">
        <link description="Dataset metadata as ISO-19115" 
              type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.iso">
              <alt type="text/html"/>
        </link>
        <link description="ISO-19115 conformance score" 
              type="text/html" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dmr.rubric">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_ISO_Conformance_Score_Service">ISO-19115 conformance score for the DMR.</Description>
    </Service>

    <Service title="File Access" role="http://services.opendap.org/dap4/file">
        <link type="text/xml ## This value depends on the file being accessed."  
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.file">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Native_File_Access_Service">Access to dataset file.</Description>
    </Service>



    <!-- ##################################################################################### -->
    <!--       DAP2 Services                                                                   --> 
    <!-- ..................................................................................... -->
    <Service title="DAP2 Data" role="http://services.opendap.org/dap2/dods">
        <link type="application/octet-stream" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dods">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Data_Service">DAP2 Data Object.</Description>
    </Service>

    <Service title="DDX" role="http://services.opendap.org/dap2/ddx">
        <link type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.ddx">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDX_Service">OPeNDAP Data Description and Attribute XML Document.</Description>
    </Service>

    <Service title="DDS" role="http://services.opendap.org/dap2/dds">
        <link type="text/plain" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.dds">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DDS_Service">OPeNDAP Data Description Structure.</Description>
    </Service>

    <Service title="DAS" role="http://services.opendap.org/dap2/das" >
        <link type="text/plain" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.das">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_DAS_Service">OPeNDAP Dataset Attribute Structure.</Description>
    </Service>


    <Service title="INFO" role="http://services.opendap.org/dap2/info">
        <link type="text/html" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.info">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP2:_Info_Service">OPeNDAP Dataset Information Page.</Description>
    </Service>

    <Service title="Server Version" role="http://services.opendap.org/dap4/version">
        <link type="text/xml" 
              href="http://test.opendap.org:8090/opendap/hyrax/data/fnoc1.nc.ver">
        <Description href="http://docs.opendap.org/index.php/DAP4_Web_Services#DAP4:_Server_Version_Service">An XML document containing information about the software version of the server..</Description>
    </Service>


    <!-- ##################################################################################### -->
    <!--       Server Side Functions                                                           --> 
    <!-- ..................................................................................... -->


    <function name="geogrid" role="http://services.opendap.org/dap4/server-side-function/geogrid">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#geogrid">Allows a DAP Grid variable to be sub-sampled using georeferenced values.</Description>
    </function>

    <function name="grid" role="http://services.opendap.org/dap4/server-side-function/grid">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#grid">Allows a DAP Grid variable to be sub-sampled using the values of the coordinate axes.</Description>
    </function>

    <function name="linear_scale" role="http://services.opendap.org/dap4/server-side-function/linear-scale">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#linear_scale">Applies a linear scale transform to the named variable.</Description>
    </function>

    <function name="version" role="http://services.opendap.org/dap4/server-side-function/version">
        <Description  href="http://docs.opendap.org/index.php/Server_Side_Processing_Functions#version">Returns version information for each server side function.</Description>
    </function>
   
    <!-- ##################################################################################### -->
    <!--       Server Side Function Group                                                      --> 
    <!-- ..................................................................................... -->

 
    <functionGroup name="ferret" role="http://pmel.noaa.gov/dap4extension/ferret" >
        <Description href="http://ferret.pmel.noaa.gov/Ferret/documentation">This server supports ferret functions.</Description>
    </functionGroup>

    <!-- ##################################################################################### -->
    <!--       Extensions                                                                      --> 
    <!-- ..................................................................................... -->

    <extension name="async" role="http://opendap.org/extension/async">
        <Description href="http://docs.opendap.org/index.php/DAP4:_Asynchronous_Request-Response_Proposal_v3">The server supports asynchronous transactions.</Description>
    </extension>
    
    
</DatasetServices>

Rationale for the solution

The solution provides DAP4 servers with an interface that allows for both server-driven and agent driven content negotiation as described in [section 12 of the HTTP 1.1 specification]. Providing the Dataset Services Response in XML allows many downstream applications to ingest the content and leaves open the option for server implementers to add XSLT references to the document so that clients like browsers can easily build a presentation view of the information.

Discussion

Here is one idea for the HTML version of the DSR; it could be generated by the server using XSLT on the XML or by the browser when the user explicitly requests the .xml variant of the response (by embedding a reference to the XSL transform in that response document):

ServiceDescriptionPrototype-01.png



Appendix: Dataset Services Response XML schema (Under Construction)

This schema works, but it rigidly enforces the order of the content. We may want to rewrite to be more lenient.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
    targetNamespace="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xml="http://www.w3.org/XML/1998/namespace"
    xmlns:dsr="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    xmlns="http://xml.opendap.org/ns/DAP/4.0/dataset-services#"
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified">
    
    <xs:import  namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
    <!--
	
    -->
    <xs:element name="DatasetServices" type="DatasetServicesType"/>
    <xs:element name="DapVersion" type="DapVersionType"/>
    <xs:element name="ServerSoftwareVersion" type="AnyContentType"/>
    <xs:element name="Service" type="ServiceType"/>
    <xs:element name="Description" type="DescriptionType"/>
    <xs:element name="link" type="linkType"/>
    <xs:element name="alt" type="altType"/>
    <xs:element name="function" type="ExtensionType"/>
    <xs:element name="functionGroup" type="ExtensionType"/>
    <xs:element name="extension" type="ExtensionType"/>
    <!--
	
    -->
    <xs:complexType name="DatasetServicesType"> 
        <xs:annotation>
            <xs:documentation>DatasetServices root element type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="DapVersion" minOccurs="1" maxOccurs="unbounded"/>
            <xs:element ref="ServerSoftwareVersion" minOccurs="1" maxOccurs="1"/>
            <xs:element ref="Description" minOccurs="0" maxOccurs="1"/>
            <xs:element ref="Service" minOccurs="3" maxOccurs="unbounded"/>
            <xs:element ref="function" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="functionGroup" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="extension" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute ref="xml:base"  use="required"/>
    </xs:complexType>
    <!--
	
     -->
    <xs:complexType name="ServiceType"> 
        <xs:annotation>
            <xs:documentation>DatasetServices Service type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="Description" minOccurs="0" maxOccurs="1"/>
            <xs:element ref="link" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="title" type="xs:string" use="optional"/>
        <xs:attribute name="role" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!--
        
    --> 
    <xs:simpleType name="DapVersionType">
        <xs:restriction base="xs:string">
            <xs:pattern value="\d{1,}.\d{1,}"></xs:pattern>
        </xs:restriction>
    </xs:simpleType>
    <!--
        
    -->
    <xs:complexType name="DescriptionType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="href" type="xs:anyURI"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="altType">
        <xs:attribute name="type" type="xs:string"/>
    </xs:complexType>
    <!--	
        
    -->
    <xs:complexType name="linkType"> 
        <xs:annotation>
            <xs:documentation>DatasetServices link type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="alt" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="href" type="xs:string" use="required"/>
        <xs:attribute name="type" type="xs:string" use="required"/>
        <xs:attribute name="description" type="xs:string" use="optional"/>         
    </xs:complexType>
    <!--
	
    -->
    <xs:complexType  name="AnyContentType" mixed="true">
        <xs:annotation>
            <xs:documentation>
                An element of this type may contain arbitrary XML or text content.
                The resulting content is may be ignored by DAP software. Other software
                might find the information useful. The XML elements must
                satisfy the requirements for 'lax' processing under schema 1.0.
                In practice, that means just about anything.
                ( <xs:any/>+ ) 
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:any namespace="##any" minOccurs="0" processContents="lax"/>
        </xs:sequence>
        <xs:anyAttribute processContents="lax" namespace="##any"/>
    </xs:complexType>   
    <!--
	
    -->
    <xs:complexType name="ExtensionType"> 
        <xs:annotation>
            <xs:documentation>Server Extension Type</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element ref="Description" minOccurs="1" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="role" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!--
	
     -->
    
</xs:schema>

fini

Contains cruft in comments...