RFC 5323

Web Distributed Authoring and Versioning (WebDAV) SEARCH

๐Ÿ“… published November 2008, from ietf

RFC 5323: Web Distributed Authoring and Versioning (WebDAV) SEARCH ๐Ÿฆ‹โœจ

Okay bestie, the title block first, because it's the ID card of this doc ๐Ÿชช๐Ÿ’–

  • Number and title: RFC 5323, "Web Distributed Authoring and Versioning (WebDAV) SEARCH"
  • Authors: J. Reschke (Ed.) from greenbytes, S. Reddy from Mitrix, J. Davis, and A. Babich from IBM
  • Category: Standards Track ๐ŸŽ€
  • Date: November 2008
  • Obsoletes and updates: the title block doesn't list any, so this doc doesn't obsolete or update anything ๐Ÿ™ˆ

Status of This Memo ๐Ÿ“ฎ

Okay so this is the official "here's what kind of doc this is" part ๐Ÿงš It's an Internet standards track protocol for the Internet community, and the authors are literally asking for discussion and suggestions for improvements ๐Ÿ’ฌ For the current standardization state and status, check the "Internet Official Protocol Standards" (STD 1) ๐Ÿ“š And distribution is unlimited, so share away ๐Ÿซถ

Copyright (c) 2008 IETF Trust and the people listed as document authors, all rights reserved ๐Ÿ’…

This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents, which you can find at http://trustee.ietf.org/license-info, as they were on the publication date ๐Ÿ“œ Please read these carefully, bestie, because they spell out your rights and restrictions for this doc ๐Ÿฅน

Abstract ๐ŸŒธ

So the whole point of this doc is to specify a bunch of methods, headers, and properties that make up WebDAV SEARCH ๐Ÿ” It's an application of HTTP/1.1 that lets you efficiently search for DAV resources using criteria the client supplies. Main character energy for search, honestly ๐Ÿ‘‘

Table of Contents ๐Ÿ—‚๏ธ

1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
  1.1.  DASL . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  1.2.  Relationship to DAV  . . . . . . . . . . . . . . . . . . .  4
  1.3.  Terms  . . . . . . . . . . . . . . . . . . . . . . . . . .  5
  1.4.  Notational Conventions . . . . . . . . . . . . . . . . . .  6
  1.5.  Note on Usage of 'DAV:' XML Namespace  . . . . . . . . . .  7
  1.6.  An Overview of DASL at Work  . . . . . . . . . . . . . . .  7
2.  The SEARCH Method  . . . . . . . . . . . . . . . . . . . . . .  7
  2.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2.2.  The Request  . . . . . . . . . . . . . . . . . . . . . . .  8
    2.2.1.  The Request-URI  . . . . . . . . . . . . . . . . . . .  8
    2.2.2.  The Request Body . . . . . . . . . . . . . . . . . . .  8
  2.3.  The Successful 207 (Multistatus) Response  . . . . . . . .  9
    2.3.1.  Result Set Truncation  . . . . . . . . . . . . . . . .  9
    2.3.2.  Extending the PROPFIND Response  . . . . . . . . . . . 10
    2.3.3.  Example: A Simple Request and Response . . . . . . . . 10
    2.3.4.  Example: Result Set Truncation . . . . . . . . . . . . 11
  2.4.  Unsuccessful Responses . . . . . . . . . . . . . . . . . . 12
    2.4.1.  Example of an Invalid Scope  . . . . . . . . . . . . . 12
3.  Discovery of Supported Query Grammars  . . . . . . . . . . . . 13
  3.1.  The OPTIONS Method . . . . . . . . . . . . . . . . . . . . 13
  3.2.  The DASL Response Header . . . . . . . . . . . . . . . . . 14
  3.3.  DAV:supported-query-grammar-set (Protected)  . . . . . . . 14
  3.4.  Example: Grammar Discovery . . . . . . . . . . . . . . . . 15
4.  Query Schema Discovery: QSD  . . . . . . . . . . . . . . . . . 17
  4.1.  Additional SEARCH Semantics  . . . . . . . . . . . . . . . 17
    4.1.1.  Example of Query Schema Discovery  . . . . . . . . . . 18
5.  The DAV:basicsearch Grammar  . . . . . . . . . . . . . . . . . 19
  5.1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . 19
  5.2.  The DAV:basicsearch DTD  . . . . . . . . . . . . . . . . . 20
    5.2.1.  Example Query  . . . . . . . . . . . . . . . . . . . . 22
  5.3.  DAV:select . . . . . . . . . . . . . . . . . . . . . . . . 23
  5.4.  DAV:from . . . . . . . . . . . . . . . . . . . . . . . . . 23
    5.4.1.  Relationship to the Request-URI  . . . . . . . . . . . 23
    5.4.2.  Scope  . . . . . . . . . . . . . . . . . . . . . . . . 24
  5.5.  DAV:where  . . . . . . . . . . . . . . . . . . . . . . . . 24
    5.5.1.  Use of Three-Valued Logic in Queries . . . . . . . . . 24
    5.5.2.  Handling Optional Operators  . . . . . . . . . . . . . 24
    5.5.3.  Treatment of NULL Values . . . . . . . . . . . . . . . 24
    5.5.4.  Treatment of Properties with Mixed/Element Content . . 25
    5.5.5.  Example: Testing for Equality  . . . . . . . . . . . . 25
    5.5.6.  Example: Relative Comparisons  . . . . . . . . . . . . 25
  5.6.  DAV:orderby  . . . . . . . . . . . . . . . . . . . . . . . 26
    5.6.1.  Example of Sorting . . . . . . . . . . . . . . . . . . 26
  5.7.  Boolean Operators: DAV:and, DAV:or, and DAV:not  . . . . . 26
  5.8.  DAV:eq . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  5.9.  DAV:lt, DAV:lte, DAV:gt, DAV:gte . . . . . . . . . . . . . 27
  5.10. DAV:literal  . . . . . . . . . . . . . . . . . . . . . . . 27
  5.11. DAV:typed-literal (Optional) . . . . . . . . . . . . . . . 28
    5.11.1. Example for Typed Numerical Comparison . . . . . . . . 28
  5.12. Support for Matching xml:lang Attributes on Properties . . 29
    5.12.1. DAV:language-defined (Optional)  . . . . . . . . . . . 29
    5.12.2. DAV:language-matches (Optional)  . . . . . . . . . . . 29
    5.12.3. Example of Language-Aware Matching . . . . . . . . . . 29
  5.13. DAV:is-collection  . . . . . . . . . . . . . . . . . . . . 30
    5.13.1. Example of DAV:is-collection . . . . . . . . . . . . . 30
  5.14. DAV:is-defined . . . . . . . . . . . . . . . . . . . . . . 30
  5.15. DAV:like . . . . . . . . . . . . . . . . . . . . . . . . . 30
    5.15.1. Syntax for the Literal Pattern . . . . . . . . . . . . 31
    5.15.2. Example of DAV:like  . . . . . . . . . . . . . . . . . 31
  5.16. DAV:contains . . . . . . . . . . . . . . . . . . . . . . . 31
    5.16.1. Result Scoring (DAV:score Element) . . . . . . . . . . 32
    5.16.2. Ordering by Score  . . . . . . . . . . . . . . . . . . 33
    5.16.3. Examples . . . . . . . . . . . . . . . . . . . . . . . 33
  5.17. Limiting the Result Set  . . . . . . . . . . . . . . . . . 33
    5.17.1. Relationship to Result Ordering  . . . . . . . . . . . 33
  5.18. The 'caseless' XML Attribute . . . . . . . . . . . . . . . 34
  5.19. Query Schema for DAV:basicsearch . . . . . . . . . . . . . 34
    5.19.1. DTD for DAV:basicsearch QSD  . . . . . . . . . . . . . 34
    5.19.2. DAV:propdesc Element . . . . . . . . . . . . . . . . . 35
    5.19.3. The DAV:datatype Property Description  . . . . . . . . 35
    5.19.4. The DAV:searchable Property Description  . . . . . . . 36
    5.19.5. The DAV:selectable Property Description  . . . . . . . 36
    5.19.6. The DAV:sortable Property Description  . . . . . . . . 36
    5.19.7. The DAV:caseless Property Description  . . . . . . . . 36
    5.19.8. The DAV:operators XML Element  . . . . . . . . . . . . 37
    5.19.9. Example of Query Schema for DAV:basicsearch  . . . . . 38
6.  Internationalization Considerations  . . . . . . . . . . . . . 39
7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 39
  7.1.  Implications of XML External Entities  . . . . . . . . . . 39
8.  Scalability  . . . . . . . . . . . . . . . . . . . . . . . . . 40
9.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 40
  9.1.  HTTP Headers . . . . . . . . . . . . . . . . . . . . . . . 40
    9.1.1.  DASL . . . . . . . . . . . . . . . . . . . . . . . . . 40
10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . . 41
11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 41
12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  12.1. Normative References . . . . . . . . . . . . . . . . . . . 41
  12.2. Informative References . . . . . . . . . . . . . . . . . . 42
Appendix A.  Three-Valued Logic in DAV:basicsearch . . . . . . . . 44
Appendix B.  Candidates for Future Protocol Extensions . . . . . . 45
  B.1.  Collation Support  . . . . . . . . . . . . . . . . . . . . 45
  B.2.  Count  . . . . . . . . . . . . . . . . . . . . . . . . . . 46
  B.3.  Diagnostics for Unsupported Queries  . . . . . . . . . . . 46
  B.4.  Language Matching  . . . . . . . . . . . . . . . . . . . . 46
  B.5.  Matching Media Types . . . . . . . . . . . . . . . . . . . 46
  B.6.  Query by Name  . . . . . . . . . . . . . . . . . . . . . . 46
  B.7.  Result Paging  . . . . . . . . . . . . . . . . . . . . . . 46
  B.8.  Search Scope Discovery . . . . . . . . . . . . . . . . . . 47
Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

1. Introduction โœจ

1.1. DASL ๐ŸŒˆ

Okay so this doc defines WebDAV SEARCH, which is an application of HTTP/1.1 that works as a lightweight search protocol ๐Ÿ”Ž It carries queries and result sets back and forth so clients can use the server's own search features. It's based on earlier work from the IETF DASL Working Group (see Section 10), and in this spec "WebDAV SEARCH" and "DASL" mean the exact same thing, so don't get confused when you see both ๐Ÿ’œ

DASL keeps clients simple on purpose, so that loads of apps can actually use the search stuff ๐Ÿงš

DASL is made up of:

  • the SEARCH method and the request/response formats defined for it (Section 2),
  • feature discovery through the "DASL" response header and the optional DAV:supported-grammar-set property (Section 3),
  • optional grammar schema discovery (Section 4), and
  • one mandatory grammar: DAV:basicsearch (Section 5).

1.2. Relationship to DAV ๐Ÿฆ‹

DASL is built on the resource and property model from [RFC4918] ๐Ÿซถ It doesn't change that model at all. What it does instead is let clients reach DAV-modeled resources through server-side search, which is honestly iconic ๐Ÿ’…

1.3. Terms

Okay so this doc borrows its terms from [RFC2616], [RFC4918], and [RFC3253], plus a few it defines right here ๐Ÿ’…

Criteria ๐ŸŽฏ An expression against which each resource in the search scope is evaluated.

Query ๐Ÿง  A query is a combination of a search scope, search criteria, result record definition, sort specification, and a search modifier.

Query Grammar ๐Ÿ“œ A set of definitions of XML elements, attributes, and constraints on their relations and values that defines a set of queries and the intended semantics.

Query Schema ๐Ÿ—‚๏ธ A listing, for any given grammar and scope, of the properties and operators that may be used in a query with that grammar and scope.

Result ๐ŸŽ A result is a result set, optionally augmented with other information describing the search as a whole.

Result Record ๐Ÿ“‡ A description of a resource. A result record is a set of properties, and possibly other descriptive information.

Result Record Definition ๐Ÿ–Š๏ธ A specification of the set of properties to be returned in the result record.

Result Set ๐Ÿ“ A set of records, one for each resource for which the search criteria evaluated to True.

Scope ๐Ÿ”ญ A set of resources to be searched.

Search Arbiter โš–๏ธ A resource that supports the SEARCH method.

Search Modifier ๐ŸŽ›๏ธ An instruction that governs the execution of the query but is not part of the search scope, result record definition, the search criteria, or the sort specification. An example of a search modifier is one that controls how much time the server can spend on the query before giving a response.

Sort Specification ๐Ÿช„ A specification of an ordering on the result records in the result set.

1.4. Notational Conventions

Here's how the notation works ๐Ÿค“ This spec uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234], unless explicitly stated otherwise.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

This document uses XML DTD fragments ([XML], Section 3.2) as a purely notational convention. WebDAV request and response bodies cannot be validated by a DTD due to the specific extensibility rules defined in Section 17 of [RFC4918] and due to the fact that all XML elements defined by this specification use the XML namespace name "DAV:". In particular:

  1. element names use the "DAV:" namespace,
  2. element ordering is irrelevant unless explicitly stated,
  3. extension elements (elements not already defined as valid child elements) may be added anywhere, except when explicitly stated otherwise,
  4. extension attributes (attributes not already defined as valid for this element) may be added anywhere, except when explicitly stated otherwise.

When an XML element type in the "DAV:" namespace is referenced in this document outside of the context of an XML fragment, the string DAV: will be prefixed to the element type.

Similarly, when an XML element type in the namespace "http://www.w3.org/2001/XMLSchema" is referenced in this document outside of the context of an XML fragment, the string xs: will be prefixed to the element type.

This document inherits, and sometimes extends, DTD productions from Section 14 of [RFC4918].

1.5. Note on Usage of 'DAV:' XML Namespace

This spec defines elements, properties, and condition names in the XML namespace "DAV:". Usually only specs written by IETF working groups do this, but here's the tea โ˜• An exception was made, because WebDAV SEARCH started its life in the IETF DASL working group (<http://www.webdav.org/dasl/>), and at the time the working group closed down there was already significant deployment of this specification. ๐Ÿซถ

1.6. An Overview of DASL at Work

Here's the basic DASL flow in a few steps โœจ

  • The client constructs a query using the DAV:basicsearch grammar.
  • The client invokes the SEARCH method on a resource that will perform the search (the search arbiter) and includes a text/xml or application/xml request entity that contains the query.
  • The search arbiter performs the query.
  • The search arbiter sends the results of the query back to the client in the response. The server MUST send an entity that matches the WebDAV multistatus format ([RFC4918], Section 13).

2. The SEARCH Method ๐Ÿ”Ž

2.1. Overview

The client invokes the SEARCH method to initiate a server-side search. The body of the request defines the query. The server MUST emit an entity matching the WebDAV multistatus format ([RFC4918], Section 13).

The SEARCH method plays the role of transport mechanism for the query and the result set. It does not define the semantics of the query. The type of the query defines the semantics. ๐Ÿšš

SEARCH is a safe method; it does not have any significance other than executing a query and returning a query result (see [RFC2616], Section 9.1.1). ๐Ÿ›ก๏ธ

2.2. The Request

The client invokes the SEARCH method on the resource named by the Request-URI. ๐Ÿ“ฎ

2.2.1. The Request-URI

The Request-URI identifies the search arbiter. Any HTTP resource may function as search arbiter. It is not a new type of resource (in the sense of DAV:resourcetype as defined in [RFC4918], Section 15.9), nor does it have to be a WebDAV-compliant resource. ๐Ÿฆ‹

The SEARCH method defines no relationship between the arbiter and the scope of the search; rather, the particular query grammar used in the query defines the relationship. For example, a query grammar may force the Request-URI to correspond exactly to the search scope.

2.2.2. The Request Body

The server MUST process a text/xml or application/xml request body, and MAY process request bodies in other formats. See [RFC3023] for guidance on packaging XML in requests. ๐Ÿ“ฆ

Marshalling:

If a request body with content type text/xml or application/xml is included, it MUST be either a DAV:searchrequest or a DAV:query-schema-discovery XML element. Its single child element identifies the query grammar.

For DAV:searchrequest, the definition of search criteria, the result record, and any other details needed to perform the search depend on the individual search grammar.

For DAV:query-schema-discovery, the semantics is defined in Section 4.

Preconditions:

(DAV:search-grammar-discovery-supported): when an XML request body is present and has a DAV:query-schema-discovery document element, the server MUST support the query schema discovery mechanism described in Section 4.

(DAV:search-grammar-supported): when an XML request body is present, the search grammar identified by the document element's child element must be a supported search grammar.

(DAV:search-multiple-scope-supported): if the SEARCH request specified multiple scopes, the server MUST support this optional feature.

(DAV:search-scope-valid): the supplied search scope must be valid. There can be various reasons for a search scope to be invalid, including unsupported URI schemes and communication problems. Servers MAY add [RFC4918] compliant DAV:response elements as content to the condition element indicating the precise reason for the failure. ๐Ÿšจ

2.3. The Successful 207 (Multistatus) Response

If the server returns 207 (Multistatus), then the search proceeded successfully, and the response MUST use the WebDAV multistatus format ([RFC4918], Section 13). The results of this method SHOULD NOT be cached. ๐Ÿ™…โ€โ™€๏ธ

There MUST be one DAV:response for each resource that matched the search criteria. For each such response, the DAV:href element contains the URI of the resource, and the response MUST include a DAV:propstat element.

Note: the WebDAV multistatus format requires at least one DAV:response child element. This specification relaxes that restriction so that empty results can be represented. ๐Ÿซ™

Note that for each matching resource found, there may be multiple URIs within the search scope mapped to it. In this case, a server SHOULD report only one of these URIs. Clients can use the live property DAV:resource-id, defined in Section 3.1 of [WEBDAV-BIND] to identify possible duplicates. ๐Ÿ”

2.3.1. Result Set Truncation

A server MAY limit the number of resources in a reply, for example, to limit the amount of resources expended in processing a query. If it does so, the reply MUST use status code 207, return a DAV:multistatus response body, and indicate a status of 507 (Insufficient Storage) for the search arbiter URI. It SHOULD include the partial results. ๐Ÿงƒ

When a result set is truncated, there may be many more resources that satisfy the search criteria but that were not examined. ๐Ÿ‘€

If partial results are included and the client requested an ordered result set in the original request, then any partial results that are returned MUST be ordered as the client directed. ๐Ÿ“‹

Note that the partial results returned MAY be any subset of the result set that would have satisfied the original query. ๐Ÿงฉ

2.3.2. Extending the PROPFIND Response

A response MAY include more information than PROPFIND defines, so long as the extra information does not invalidate the PROPFIND response. Query grammars SHOULD define how the response matches the PROPFIND response. ๐ŸŽ€

2.3.3. Example: A Simple Request and Response

This example shows off the request and response framework ๐Ÿ’– The following XML document shows a simple (hypothetical) natural language query. The name of the query element is natural-language-query in the XML namespace "http://example.com/foo". The actual query is "Find the locations of good Thai restaurants in Los Angeles". For this hypothetical query, the arbiter returns two properties for each selected resource. ๐Ÿœ

>> Request:

SEARCH / HTTP/1.1
Host: example.org
Content-Type: application/xml; charset="utf-8"
Content-Length: 252

<?xml version="1.0" encoding="UTF-8"?>
<D:searchrequest xmlns:D="DAV:" xmlns:F="http://example.com/foo">
  <F:natural-language-query>
    Find the locations of good Thai restaurants in Los Angeles
  </F:natural-language-query>
</D:searchrequest>
>> Response:

HTTP/1.1 207 Multi-Status
Content-Type: text/xml; charset="utf-8"
Content-Length: 429

<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:"
   xmlns:R="http://example.org/propschema">
  <D:response>
    <D:href>http://siamiam.example/</D:href>
    <D:propstat>
      <D:prop>
        <R:location>259 W. Hollywood</R:location>
        <R:rating><R:stars>4</R:stars></R:rating>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>

2.3.4. Example: Result Set Truncation โœจ

Okay so in this example the server only gives back two results ๐Ÿ˜ญ and then it adds a DAV:response element for the search arbiter resource with a 507 (Insufficient Storage) status to say "hey, the list got cut off" ๐Ÿ’… Iconic honesty.

Request:
SEARCH / HTTP/1.1
Host: example.net
Content-Type: text/xml; charset="utf-8"
Content-Length: xxx

 ... the query goes here ...
Response:
HTTP/1.1 207 Multistatus
Content-Type: text/xml; charset="utf-8"
Content-Length: 640

<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
  <D:response>
    <D:href>http://www.example.net/sounds/unbrokenchain.au</D:href>
    <D:status>HTTP/1.1 200 OK</D:status>
  </D:response>
  <D:response>
    <D:href>http://tech.mit.example/arch96/photos/Lesh1.jpg</D:href>
    <D:status>HTTP/1.1 200 OK</D:status>
  </D:response>
  <D:response>
    <D:href>http://example.net</D:href>
    <D:status>HTTP/1.1 507 Insufficient Storage</D:status>
    <D:responsedescription xml:lang="en">
       Only first two matching records were returned
    </D:responsedescription>
  </D:response>
</D:multistatus>

2.4. Unsuccessful Responses ๐Ÿ™ˆ

Okay, real talk: if a SEARCH request can't get executed, or the attempt to run it throws an error, the server MUST flag the failure with an appropriate status code. It SHOULD also add a response body as defined in Section 1.6 of [RFC3253] ๐Ÿซถ Unless otherwise stated, condition elements are empty, but specific condition elements MAY include extra child elements that spell out the error in more detail.

2.4.1. Example of an Invalid Scope

In this one, the request fails because the scope points to an HTTP resource that doesn't exist. Rude, but make it make sense ๐Ÿ’€

Response:
HTTP/1.1 409 Conflict
Content-Type: text/xml; charset="utf-8"
Content-Length: 275

<?xml version="1.0" encoding="UTF-8"?>
<d:error xmlns:d="DAV:">
  <d:search-scope-valid>
    <d:response>
      <d:href>http://www.example.com/X</d:href>
      <d:status>HTTP/1.1 404 Object Not Found</d:status>
    </d:response>
  </d:search-scope-valid>
</d:error>

3. Discovery of Supported Query Grammars ๐Ÿ”

Servers MUST support discovery of the query grammars supported by a search arbiter resource. This is the main thing, bestie ๐Ÿ‘‘

Clients can figure out which query grammars an arbiter supports by invoking OPTIONS on the search arbiter. If the resource supports SEARCH, the DASL response header will show up in the response, and that header lists the supported grammars ๐Ÿฆ‹

Servers supporting the WebDAV extensions [RFC3253] and/or [RFC3744] MUST also:

  • report SEARCH in the live property DAV:supported-method-set for all search arbiter resources, and
  • support the live property DAV:supported-query-grammar-set as defined in Section 3.3.

3.1. The OPTIONS Method

The OPTIONS method lets the client find out if a resource supports the SEARCH method, and also see the list of search grammars supported for that resource โœจ

The client issues the OPTIONS method against a resource named by the Request-URI. This is a normal invocation of OPTIONS as defined in Section 9.2 of [RFC2616].

If a resource supports the SEARCH method, the server MUST list SEARCH in the Allow header defined in Section 14.7 of [RFC2616] ๐ŸŒธ

DASL servers MUST include the DASL header in the OPTIONS response. This header identifies the search grammars supported by that resource.

3.2. The DASL Response Header ๐Ÿ’œ

DASLHeader = "DASL" ":" 1#Coded-URL
Coded-URL  = <defined in Section 10.1 of [RFC4918]>

(This grammar uses the augmented BNF format defined in Section 2.1 of [RFC2616].)

The DASL response header shows server support for query grammars in the OPTIONS method. The value is a list of URIs that indicate the types of supported grammars. Lowkey important: even though the URIs can identify each supported search grammar, there isn't necessarily a direct relationship between the URI and the XML element name you'd use in XML-based SEARCH requests. The element name is identified by its namespace name (a URI reference) and the element's local name, so they're two different things ๐Ÿงš

Note: this header field value is defined as a comma-separated list ([RFC2616], Section 4.2); thus, grammar URIs can appear in multiple header instances, separated by commas, or both.

For example:

DASL: <http://foobar.example/syntax1>,
      <http://akuma.example/syntax2>, <DAV:basicsearch>
DASL: <http://example.com/foo/natural-language-query>

3.3. DAV:supported-query-grammar-set (Protected) ๐ŸŽ€

This WebDAV property is required for any server supporting either [RFC3253] and/or [RFC3744]. It identifies the XML-based query grammars supported by the search arbiter resource.

<!ELEMENT supported-query-grammar-set (supported-query-grammar*)>
<!ELEMENT supported-query-grammar (grammar)>
<!ELEMENT grammar ANY>
<!-- ANY value: a query grammar element type -->

3.4. Example: Grammar Discovery ๐Ÿ“

This example shows that the server supports search on the /somefolder resource with the query grammars: DAV:basicsearch, http://foobar.example/syntax1 and http://akuma.example/syntax2. Note that servers supporting WebDAV SEARCH MUST support DAV:basicsearch. Non-negotiable, periodt ๐Ÿ’…

Request:
OPTIONS /somefolder HTTP/1.1
Host: example.org
Response:
HTTP/1.1 200 OK
Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE
Allow: MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH
DASL: <DAV:basicsearch>
DASL: <http://foobar.example/syntax1>, <http://akuma.example/syntax2>

This example shows the equivalent, taking advantage of a server's support for DAV:supported-method-set and DAV:supported-query-grammar-set โœจ

Request:
PROPFIND /somefolder HTTP/1.1
Host: example.org
Depth: 0
Content-Type: text/xml; charset="utf-8"
Content-Length: 165

<?xml version="1.0" encoding="UTF-8" ?>
<propfind xmlns="DAV:">
  <prop>
    <supported-query-grammar-set/>
    <supported-method-set/>
  </prop>
</propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml; charset="utf-8"
Content-Length: 1349

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:">
 <response>
  <href>http://example.org/somefolder</href>
  <propstat>
   <prop>
    <supported-query-grammar-set>
     <supported-query-grammar>
      <grammar><basicsearch/></grammar>
     </supported-query-grammar>
     <supported-query-grammar>
      <grammar><syntax1 xmlns="http://foobar.example/"/></grammar>
     </supported-query-grammar>
     <supported-query-grammar>
      <grammar><syntax2 xmlns="http://akuma.example/"/></grammar>
     </supported-query-grammar>
    </supported-query-grammar-set>
    <supported-method-set>
     <supported-method name="COPY" />
     <supported-method name="DELETE" />
     <supported-method name="GET" />
     <supported-method name="HEAD" />
     <supported-method name="LOCK" />
     <supported-method name="MKCOL" />
     <supported-method name="MOVE" />
     <supported-method name="OPTIONS" />
     <supported-method name="POST" />
     <supported-method name="PROPFIND" />
     <supported-method name="PROPPATCH" />
     <supported-method name="PUT" />
     <supported-method name="SEARCH" />
     <supported-method name="TRACE" />
     <supported-method name="UNLOCK" />
    </supported-method-set>
   </prop>
   <status>HTTP/1.1 200 OK</status>
  </propstat>
 </response>
</multistatus>

Note that the query grammar element names marshalled as part of the DAV:supported-query-grammar-set can be used directly as element names in an XML-based query. Main character energy ๐Ÿ‘‘


4. Query Schema Discovery: QSD ๐Ÿง 

Servers MAY support the discovery of the schema for a query grammar.

The DASL response header and the DAV:supported-query-grammar-set property give clients a way to discover the set of query grammars supported by a resource. But that alone isn't enough for a client to generate a query ๐Ÿ˜ญ For example, the DAV:basicsearch grammar defines a set of queries made of operators applied to properties and values, but the grammar itself doesn't say which properties you're allowed to use. QSD for the DAV:basicsearch grammar lets a client discover the set of properties that are searchable, selectable, and sortable. Also, even though DAV:basicsearch defines a minimal set of operators, a resource might support extra ones. For example, a resource might have an optional operator for content-based queries in a proprietary syntax. QSD lets a client discover these operators and their syntax. The set of discoverable things will differ from grammar to grammar, but each grammar can define a way for a client to discover what can be discovered ๐Ÿฆ‹

In general, the schema for a given query grammar depends on both the resource (the arbiter) and the scope. One resource might have access to one set of properties for one scope, and a different set for another scope. For example, picture a server that can search two separate collections: one with cooking recipes, and one with design documents for nuclear weapons. Both collections might support properties like author, title, and date, but the first might also define properties like calories and preparation time, while the second defines properties like yield and applicable patents ๐Ÿ™ˆ Two distinct arbiters indexing the same collection might also have access to different properties. For example, the recipe collection above might also be indexed by a value-added server that also stores the names of chefs who tested each recipe. Also, the available query schema might depend on other factors, like the identity of the principal conducting the search, but those factors aren't exposed in this protocol.

4.1. Additional SEARCH Semantics

Each query grammar supported by DASL defines its own syntax for expressing the possible query schema. A client retrieves the schema for a given query grammar on an arbiter resource with a given scope by invoking the SEARCH method on that arbiter with that grammar and scope. The root element is DAV:query-schema-discovery rather than DAV:searchrequest ๐Ÿ”ฅ

Marshalling:

The request body MUST be a DAV:query-schema-discovery element.

<!ELEMENT query-schema-discovery ANY>
<!-- ANY value: XML element specifying the query grammar
                and the scope -->

The response body takes the form of a DAV:multistatus element ([RFC4918], Section 13), where DAV:response is extended to hold the returned query grammar inside a DAV:query-schema container element.

<!ELEMENT response (href, status, query-schema?,
  responsedescription?) >
<!ELEMENT query-schema ANY>

The content of this container is an XML element whose name and syntax depend on the grammar, and whose value may (and likely will) vary depending on the grammar, arbiter, and scope. It's giving "it depends," and honestly that's the whole point ๐Ÿ’–

4.1.1. Example of Query Schema Discovery โœจ

okay bestie, this example is giving full walkthrough ๐Ÿ’– The arbiter is recipes.example, the grammar is DAV:basicsearch, and the scope is also recipes.example ๐Ÿ“

>> Request:

SEARCH / HTTP/1.1
Host: recipes.example
Content-Type: application/xml; charset="utf-8"
Content-Length: 258

<?xml version="1.0"?>
<query-schema-discovery xmlns="DAV:">
  <basicsearch>
    <from>
      <scope>
        <href>http://recipes.example</href>
        <depth>infinity</depth>
      </scope>
    </from>
  </basicsearch>
</query-schema-discovery>

>> Response:

HTTP/1.1 207 Multistatus
Content-Type: application/xml; charset="utf-8"
Content-Length: xxx

<?xml version="1.0"?>
<multistatus xmlns="DAV:">
  <response>
    <href>http://recipes.example</href>
    <status>HTTP/1.1 200 OK</status>
    <query-schema>
      <basicsearchschema>
        <!-- (See Section 5.19 for
        the actual contents) -->
      </basicsearchschema>
    </query-schema>
  </response>
</multistatus>

The query schema for DAV:basicsearch is defined in Section 5.19. ๐Ÿฆ‹

5. The DAV:basicsearch Grammar ๐Ÿ’…

5.1. Introduction

okay so DAV:basicsearch uses an extensible XML syntax that lets clients express search requests that are generally useful for WebDAV scenarios ๐ŸŒธ DASL-extended servers MUST accept this grammar, and they MAY accept other grammars too.

DAV:basicsearch has several components:

  • DAV:select provides the result record definition.
  • DAV:from defines the scope.
  • DAV:where defines the criteria.
  • DAV:orderby defines the sort order of the result set.
  • DAV:limit provides constraints on the query as a whole.

5.2. The DAV:basicsearch DTD ๐Ÿงš

<!-- "basicsearch" element -->

<!ELEMENT basicsearch   (select, from, where?, orderby?, limit?) >

<!-- "select" element -->

<!ELEMENT select        (allprop | prop) >

<!-- "from" element -->

<!ELEMENT from          (scope+) >
<!ELEMENT scope         (href, depth, include-versions?) >
<!ELEMENT include-versions EMPTY >

<!-- "where" element -->
<!ENTITY % comp_ops     "eq | lt | gt| lte | gte">
<!ENTITY % log_ops      "and | or | not">
<!ENTITY % special_ops  "is-collection | is-defined |
                         language-defined | language-matches">
<!ENTITY % string_ops   "like">
<!ENTITY % content_ops  "contains">

<!ENTITY % all_ops      "%comp_ops; | %log_ops; | %special_ops; |
                         %string_ops; | %content_ops;">

<!ELEMENT where         ( %all_ops; ) >

<!ELEMENT and           ( %all_ops; )+ >

<!ELEMENT or            ( %all_ops; )+ >

<!ELEMENT not           ( %all_ops; ) >

<!ELEMENT lt            (prop, (literal|typed-literal)) >
<!ATTLIST lt            caseless   (yes|no) #IMPLIED>

<!ELEMENT lte           (prop, (literal|typed-literal)) >
<!ATTLIST lte           caseless   (yes|no) #IMPLIED>

<!ELEMENT gt            (prop, (literal|typed-literal)) >
<!ATTLIST gt            caseless   (yes|no) #IMPLIED>

<!ELEMENT gte           (prop, (literal|typed-literal)) >
<!ATTLIST gte           caseless   (yes|no) #IMPLIED>

<!ELEMENT eq            (prop, (literal|typed-literal)) >
<!ATTLIST eq            caseless   (yes|no) #IMPLIED>

<!ELEMENT literal       (#PCDATA)>
<!ELEMENT typed-literal (#PCDATA)>
<!ATTLIST typed-literal xsi:type CDATA #IMPLIED>

<!ELEMENT is-collection EMPTY >
<!ELEMENT is-defined    (prop) >

<!ELEMENT language-defined    (prop) >
<!ELEMENT language-matches    (prop, literal) >

<!ELEMENT like          (prop, literal) >
<!ATTLIST like          caseless   (yes|no) #IMPLIED>

<!ELEMENT contains      (#PCDATA)>
<!-- "orderby" element -->

<!ELEMENT orderby       (order+) >
<!ELEMENT order         ((prop | score), (ascending | descending)?)>
<!ATTLIST order         caseless   (yes|no) #IMPLIED>
<!ELEMENT ascending     EMPTY>
<!ELEMENT descending    EMPTY>

<!-- "limit" element -->

<!ELEMENT limit         (nresults) >
<!ELEMENT nresults      (#PCDATA) >

5.2.1. Example Query ๐ŸŽ€

this query grabs the content length values for all resources under the server's "/container1/" URI namespace whose length is over 10000, sorted ascending by size ๐Ÿ“

<d:searchrequest xmlns:d="DAV:">
  <d:basicsearch>
    <d:select>
      <d:prop><d:getcontentlength/></d:prop>
    </d:select>
    <d:from>
      <d:scope>
        <d:href>/container1/</d:href>
        <d:depth>infinity</d:depth>
      </d:scope>
    </d:from>
    <d:where>
      <d:gt>
        <d:prop><d:getcontentlength/></d:prop>
        <d:literal>10000</d:literal>
      </d:gt>
    </d:where>
    <d:orderby>
      <d:order>
        <d:prop><d:getcontentlength/></d:prop>
        <d:ascending/>
      </d:order>
    </d:orderby>
  </d:basicsearch>
</d:searchrequest>

5.3. DAV:select ๐ŸŒˆ

DAV:select defines the result record, which is a set of properties and values ๐Ÿ’œ This document defines two possible values: DAV:allprop and DAV:prop, both defined in Section 14 of [RFC4918].

5.4. DAV:from ๐Ÿฆ‹

<!ELEMENT scope            (href, depth, include-versions?) >
<!ELEMENT include-versions EMPTY >

DAV:from defines the query scope. This contains one or more DAV:scope elements. Support for multiple scope elements is optional, however servers MUST fail a request specifying multiple DAV:scope elements if they can't support it (see Section 2.2.2, precondition DAV:search-multiple-scope-supported). The scope element contains mandatory DAV:href and DAV:depth elements. ๐Ÿซถ

DAV:href indicates the URI reference ([RFC3986], Section 4.1) to use as a scope.

When the scope is a collection, if DAV:depth is "0", the search includes only the collection. When it is "1", the search includes the collection and its immediate children. When it is "infinity", it includes the collection and all its progeny. ๐ŸŒณ

When the scope is not a collection, the depth is ignored and the search applies just to the resource itself.

If the server supports WebDAV Redirect Reference Resources ([RFC4437]) and the search scope contains a redirect reference resource, then it applies only to that resource, not to its target. ๐Ÿ”€

When the child element DAV:include-versions is present, the search scope will include all versions (see [RFC3253], Section 2.2.1) of all version-controlled resources in scope. Servers that do support versioning but do not support the DAV:include-versions feature MUST signal an error if it is used in a query (see Section 2.2.2, precondition DAV:search-scope-valid). ๐Ÿšจ

5.4.1. Relationship to the Request-URI ๐Ÿ”—

If the DAV:scope element is a URI ([RFC3986], Section 3), the scope is exactly that URI.

If the DAV:scope element is a relative reference ([RFC3986], Section 4.2), the scope is taken to be relative to the Request-URI.

5.4.2. Scope ๐ŸŒ

A Scope can be an arbitrary URI reference.

Servers, of course, may support only particular scopes. This may include limitations for particular schemes such as "http:" or "ftp:" or certain URI namespaces. However, WebDAV-compliant search arbiters minimally SHOULD support scopes that match their own URI. ๐Ÿงญ

5.5. DAV:where ๐Ÿ’–

The DAV:where element defines the search condition for inclusion of resources in the result set. The value of this element is an XML element that defines a search operator that evaluates to one of the Boolean truth values TRUE, FALSE, or UNKNOWN. The search operator contained by DAV:where may itself contain and evaluate additional search operators as operands, which in turn may contain and evaluate additional search operators as operands, etc., recursively. ๐Ÿช†

5.5.1. Use of Three-Valued Logic in Queries ๐Ÿง 

Each operator defined for use in the where clause that returns a Boolean value MUST evaluate to TRUE, FALSE, or UNKNOWN. The resource under scan is included as a member of the result set if and only if the search condition evaluates to TRUE. โœ…

Consult Appendix A for details on the application of three-valued logic in query expressions.

5.5.2. Handling Optional Operators ๐Ÿ™ˆ

If a query contains an operator that is not supported by the server, then the server MUST respond with a 422 (Unprocessable Entity) status code. ๐Ÿ’€

5.5.3. Treatment of NULL Values ๐Ÿซฅ

If a PROPFIND for a property value would yield a non-2xx (see Section 10.2 of [RFC2616]) response for that property, then that property is considered NULL.

NULL values are "less than" all other values in comparisons.

Empty strings (zero length strings) are not NULL values. An empty string is "less than" a string with length greater than zero.

The DAV:is-defined operator is defined to test if the value of a property is not NULL. ๐Ÿ”

5.5.4. Treatment of Properties with Mixed/Element Content ๐Ÿงฉ

Comparisons of properties that do not have simple types (text-only content) is out of scope for the standard operators defined for DAV:basicsearch and therefore is defined to be UNKNOWN (as per Appendix A). For querying the DAV:resourcetype property, see Section 5.13.

5.5.5. Example: Testing for Equality ๐Ÿ’

The example shows a single operator (DAV:eq) applied in the criteria.

<d:where xmlns:d='DAV:'>
  <d:eq>
    <d:prop>
      <d:getcontentlength/>
    </d:prop>
    <d:literal>100</d:literal>
  </d:eq>
</d:where>

5.5.6. Example: Relative Comparisons ๐Ÿ–ผ๏ธ

The example shows a more complex operation involving several operators (DAV:and, DAV:eq, DAV:gt) applied in the criteria. This DAV:where expression matches those resources of type "image/gif" over 4K in size. ๐Ÿ“ธ

<D:where xmlns:D='DAV:'>
  <D:and>
    <D:eq>
      <D:prop>
        <D:getcontenttype/>
      </D:prop>
      <D:literal>image/gif</D:literal>
    </D:eq>
    <D:gt>
      <D:prop>
        <D:getcontentlength/>
      </D:prop>
      <D:literal>4096</D:literal>
    </D:gt>
  </D:and>
</D:where>

5.6. DAV:orderby ๐Ÿ‘‘

The DAV:orderby element specifies the ordering of the result set. It contains one or more DAV:order elements, each of which specifies a comparison between two items in the result set. Informally, a comparison specifies a test that determines whether one resource appears before another in the result set. Comparisons are applied in the order they occur in the DAV:orderby element, earlier comparisons being more significant. ๐Ÿ“‹

The comparisons defined here use only a single property from each resource, compared using the same ordering as the DAV:lt operator (ascending) or DAV:gt operator (descending). If neither direction is specified, the default is DAV:ascending. โฌ†๏ธ

In the context of the DAV:orderby element, null values are considered to collate before any actual (i.e., non-null) value, including strings of zero length (this is compatible with [SQL99]). ๐Ÿค“

The "caseless" attribute may be used to indicate case-sensitivity for comparisons (Section 5.18). ๐Ÿ”ค

5.6.1. Example of Sorting โญ

This sort orders first by last name of the author and then by size, in descending order, so that for each author, the largest works appear first. ๐Ÿ“š

<d:orderby xmlns:d='DAV:' xmlns:r='http://example.com/ns'>
  <d:order>
    <d:prop><r:lastname/></d:prop>
    <d:ascending/>
  </d:order>
  <d:order>
    <d:prop><d:getcontentlength/></d:prop>
    <d:descending/>
  </d:order>
</d:orderby>

5.7. Boolean Operators: DAV:and, DAV:or, and DAV:not ๐Ÿ’…

okay so DAV:and does a logical AND on the expressions it contains ๐Ÿ’– DAV:or does a logical OR on the values it contains โœจ and DAV:not does a logical NOT on the values it contains ๐Ÿ™ˆ

5.8. DAV:eq ๐ŸŽ€

DAV:eq is the simple equality matcher for property values ๐Ÿ’œ You can use the caseless attribute with this element (Section 5.18) ๐Ÿฆ‹

5.9. DAV:lt, DAV:lte, DAV:gt, DAV:gte ๐ŸŒˆ

These four are the comparison crew ๐Ÿ‘‘ DAV:lt is less-than, DAV:lte is less-than or equal, DAV:gt is greater-than, and DAV:gte is greater-than or equal, all on property values ๐Ÿ’… The caseless attribute works on these too (Section 5.18) โœจ

5.10. DAV:literal ๐Ÿ“

DAV:literal lets you drop literal values straight into an expression ๐Ÿงš

Whitespace inside literal values matters in comparisons ๐Ÿ‘€ For consistency with [RFC4918], clients SHOULD NOT specify the attribute xml:space (Section 2.10 of [XML]) to override this behavior ๐Ÿ™…โ€โ™€๏ธ

In comparisons, the contents of DAV:literal SHOULD be treated as a string, with a few exceptions ๐Ÿซถ

  • When it's the operand for a comparison with a DAV:getcontentlength property, it SHOULD be treated as an unsigned integer value (the behavior for values not in this format is undefined) ๐Ÿ”ข
  • When it's the operand for a comparison with a DAV:creationdate or DAV:getlastmodified property, it SHOULD be treated as a date value in the ISO-8601 subset defined for the DAV:creationdate property (see Section 15.1 of [RFC4918]; the behavior of values not in this format is undefined) ๐Ÿ“…
  • When it's the operand for a comparison with a property whose type is known, and when it's compatible with that type, it MAY be treated according to this type ๐Ÿง 

5.11. DAV:typed-literal (Optional) ๐Ÿ”ฅ

Sometimes a client really wants a comparison that is not string-based (the default for DAV:literal) ๐Ÿ˜ค That's when you reach for DAV:typed-literal instead, which forces a typed comparison ๐Ÿ’ช

<!ELEMENT typed-literal (#PCDATA)>

The data type is set with the xsi:type attribute defined in Section 2.6.1 of [XS1] ๐Ÿท๏ธ If you don't specify a type, it defaults to xs:string ๐Ÿคทโ€โ™€๏ธ

A server MUST reject a request using an unknown type with a status of 422 (Unprocessable Entity) ๐Ÿšซ It SHOULD reject a request if the value provided in DAV:typed-literal can't be cast to the specified type ๐Ÿ™ƒ

The comparison evaluates to UNKNOWN if the property value can't be cast to the specified datatype (see [XPATHFUNC], Section 17) ๐ŸŒซ๏ธ

5.11.1. Example for Typed Numerical Comparison ๐Ÿ“Š

Picture a set of resources with the dead property "edits" in the namespace "http://ns.example.org" ๐Ÿ—‚๏ธ

                     +-----+----------------+
                     | URI | property value |
                     +-----+----------------+
                     | /a  | "-1"           |
                     | /b  | "01"           |
                     | /c  | "3"            |
                     | /d  | "test"         |
                     | /e  | (undefined)    |
                     +-----+----------------+

The expression

<lt xmlns="DAV:"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <prop><edits xmlns="http://ns.example.org"/></prop>
  <typed-literal xsi:type="xs:integer">3</typed-literal>
</lt>

is going to evaluate to TRUE for "/a" and "/b" (their property values can be parsed as type xs:integer, and the numerical comparison comes out true) โœ… It's FALSE for "/c" (the value is compatible, but the numerical comparison is false) โŒ and UNKNOWN for "/d" and "/e" (the property is either undefined, or its value can't be parsed as xs:integer) โ“

5.12. Support for Matching xml:lang Attributes on Properties ๐ŸŒธ

These two optional operators let you write conditions about the language of a property value (as expressed with the xml:lang attribute) ๐Ÿ—ฃ๏ธ

5.12.1. DAV:language-defined (Optional) ๐ŸŒ

<!ELEMENT language-defined (prop)>

This operator evaluates to TRUE if the language for the value of the given property is known, FALSE if it isn't, and UNKNOWN if the property itself isn't defined ๐Ÿซง

5.12.2. DAV:language-matches (Optional) ๐Ÿ—บ๏ธ

<!ELEMENT language-matches (prop, literal)>

This operator evaluates to TRUE if the language for the value of the given property is known and matches the language name given in the <literal> element, FALSE if it doesn't match, and UNKNOWN if the property itself isn't defined ๐Ÿ’ซ

Languages are considered to match if they're the same, or if the language of the property value is a sublanguage of the language specified in the <literal> element (see Section 4.3 of [XPATH], "lang function") ๐Ÿ“š

5.12.3. Example of Language-Aware Matching ๐Ÿ‡ฌ๐Ÿ‡ง

This expression evaluates to TRUE if the property "foobar" exists and its language is either unknown, English, or a sublanguage of English ๐ŸŽ‰

<or xmlns="DAV:">
  <not>
    <language-defined>
      <prop><foobar/></prop>
    </language-defined>
  </not>
  <language-matches>
    <prop><foobar/></prop>
    <literal>en</literal>
  </language-matches>
</or>

5.13. DAV:is-collection ๐Ÿ“

DAV:is-collection lets clients check whether a resource is a collection (meaning its DAV:resourcetype element contains the element DAV:collection) ๐Ÿ—ƒ๏ธ

Rationale: This operator is provided in lieu of defining generic structure queries. Those would cover this and a lot more powerful queries, but they seem inappropriate to standardize at this time ๐Ÿค“

5.13.1. Example of DAV:is-collection ๐Ÿ—‚๏ธ

This example is a search criterion that picks out all, and only, the resources in the scope that are collections ๐ŸŽฏ

<where xmlns="DAV:">
  <is-collection/>
</where>

5.14. DAV:is-defined ๐Ÿ”

DAV:is-defined lets clients check whether a property is defined on a resource ๐Ÿ’โ€โ™€๏ธ The meaning of "defined on a resource" is in Section 5.5.3 ๐Ÿ“–

Example:

<d:is-defined xmlns:d='DAV:' xmlns:x='http://example.com/ns'>
  <d:prop><x:someprop/></d:prop>
</d:is-defined>

5.15. DAV:like ๐ŸŒŸ

DAV:like is an optional operator that gives clients simple wildcard-based pattern matching ๐Ÿช„

It takes two arguments ๐Ÿ‘ฏโ€โ™€๏ธ The first is a DAV:prop element identifying a single property to evaluate ๐ŸŽฏ The second is a DAV:literal element that holds the pattern matching string ๐Ÿงต

5.15.1. Syntax for the Literal Pattern ๐Ÿงฉ

pattern       = [wildcard] 0*( text [wildcard] )

wildcard      = exactlyone / zeroormore
text          = 1*( character / escapeseq )

exactlyone    = "_"
zeroormore    = "%"
escapechar    = "\"
escapeseq     = escapechar ( exactlyone / zeroormore / escapechar )

; character: see [XML], Section 2.2, minus wildcard / escapechar
character     = HTAB / LF / CR ; whitespace
character     =/ %x20-24 / %x26-5B / %x5D-5E / %x60-D7FF
character     =/ %xE000-FFFD / %x10000-10FFFF

(Note that the ABNF above is defined in terms of Unicode code points ([UNICODE5]). When a query is sent as an XML document over WebDAV, these characters are typically encoded in UTF-8 or UTF-16 ๐Ÿ”ค)

The value for the literal is made of wildcards separated by segments of text ๐Ÿงฑ Wildcards can begin or end the literal ๐ŸŒท

The _ wildcard matches exactly one character 1๏ธโƒฃ

The % wildcard matches zero or more characters โ™พ๏ธ

The \ character is an escape sequence, so the literal can include _ and % ๐Ÿ™Œ To include the \ character in the pattern, you use the escape sequence \\ ๐Ÿชž

5.15.2. Example of DAV:like ๐Ÿ–ผ๏ธ

This example shows how a client might use DAV:like to find resources whose content type is a subtype of image ๐Ÿ“ธ

<D:where xmlns:D='DAV:'>
  <D:like caseless="yes">
    <D:prop><D:getcontenttype/></D:prop>
    <D:literal>image/%</D:literal>
  </D:like>
</D:where>

5.16. DAV:contains ๐Ÿ”Ž

DAV:contains is an optional operator that gives you content-based search ๐Ÿ“ It implicitly searches the text content of a resource, not the content of properties ๐Ÿ™…โ€โ™€๏ธ It's intentionally not overly constrained, so the server can do the best job it can with the search ๐Ÿง 

DAV:contains evaluates to a Boolean value ๐ŸŽš๏ธ It evaluates to TRUE if the content of the resource satisfies the search, and FALSE otherwise ๐Ÿ’ฏ

Inside the DAV:contains XML element, the client provides a phrase: a single word or a whitespace-delimited sequence of words ๐Ÿ’ฌ Servers MAY ignore punctuation in a phrase ๐Ÿซ  Case-sensitivity is up to the server implementation ๐ŸŽฒ

Here's a non-exhaustive list of things that may or may not happen during the search ๐ŸŒ€ Phonetic methods such as "soundex" may or may not be used. Word stemming may or may not be performed. Thesaurus expansion of words may or may not be done. Right or left truncation may or may not be performed. The search may be case insensitive or case sensitive. The word or words may or may not be interpreted as names. Multiple words may or may not be required to be adjacent or "near" each other. Multiple words may or may not be required to occur in the same order. Multiple words may or may not be treated as a phrase. The search may or may not be interpreted as a request to find documents "similar" to the string operand. Character canonicalization, such as that done by the Unicode collation algorithm, may or may not be applied. ๐ŸŽญ

5.16.1. Result Scoring (DAV:score Element) ๐Ÿ†

Servers SHOULD indicate scores for the DAV:contains condition by adding a DAV:score XML element to the DAV:response element ๐Ÿ“Š Its value only means something in the context of a particular query result ๐ŸŽฏ The value is a string representing the score: an integer from zero to 10000 inclusive, where a higher value means a higher score (for example, more relevant) ๐Ÿฅ‡

Modified DTD fragment for DAV:propstat:

<!ELEMENT response (href, ((href*, status)|(propstat+)),
                    responsedescription?, score?) >
<!ELEMENT score    (#PCDATA) >

Clients should note that, in general, it isn't meaningful to compare the numeric values of scores from two different query results unless both were executed by the same underlying search system on the same collection of resources ๐Ÿ™

5.16.2. Ordering by Score ๐Ÿ“ˆ

To order search results by their score, you can add the DAV:score element as a child of the DAV:orderby element (in place of a DAV:prop element) ๐Ÿชœ

5.16.3. Examples ๐Ÿ’•

The example below shows a search for the phrase "Peter Forsberg" ๐Ÿ’ Depending on its support for content-based searching, a server MAY treat this as a search for documents that contain the words "Peter" and "Forsberg" ๐Ÿค”

<D:where xmlns:D='DAV:'>
  <D:contains>Peter Forsberg</D:contains>
</D:where>

The example below shows a search for resources that contain "Peter" and "Forsberg" ๐Ÿ‘ฏ

<D:where xmlns:D='DAV:'>
  <D:and>
    <D:contains>Peter</D:contains>
    <D:contains>Forsberg</D:contains>
  </D:and>
</D:where>

5.17. Limiting the Result Set โœจ

<!ELEMENT limit (nresults) >
<!ELEMENT nresults (#PCDATA)> <!-- only digits -->

okay so DAV:limit is basically the client going "bestie, don't send me the whole novel, just give me this many" ๐Ÿ’… It holds the requested limits so the server doesn't have to burn a ton of effort or send a massive reply. Inside it, DAV:nresults is the max number of DAV:response elements the client wants back in the response body. The server MAY totally ignore this limit ๐Ÿ™ˆ (no cap, it's optional for them). The value is an unsigned integer, so no negatives, bestie ๐Ÿ”ฅ

5.17.1. Relationship to Result Ordering

If the result set is both limited by DAV:limit and ordered according to DAV:orderby, the results that are included in the response document SHOULD be those that order highest. ๐ŸŽ€ So if you're doing a limit AND an order, the server SHOULD keep the top-ranking ones. Main character energy for the winners only โญ

5.18. The 'caseless' XML Attribute ๐Ÿฆ‹

The "caseless" attribute lets clients ask for caseless matching instead of the default character-by-character matching for DAV:basicsearch operators. Literally so useful when you don't care about capital letters ๐Ÿ’–

The possible values for "caseless" are "yes" or "no". The default value is server-specified, so the server decides what it does if you don't say. Caseless matching SHOULD be implemented as defined in Section 5.18 of the Unicode Standard ([UNICODE5]) ๐ŸŒˆ

Support for the "caseless" attribute is optional. A server should respond with a status of 422 if it is used but cannot be supported. So if the server can't do it, it should say 422 and not just pretend ๐Ÿ˜ญ

5.19. Query Schema for DAV:basicsearch ๐Ÿ“

The DAV:basicsearch grammar defines a search criteria that is a Boolean-valued expression, and it lets you include an arbitrary set of properties in the result record. The result set can be sorted on a set of property values too โœจ So the schema discovery DTD lets the server express two things:

  1. the set of properties that may be searched, returned, or used to sort, plus a hint about the data type of each one.
  2. the set of optional operators the resource supports.

5.19.1. DTD for DAV:basicsearch QSD ๐Ÿ’œ

<!ELEMENT basicsearchschema  (properties, operators)>
<!ELEMENT any-other-property EMPTY>
<!ELEMENT properties         (propdesc*)>
<!ELEMENT propdesc           ((prop|any-other-property), datatype?,
                              searchable?, selectable?, sortable?,
                              caseless?)>
<!ELEMENT operators          (opdesc*)>
<!ELEMENT opdesc             ANY>
<!ATTLIST opdesc             allow-pcdata (yes|no) #IMPLIED>
<!ELEMENT operand-literal    EMPTY>
<!ELEMENT operand-typed-literal EMPTY>
<!ELEMENT operand-property   EMPTY>

DAV:properties holds a list of property descriptions ๐Ÿงš and DAV:operators describes the optional operators that may be used in a DAV:where element ๐Ÿ’…

5.19.2. DAV:propdesc Element ๐ŸŽ€

Each DAV:propdesc element describes the property or properties in the DAV:prop element it contains. All the subsequent elements are descriptions that apply to those properties. All descriptions are optional and can show up in any order. Servers SHOULD support all the descriptions defined here, and MAY define others ๐Ÿฆ‹

DASL defines five descriptions. The first, DAV:datatype, gives a hint about the property's value type, which is handy for a UI asking the user for a value. The other four (DAV:searchable, DAV:selectable, DAV:sortable, and DAV:caseless) mark which parts of the query (DAV:where, DAV:select, and DAV:orderby, respectively) the property can be used in. If a property has a description for a section, the server MUST allow that property to be used in that section. These descriptions are optional. If a property doesn't have such a description, or isn't described at all, the server MAY still allow it to be used in that section. ๐Ÿซถ

5.19.2.1. DAV:any-other-property ๐ŸŒธ

This element can stand in for DAV:prop to describe WebDAV properties that aren't mentioned in any other DAV:prop element. For example, you can use it to say all other properties are searchable and selectable without giving their types. That's a typical situation for dead properties ๐Ÿงš

5.19.3. The DAV:datatype Property Description ๐Ÿ’–

The DAV:datatype element holds a single XML element that gives a hint about the property's domain, which is useful for a UI prompting for a query value. Data types are identified by an element name. Where appropriate, a server SHOULD use the simple data types defined in [XS2] โœจ

<!ELEMENT datatype ANY >

Examples from [XS2], Section 3:

+----------------+---------------------+
| Qualified name | Example             |
+----------------+---------------------+
| xs:boolean     | true, false, 1, 0   |
| xs:string      | Foobar              |
| xs:dateTime    | 1994-11-05T08:15:5Z |
| xs:float       | .314159265358979E+1 |
| xs:integer     | -259, 23            |
+----------------+---------------------+

If the data type of a property isn't given, it defaults to xs:string ๐Ÿ“

5.19.4. The DAV:searchable Property Description ๐Ÿ”ฅ

<!ELEMENT searchable EMPTY>

If this element is present, the server MUST allow this property to appear within a DAV:where element wherever an operator allows a property. Allowing a search doesn't mean the property is guaranteed to be defined on every resource in scope, it only shows the server is willing to check ๐Ÿ‘€

5.19.5. The DAV:selectable Property Description ๐ŸŒˆ

<!ELEMENT selectable EMPTY>

This element shows that the property may appear in the DAV:select element ๐Ÿ’…

5.19.6. The DAV:sortable Property Description ๐Ÿฆ‹

This element shows that the property may appear in the DAV:orderby element.

<!ELEMENT sortable EMPTY>

5.19.7. The DAV:caseless Property Description ๐Ÿ’œ

This element only applies to properties whose data type is "xs:string" and derived data types, as per the DAV:datatype property description. Its presence means comparisons for searches, and comparisons for ordering results on the string property, will be caseless (the default is character by character) โœจ

<!ELEMENT caseless EMPTY>

5.19.8. The DAV:operators XML Element ๐ŸŽ€

DAV:operators describes every optional operator supported in a query. (Mandatory operators aren't listed, since they're mandatory and allow no variation in syntax ๐Ÿ™„) All optional operators that are supported MUST be listed in DAV:operators ๐Ÿ’–

Each operator's listing, inside a DAV:opdesc element, is the operator as an empty element, followed by one element for each operand. The operand MUST be either DAV:operand-property, DAV:operand-literal, or DAV:operand-typed-literal, which say that the operand in that position is a property, a literal value, or a typed literal value, respectively. If an operator is polymorphic (allows more than one operand syntax), then each permitted syntax MUST be listed separately ๐Ÿงš

DAV:opdesc MAY have an "allow-pcdata" attribute (defaulting to "no"). A value of "yes" means the operator can contain character data, like DAV:contains does (see Section 5.16) ๐ŸŒธ Defining additional operators using this format is NOT RECOMMENDED, bestie ๐Ÿ™ˆ

<operators xmlns='DAV:'>
  <opdesc>
    <like/><operand-property/><operand-literal/>
  </opdesc>
</operators>

5.19.9. Example of Query Schema for DAV:basicsearch โœจ

<D:basicsearchschema xmlns:D="DAV:"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <D:properties>
    <D:propdesc>
      <D:prop><D:getcontentlength/></D:prop>
      <D:datatype><xs:nonNegativeInteger/></D:datatype>
      <D:searchable/><D:selectable/><D:sortable/>
    </D:propdesc>
    <D:propdesc>
      <D:prop><D:getcontenttype/><D:displayname/></D:prop>
      <D:searchable/><D:selectable/><D:sortable/>
    </D:propdesc>
    <D:propdesc>
      <D:prop><fstop xmlns="http://ns.example.org"/></D:prop>
      <D:selectable/>
    </D:propdesc>
    <D:propdesc>
      <D:any-other-property/>
      <D:searchable/><D:selectable/>
    </D:propdesc>
  </D:properties>
  <D:operators>
    <D:opdesc>
      <D:like/><D:operand-property/><D:operand-literal/>
    </D:opdesc>
    <D:opdesc allow-pcdata="yes">
      <D:contains/>
    </D:opdesc>
  </D:operators>
</D:basicsearchschema>

This response lists four properties ๐ŸŒŸ The data type of the last three isn't given, so it defaults to xs:string. All four are selectable, and the first three can be searched. All but the last can be used in a sort. Of the optional DAV operators, DAV:contains and DAV:like are supported ๐Ÿ’…

Note: The schema discovery defined here doesn't provide for discovering supported values of the "caseless" attribute. This may mean the reply also has to list the mandatory operators. ๐Ÿ™ˆ

6. Internationalization Considerations ๐ŸŒ

Properties may be language-tagged using the xml:lang attribute (see [RFC4918], Section 4.3) ๐Ÿณ๏ธโ€๐ŸŒˆ The optional operators DAV:language-defined (Section 5.12.1) and DAV:language-matches (Section 5.12.2) let you express conditions on that language tagging info ๐Ÿ’–

7. Security Considerations ๐Ÿ”

This section is here to detail security issues DASL applications need to be aware of ๐Ÿšจ All of the security considerations of HTTP/1.1 ([RFC2616]) and WebDAV ([RFC4918]) also apply to DASL. On top of that, this section covers security risks inherent in searching and retrieving resource properties and content ๐Ÿ’€

A query MUST NOT let clients retrieve information that wouldn't have been available through the GET or PROPFIND methods in the first place. Specifically:

  • Query constraints on WebDAV properties that the client doesn't have read access to need to be evaluated as if the property did not exist (see Section 5.5.3) ๐Ÿ˜ญ
  • Query constraints on content (like with DAV:contains, defined in Section 5.16) that the client doesn't have read access to need to be evaluated as if a GET would return a 4xx status code ๐Ÿซ 

A server should prepare for denial-of-service attacks. For example, a client may issue a query where the result set is expensive to calculate or transmit because many resources match or must be evaluated. Bestie, this is serious, so plan for it ๐Ÿšจ๐Ÿ’…

7.1. Implications of XML External Entities ๐Ÿซถ

okay so XML has this feature called "external entities" (check Section 4.2.2 of [XML] if you want the nerdy details ๐Ÿค“). It basically tells an XML processor to go fetch some XML sitting at a URI and pull it inline. An external entity can add to or change the document type declaration (DTD) attached to an XML document, and it can also drop XML right into the content of the document itself. For non-validating XML, which is the kind this spec uses, [XML] doesn't require including an external entity. It does say an XML processor may, at its discretion, include it anyway โœจ

Here's the thing: external XML entities have no inherent trustworthiness ๐Ÿ™…โ€โ™€๏ธ and they're open to every attack that's basically baked into any HTTP GET request. Yikes ๐Ÿ’€

It gets worse. An external entity can modify the DTD, which can change the final form of the XML document. In the worst case it can seriously change what the document means, or expose the XML processor to the security risks discussed in [RFC3023]. So, implementers, you need to know that external XML entities should be treated as untrustworthy ๐Ÿšซ

There's also a scalability problem. Picture a widely deployed app that leans on external XML entities. It's very possible that tons and tons of requests would hit the same external XML entity, which could overload whatever server is responsible for the resource holding that entity ๐Ÿ˜ญ


8. Scalability ๐Ÿ“ˆ

Query grammars are identified by URIs ๐Ÿ”— Applications SHOULD NOT try to retrieve these URIs, even if they look retrievable (like the ones starting with "http://") ๐Ÿ™…โ€โ™€๏ธ


9. IANA Considerations ๐Ÿ“‹

This document uses the namespace defined in Section 21 of [RFC4918] for XML elements ๐ŸŽ€

9.1. HTTP Headers ๐Ÿ’Œ

This document specifies one HTTP header, listed below, which has been added to the permanent HTTP header registry defined in [RFC3864] โœจ

9.1.1. DASL ๐Ÿฆ‹

Header field name:  DASL
Applicable protocol:  http
Status:  standard
Author/Change controller:  IETF
Specification document:  this specification (Section 3.2)

10. Contributors ๐Ÿงš

This document is based on earlier work on the DASL protocol, which the WebDAV DASL working group did up until the year 2000. The people behind that work are Alan Babich, Jim Davis, Rick Henderson, Dale Lowry, Saveen Reddy, Surendra Reddy, and Judith Slein ๐Ÿ‘‘ If you want to dig into the history, check out the working group's web site at <http://www.webdav.org/dasl/>, the requirements document at <http://purl.org/NET/webdav/dasl-references/reqs>, and an early version of the specification at <http://purl.org/NET/webdav/dasl-references/dasl-protocol-00> ๐Ÿ“š

11. Acknowledgements ๐Ÿซถ

This document got lots of thoughtful discussion from Lisa Dusseault, Javier Godoy, Sung Kim, Chris Newman, Elias Sinderson, Martin Wallmer, Keith Wannamaker, Jim Whitehead, and Kevin Wiggen. Iconic team ๐ŸŒˆ๐Ÿ’œ

12. References ๐Ÿ“š

12.1. Normative References ๐Ÿ”ฅ

[RFC2119]      Bradner, S., "Key words for use in RFCs to Indicate
               Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2616]      Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
               Masinter, L., Leach, P., and T. Berners-Lee,
               "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616,
               June 1999.

[RFC3023]      Murata, M., St. Laurent, S., and D. Kohn, "XML Media
               Types", RFC 3023, January 2001.

[RFC3253]      Clemm, G., Amsden, J., Ellison, T., Kaler, C., and J.
               Whitehead, "Versioning Extensions to WebDAV (Web
               Distributed Authoring and Versioning)", RFC 3253,
               March 2002.

[RFC3744]      Clemm, G., Reschke, J., Sedlar, E., and J. Whitehead,
               "Web Distributed Authoring and Versioning (WebDAV)
               Access Control Protocol", RFC 3744, May 2004.

[RFC3986]      Berners-Lee, T., Fielding, R., and L. Masinter,
               "Uniform Resource Identifier (URI): Generic Syntax",
               STD 66, RFC 3986, January 2005.

[RFC4918]      Dusseault, L., Ed., "HTTP Extensions for Web
               Distributed Authoring and Versioning (WebDAV)",
               RFC 4918, June 2007.

[RFC5234]      Crocker, D., Ed. and P. Overell, "Augmented BNF for
               Syntax Specifications: ABNF", STD 68, RFC 5234,
               January 2008.

[XML]          Bray, T., Paoli, J., Sperberg-McQueen, C., Maler, E.,
               and F. Yergeau, "Extensible Markup Language (XML) 1.0
               (Fourth Edition)", W3C REC-xml-20060816, August 2006,
               <http://www.w3.org/TR/2006/REC-xml-20060816>.

[XPATH]        Clark, J. and S. DeRose, "XML Path Language (XPath)
               Version 1.0", W3C REC-xpath-19991116, November 1999,
               <http://www.w3.org/TR/1999/REC-xpath-19991116>.

[XPATHFUNC]    Malhotra, A., Melton, J., and N. Walsh, "XQuery 1.0
               and XPath 2.0 Functions and Operators", W3C REC-xpath-
               functions-20070123, January 2007, <http://www.w3.org/
               TR/2007/REC-xpath-functions-20070123/>.

[XS1]          Thompson, H., Beech, D., Maloney, M., Mendelsohn, N.,
               and World Wide Web Consortium, "XML Schema Part 1:
               Structures", W3C REC-xmlschema-1-20041028,
               October 2004,
               <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/>.

[XS2]          Biron, P., Malhotra, A., and World Wide Web
               Consortium, "XML Schema Part 2: Datatypes Second
               Edition", W3C REC-xmlschema-2-20041028, October 2004,
               <http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/>.

12.2. Informative References ๐Ÿ’ก

[BCP47]        Phillips, A. and M. Davis, "Matching of Language
               Tags", BCP 47, RFC 4647, September 2006.

[RFC3864]      Klyne, G., Nottingham, M., and J. Mogul, "Registration
               Procedures for Message Header Fields", BCP 90,
               RFC 3864, September 2004.

[RFC4437]      Whitehead, J., Clemm, G., and J. Reschke, Ed., "Web
               Distributed Authoring and Versioning (WebDAV) Redirect
               Reference Resources", RFC 4437, March 2006.

[RFC4790]      Newman, C., Duerst, M., and A. Gulbrandsen, "Internet
               Application Protocol Collation Registry", RFC 4790,
               March 2007.

[SQL99]        Milton, J., "Database Language SQL Part 2:  Foundation
               (SQL/Foundation)", ISO ISO/IEC 9075-2:1999 (E),
               July 1999.

[UNICODE5]     The Unicode Consortium, "The Unicode Standard -
               Version 5.0", Addison-Wesley , November 2006,
               <http://www.unicode.org/versions/Unicode5.0.0/>.

               ISBN 0321480910 [1]

[WEBDAV-BIND]  Clemm, G., Crawford, J., Reschke, J., Ed., and J.
               Whitehead, "Binding Extensions to Web Distributed
               Authoring and Versioning (WebDAV)", October 2008.

URIs

[1]  <urn:isbn:0321480910>

Appendix A. Three-Valued Logic in DAV:basicsearch ๐Ÿง 

ANSI standard three-valued logic is used when evaluating the search condition (as defined in the ANSI standard SQL specifications, for example, in ANSI X3.135-1992, Section 8.12, pp. 188-189, Section 8.2, p. 169, General Rule 1)a), etc.).

ANSI standard three-valued logic is undoubtedly the most widely practiced method for dealing with two things. The first is properties in the search condition that have no value (like being null or not defined) for the resource being scanned. The second is undefined expressions in the search condition, like division by zero. Here's how three-valued logic works ๐Ÿ‘€

Undefined expressions are expressions whose value isn't defined. They're a totally separate concept from the truth value UNKNOWN, which is actually well defined โœจ Property names and literal constants count as expressions for this section. If a property on the current resource being scanned hasn't been set to a value, then that property's value is undefined for that resource. DASL 1.0 has no arithmetic division operator, but if it did, division by zero would be an undefined arithmetic expression ๐Ÿ™ˆ

If any subpart of an arithmetic, string, or datetime subexpression is undefined, then the entire arithmetic, string, or datetime subexpression is undefined ๐Ÿ’…

There are no manifest constants that explicitly represent an undefined number, string, or datetime value.

Since the search condition ultimately returns a Boolean value, arithmetic, string, and datetime expressions are always arguments to other operators. Examples of operators that turn arithmetic, string, and datetime expressions into Boolean values are the six relational operators ("greater than", "less than", "equals", and so on). If either or both operands of a relational operator have undefined values, the relational operator evaluates to UNKNOWN. Otherwise, it evaluates to TRUE or FALSE, depending on how the comparison turns out ๐Ÿ’–

The Boolean operators DAV:and, DAV:or, and DAV:not are evaluated according to these rules:

not UNKNOWN = UNKNOWN

UNKNOWN and TRUE = UNKNOWN
UNKNOWN and FALSE = FALSE

UNKNOWN and UNKNOWN = UNKNOWN

UNKNOWN or TRUE = TRUE

UNKNOWN or FALSE = UNKNOWN

UNKNOWN or UNKNOWN = UNKNOWN

Appendix B. Candidates for Future Protocol Extensions ๐Ÿ”ฎ

This section sums up issues that came up while this specification was being developed, but for which no resolution could be found within the constraints in place. Future revisions of this specification should revisit these issues, though ๐ŸŒธ

B.1. Collation Support ๐Ÿ”ค

Matching and sorting of textual data relies on collations. For WebDAV SEARCH, a few design approaches could be combined:

  • Require server support for specific collations.
  • Require that the server can advertise which collations it supports.
  • Allow a client to select the collation to be used.

In practice, current implementations of WebDAV SEARCH usually rely on backends they don't control, and collation information for those backends may not be available. To make things worse, implementations of the DAV:basicsearch grammar often need to combine data from multiple underlying stores (such as properties and full text content), so collation support may vary depending on the operator or property ๐Ÿ˜ฉ

Another open issue is which collation formalism to support. At the time of writing, the two specifications below seem to provide the necessary framework, so they may be the base for future work on collation support in WebDAV SEARCH:

  1. "Internet Application Protocol Collation Registry" ([RFC4790]).
  2. "XQuery 1.0 and XPath 2.0 Functions and Operators" ([XPATHFUNC], Section 7.3.1).

B.2. Count ๐Ÿ”ข

DAV:basicsearch doesn't allow a request that returns the count of matching resources.

A protocol extension would need to extend DAV:select, and also modify the DAV:multistatus response format.

B.3. Diagnostics for Unsupported Queries ๐Ÿฉบ

There are lots of reasons a given query might not be supported by a server. Query Schema Discovery (Section 4) can be used to discover some of those constraints, but not all of them.

Future revisions should consider introducing specific condition codes ([RFC4918], Section 16) for these situations.

B.4. Language Matching ๐ŸŒธ

okay so Section 5.12.2 defines language matching in terms of the XPath "lang" function ([XPATH], Section 4.3) ๐Ÿ’… future revisions should consider building on [BCP47] instead, bestie ๐ŸŒˆ

B.5. Matching Media Types ๐ŸŽ€

matching media types with DAV:getcontenttype and the DAV:like operator is kinda hard, lowkey, because DAV:getcontenttype also lets parameters ride along ๐Ÿ™ˆ a brand new operator made just for matching media types would probably simplify things a LOT โœจ there's a specific proposal over here: http://lists.w3.org/Archives/Public/www-webdav-dasl/2003OctDec/0109.html ๐Ÿฆ‹

B.6. Query by Name ๐Ÿฆ‹

DAV:basicsearch works on the properties (and optionally the contents) of resources, so it doesn't really let you match on parts of a resource's URI ๐Ÿ˜ญ if you want that, check out this proposed extension: http://lists.w3.org/Archives/Public/www-webdav-dasl/2003OctDec/0100.html ๐Ÿ’œ

B.7. Result Paging ๐Ÿงš

okay this one gets talked about a LOT ๐Ÿ”ฅ the dream is being able to ask for the "next" set of results, whether the server chopped the result short or the client deliberately asked for a limited set (like with the DAV:limit element defined in Section 5.17) ๐Ÿ’–

in that case, it would be super desirable if the server could hang onto the full query result and hand back a brand new URI that points at a separate result resource ๐Ÿซถ then the client could grab more data with GET requests, and delete the result with a DELETE request when it's done ๐Ÿงน main character energy ๐Ÿ‘‘

B.8. Search Scope Discovery ๐Ÿ”

so, given a Search Arbiter resource, right now there's literally no way to ask programmatically which sets of search scopes are supported ๐Ÿ’€ future revisions of this spec could define a scope discovery mechanism, kinda like the Query Schema Discovery in Section 4 โœจ


Index ๐Ÿ“‡

   C
      caseless attribute  26-27, 34
      Condition Names
         DAV:search-grammar-discovery-supported (pre)  9
         DAV:search-grammar-supported (pre)  9
         DAV:search-multiple-scope-supported (pre)  9
         DAV:search-scope-valid (pre)  9
      Criteria  5

   D
      DAV:and  26
      DAV:ascending  26
      DAV:contains  31
      DAV:depth  23
      DAV:descending  26
      DAV:eq  27
         caseless attribute  27
      DAV:from  23
      DAV:gt  27
      DAV:gte  27
      DAV:include-versions  23
      DAV:is-collection  30
      DAV:is-defined  30
      DAV:language-defined  29
      DAV:language-matches  29
      DAV:like  30
      DAV:limit  33
      DAV:literal  27
      DAV:lt  27
      DAV:lte  27
      DAV:not  26
      DAV:nresults  33
      DAV:or  26
      DAV:orderby  26
      DAV:scope  23
      DAV:score  32
         relationship to DAV:orderby  33
      DAV:search-grammar-discovery-supported precondition  9
      DAV:search-grammar-supported precondition  9
      DAV:search-multiple-scope-supported precondition  9
      DAV:search-scope-valid precondition  9
      DAV:select  23
      DAV:supported-query-grammar-set property  14
      DAV:typed-literal  28
      DAV:where  24

   M
      Methods
         SEARCH  7

   O
      OPTIONS method  13
         DASL response header  14

   P
      Properties
         DAV:supported-query-grammar-set  14

   Q
      Query  5
      Query Grammar  5
      Query Grammar Discovery  13
         using live property  13
         using OPTIONS  13
      Query Schema  5

   R
      Result  5
      Result Record  5
      Result Record Definition  5
      Result Set  5
      Result Set Truncation
         Example  10

   S
      Scope  6
      Search Arbiter  6
      SEARCH method  7
      Search Modifier  6
      Sort Specification  6

Authors' Addresses ๐Ÿ’Œ

the squad behind this spec, with all their contact details ๐Ÿซถ

   Julian F. Reschke (editor)
   greenbytes GmbH
   Hafenweg 16
   Muenster, NW  48155
   Germany

   Phone: +49 251 2807760
   EMail: julian.reschke@greenbytes.de
   URI:   http://greenbytes.de/tech/webdav/


   Surendra Reddy
   Mitrix, Inc.
   303 Twin Dolphin Drive, Suite 600-37
   Redwood City, CA  94065
   U.S.A.

   Phone: +1 408 500 1135
   EMail: Surendra.Reddy@mitrix.com


   Jim Davis
   27 Borden Street
   Toronto, Ontario  M5S 2M8
   Canada

   Phone: +1 416 929 5854
   EMail: jrd3@alum.mit.edu
   URI:   http://www.econetwork.net/~jdavis

   Alan Babich
   IBM Corporation
   3565 Harbor Blvd.
   Costa Mesa, CA  92626
   U.S.A.

   Phone: +1 714 327 3403
   EMail: ababich@us.ibm.com
๐Ÿ“ฆ where this page comes from