|Network Working Group||J. Reschke, Editor|
|Intended status: Standards Track||S. Reddy|
|Expires: May 2009||Mitrix|
Note: a later version of this document has been published as RFC5323.
By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress”.
The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html.
This Internet-Draft will expire in May 2009.
This document specifies a set of methods, headers I ↓ and properties composing ↑ I ↓
WebDAV SEARCH, an application of the HTTP/1.1 protocol to efficiently search for DAV resources based upon a set of client-supplied criteria.
Please send comments to the Distributed Authoring and Versioning (WebDAV) DASL mailing list at <mailto:email@example.com>, which may be joined by sending a message with subject "subscribe" to <mailto:firstname.lastname@example.org>. Discussions of the WebDAV DASL mailing list are archived at <http://lists.w3.org/Archives/Public/www-webdav-dasl/>.
An issues list and XML and HTML versions of this draft are available from <http://greenbytes.de/tech/webdav/#draft-reschke-webdav-search>.
|I edit (type: edit, status: open)|
|email@example.com||2004-07-05||Umbrella issue for editorial fixes/enhancements.|
|Associated changes in this document: 5.15.1, del-21.|
|I auth48 (type: edit, status: open)|
|firstname.lastname@example.org||2008-10-10||Umbrella issue for changes made during the RFC Editor's AUTH48 period.|
|Associated changes in this document: <#rfc.change.auth48.1>, <#rfc.change.auth48.2>, <#rfc.change.auth48.3>, 1.1, 1.1, 1.1, 1.3, 1.3, 1.3, 1.4, 1.5, 2.2.1, 2.3, 2.3, 2.3, 2.3, 2.3.1, 2.3.1, 2.3.2, 2.4, 2.4, 3, 3, 3.2, 3.2, 3.3, 3.3, 3.4, 4, 5.4.1, 5.4.2, 5.5, 5.5.3, 5.5.4, 5.5.4, 5.6, 5.6.1, 5.9, 5.10, 5.11, 5.11, 5.11, 5.11, 5.11, 5.11.1, 5.11.1, 5.12.1, 5.12.1, 5.12.2, 5.12.2, 5.12.2, 5.12.3, 5.13.1, 5.13.1, 5.15.1, 5.15.1, 5.15.1, 5.16, 5.16, 5.16.1, 5.19, 5.19, 5.19.7, 5.19.7, 5.19.7, 5.19.8, 5.19.8, 5.19.8, 6, 7, 7, 7.1, 7.1, 8, 9.1, 10, 10, 11, 12.1, 12.1, 12.1, 12.2, 12.2, 12.2, A, A, A, A, A, A, B, B, <#rfc.change.auth48.93>.|
This document defines Web Distributed Authoring and Versioning (WebDAV) SEARCH, an application of HTTP/1.1 forming a lightweight search protocol to transport queries and result sets that allows clients to make use of server-side search facilities. It is based on ↑↓
the expired internet draft for DAV Searching & Locating [DASL]. ↑↓ [DASLREQ] describes the motivation for DASL. In this specification, the terms "WebDAV SEARCH" and "DASL" are used interchangeably.¶
DASL minimizes the complexity of clients so as to facilitate widespread deployment of applications capable of utilizing the DASL search mechanisms.¶
DASL consists of: ¶
Query Grammar ¶
Query Schema ¶
Result Record ¶
Result Record Definition ¶
Result Set ¶
Search Arbiter ¶
Search Modifier ¶
Sort Specification ¶
This document uses XML DTD fragments ([XML], Section 3.2) as a purely notational convention. WebDAV request and response bodies ↑↓
can not 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: ¶
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 specification defines elements, properties↑↓ and condition names in the XML namespace "DAV:". In general, only specifications authored by IETF working groups are supposed to do this. In this case 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.¶
One can express the basic usage of DASL in the following steps: ¶
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.¶
The client invokes the SEARCH method on the resource named by 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.¶
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 [draft-ietf-webdav-bind] to identify possible duplicates.¶
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.¶
This example demonstrates 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.¶
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>
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>
In the example below, the server returns just two results, and then indicates that the result is truncated by adding a DAV:response element for the search arbiter resource with 507 (Insufficient Storage) status.¶
SEARCH / HTTP/1.1 Host: example.net Content-Type: text/xml; charset="utf-8" Content-Length: xxx ... the query goes here ...
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>
If a SEARCH request could not be executed or the attempt to execute it resulted in an error, the server MUST indicate the failure with an appropriate status code and SHOULD add a response body as defined in ↑↓
[RFC3253], Section 1.6. Unless otherwise stated, condition elements are empty↑↓ , however specific condition elements MAY include additional child elements that describe the error condition in more detail.¶
In the example below, a request failed because the scope identifies a HTTP resource that was not found.¶
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>
Servers MUST support discovery of the query grammars supported by a search arbiter resource.¶
Clients can determine which query grammars are supported by an arbiter by invoking OPTIONS on the search arbiter. If the resource supports SEARCH, then the DASL response header will appear in the response. The DASL response header lists the supported grammars.¶
The OPTIONS method allows the client to discover if a resource supports the SEARCH method and to determine the list of search grammars supported for that resource.¶
DASL servers MUST include the DASL header in the OPTIONS response. This header identifies the search grammars supported by that resource.¶
DASLHeader = "DASL" ":" 1#Coded-URL Coded-URL = <defined in Section 10.1 of [RFC4918]>
The DASL response header indicates server support for query grammars in the OPTIONS method. The value is a list of URIs that indicate the types of supported grammars. Note that although the URIs can be used to identify each supported search grammar, there is not necessarily a direct relationship between the URI and the XML element name that can be used in XML based SEARCH requests (the element name itself is identified by its namespace name (a URI reference) and the element's local name).¶
DASL: <http://foobar.example/syntax1>, <http://akuma.example/syntax2>, <DAV:basicsearch> DASL: <http://example.com/foo/natural-language-query>
<!ELEMENT supported-query-grammar-set (supported-query-grammar*)> <!ELEMENT supported-query-grammar (grammar)> <!ELEMENT grammar ANY> <!-- ANY value: a query grammar element type -->
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.¶
OPTIONS /somefolder HTTP/1.1 Host: example.org
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.¶
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>
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>
Servers MAY support the discovery of the schema for a query grammar.¶
The DASL response header and the DAV:supported-query-grammar-set property provide means for clients to discover the set of query grammars supported by a resource. This alone is not sufficient information for a client to generate a query. For example, the DAV:basicsearch grammar defines a set of queries consisting of a set of operators applied to a set of properties and values, but the grammar itself does not specify which properties may be used in the query. QSD for the DAV:basicsearch grammar allows a client to discover the set of properties that are searchable, selectable, and sortable. Moreover, although the DAV:basicsearch grammar defines a minimal set of operators, it is possible that a resource might support additional operators in a query. For example, a resource might support an optional operator that can be used to express content-based queries in a proprietary syntax. QSD allows a client to discover these operators and their syntax. The set of discoverable quantities will differ from grammar to grammar, but each grammar can define a means 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. A given resource might have access to one set of properties for one potential scope, and another set for a different scope. For example, consider a server able to search two distinct collections↑↓
, one holding cooking recipes, the other design documents for nuclear weapons. While both collections might support properties such as author, title, and date, the first might also define properties such as calories and preparation time, while the second defined properties such as yield and applicable patents. Two distinct arbiters indexing the same collection might also have access to different properties. For example, the recipe collection mentioned above might also be indexed by a value-added server that also stored the names of chefs who had tested the recipe. Note also that the available query schema might also depend on other factors, such as the identity of the principal conducting the search, but these factors are not exposed in this protocol.¶
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 and with a root element of DAV:query-schema-discovery rather than DAV:searchrequest.¶
<!ELEMENT query-schema-discovery ANY> <!-- ANY value: XML element specifying the query grammar and the scope -->
<!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 upon the grammar, and whose value may (and likely will) vary depending upon the grammar, arbiter, and scope.¶
In this example, the arbiter is recipes.example, the grammar is DAV:basicsearch, the scope is also recipes.example.¶
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>
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>
DAV:basicsearch uses an extensible XML syntax that allows clients to express search requests that are generally useful for WebDAV scenarios. DASL-extended servers MUST accept this grammar, and MAY accept other grammars.¶
DAV:basicsearch has several components:¶
<!-- "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) >
This query retrieves the content length values for all resources located under the server's "/container1/" URI namespace whose length exceeds 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>
<!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.¶
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.¶
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).¶
A Scope can be an arbitrary URI reference.¶
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.¶
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.¶
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.¶
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.¶
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>
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>
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.¶
<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>
The DAV:and operator performs a logical AND operation on the expressions it contains.¶
The DAV:or operator performs a logical OR operation on the values it contains.¶
The DAV:not operator performs a logical NOT operation on the values it contains.¶
The DAV:eq operator provides simple equality matching on property values.¶
DAV:literal allows literal values to be placed in an expression.¶
In comparisons, the contents of DAV:literal SHOULD be treated as string, with the following exceptions: ¶
There are situations in which a client may want to force a comparison not to be string-based (as defined for DAV:literal). In these cases, a typed comparison can be enforced by using DAV:typed-literal instead.¶
<!ELEMENT typed-literal (#PCDATA)>
A server MUST reject a request ↑↓
with an unknown type with a status of 422 (Unprocessable Entity). It SHOULD reject a request if the value provided in DAV:typed-literal ↑↓ can not be cast to the specified type.¶
Consider a set of resources with the dead property "edits" in the namespace "http://ns.example.org":¶
<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>
will evaluate to TRUE for the resources "/a" and "/b" (their property values can be parsed as type xs:integer, and the numerical comparison evaluates to true), to FALSE for "/c" (property value is compatible, but numerical comparison evaluates to false)↑↓ and UNKNOWN for "/d" and "/e" (the property either is undefined, or its value ↑↓
can not be parsed as xs:integer).¶
The following two optional operators can be used to express conditions on the language of a property value (as expressed using the xml:lang attribute).¶
<!ELEMENT language-defined (prop)>
<!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 is not defined.¶
<or xmlns="DAV:"> <not> <language-defined> <prop><foobar/></prop> </language-defined> </not> <language-matches> <prop><foobar/></prop> <literal>en</literal> </language-matches> </or>
The DAV:is-collection operator allows clients to determine whether a resource is a collection (that is, whether its DAV:resourcetype element contains the element DAV:collection).¶
Rationale: This operator is provided in lieu of defining generic structure queries, which would suffice for this and for many more powerful queries, but seems inappropriate to standardize at this time.¶
<d:is-defined xmlns:d='DAV:' xmlns:x='http://example.com/ns'> <d:prop><x:someprop/></d:prop> </d:is-defined>
The DAV:like is an optional operator intended to give simple wildcard-based pattern matching ability to clients.¶
The operator takes two arguments.¶
The first argument is a DAV:prop element identifying a single property to evaluate.¶
The second argument is a DAV:literal element that gives the pattern matching string.¶
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↑↓
n query is transmitted as ↑↓XML document ↓WebDAV, these characters are typically encoded in UTF-8 or UTF-16.)
The value for the literal is composed of wildcards separated by segments of text. Wildcards may begin or end the literal.¶
The "_" wildcard matches exactly one character.¶
The "\" character is an escape sequence so that the literal can include "_" and "%". To include the "\" character in the pattern, the escape sequence "\\" is used.¶
The DAV:contains operator is an optional operator that provides content-based search capability. This operator implicitly searches against the text content of a resource, not against ↑↓content of properties. The DAV:contains operator is intentionally not overly constrained, in order to allow the server to do the best job it can in performing the search.¶
The DAV:contains operator evaluates to a Boolean value. It evaluates to TRUE if the content of the resource satisfies the search. Otherwise, it evaluates to FALSE.¶
Within the DAV:contains XML element, the client provides a phrase: a single word or whitespace delimited sequence of words. Servers MAY ignore punctuation in a phrase. Case-sensitivity is at the discretion of the server implementation.¶
The following non-exhaustive list enumerate↑↓ things that may or may not be done as part of 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.¶
Servers SHOULD indicate scores for the DAV:contains condition by adding a DAV:score XML element to the DAV:response element. Its value is defined only 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 indicates a higher score (e.g.↑↓ 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 is not 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.¶
To order search results by their score, the DAV:score element may be added as child to the DAV:orderby element (in place of a DAV:prop element).¶
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>
<!ELEMENT limit (nresults) > <!ELEMENT nresults (#PCDATA)> <!-- only digits -->
The DAV:limit XML element contains requested limits from the client to limit the size of the reply or amount of effort expended by the server. The DAV:nresults XML element contains a requested maximum number of DAV:response elements to be returned in the response body. The server MAY disregard this limit. The value of this element is an unsigned integer.¶
The "caseless" attribute allows clients to specify caseless matching behavior instead of character-by-character matching for DAV:basicsearch operators.¶
Support for the "caseless" attribute is optional. A server should respond with a status of 422 if it is used but cannot be supported.¶
The DAV:basicsearch grammar defines a search criteria that is a Boolean-valued expression, and allows for an arbitrary set of properties to be included in the result record. The result set may be sorted on a set of property values. Accordingly↑↓ the DTD for schema discovery for this grammar allows the server to express:¶
<!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>
The DAV:properties element holds a list of descriptions of properties.¶
The DAV:operators element describes the optional operators that may be used in a DAV:where element.¶
Each instance of a DAV:propdesc element describes the property or properties in the DAV:prop element it contains. All subsequent elements are descriptions that apply to those properties. All descriptions are optional and may appear in any order. Servers SHOULD support all the descriptions defined here, and MAY define others.¶
DASL defines five descriptions. The first, DAV:datatype, provides a hint about the type of the property value, and may be useful to a user interface prompting for a value. The remaining four (DAV:searchable, DAV:selectable, DAV:sortable, and DAV:caseless) identify portions of the query (DAV:where, DAV:select, and DAV:orderby, respectively). If a property has a description for a section, then the server MUST allow the property to be used in that section. These descriptions are optional. If a property does not have such a description, or is not described at all, then the server MAY still allow the property to be used in the corresponding section.¶
This element can be used in place of DAV:prop to describe properties of WebDAV properties not mentioned in any other DAV:prop element. For instance, this can be used to indicate that all other properties are searchable and selectable without giving details about their types (a typical scenario for dead properties).¶
The DAV:datatype element contains a single XML element that provides a hint about the domain of the property, which may be useful to a user interface prompting for a value to be used in a query. Data types are identified by an element name. Where appropriate, a server SHOULD use the simple data types defined in [XS2].¶
<!ELEMENT datatype ANY >
|xs:boolean||true, false, 1, 0|
If the data type of a property is not given, then the data type defaults to xs:string.¶
<!ELEMENT searchable EMPTY>
If this element is present, then the server MUST allow this property to appear within a DAV:where element where an operator allows a property. Allowing a search does not mean that the property is guaranteed to be defined on every resource in the scope, it only indicates the server's willingness to check.¶
<!ELEMENT selectable EMPTY>
This element indicates that the property may appear in the DAV:select element.¶
This element indicates that the property may appear in the DAV:orderby element.¶
<!ELEMENT sortable EMPTY>
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 indicates that ↑↓
compares performed for searches, and the comparisons for ordering results on the string property will be caseless (the default is character↑↓ -by↑↓ -character).¶
<!ELEMENT caseless EMPTY>
The DAV:operators element describes every optional operator supported in a query. (Mandatory operators are not listed since they are mandatory and permit no variation in syntax.)↑↓
. All optional operators that are supported MUST be listed in the DAV:operators element.¶
The listing for an operator, contained in an DAV:opdesc element, consists of 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 indicate that the operand in the corresponding 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.¶
The DAV:opdesc element MAY have a "allow-pcdata" attribute (defaulting to "no"). A value of "yes" indicates that the operator can contain character data, as it is the case with DAV:contains (see Section 5.16). Definition of additional operators using this format is NOT RECOMMENDED.¶
<operators xmlns='DAV:'> <opdesc> <like/><operand-property/><operand-literal/> </opdesc> </operators>
<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 properties is not given, so it defaults to xs:string. All are selectable, and the first three may be searched. All but the last may be used in a sort. Of the optional DAV operators, DAV:contains and DAV:like are supported.¶
Note: The schema discovery defined here does not provide for discovery of supported values of the "caseless" attribute. This may require that the reply also list the mandatory operators.¶
This section is provided to detail issues concerning security implications of which DASL applications need to be aware. All of the security considerations of HTTP/1.1 ([RFC2616] and WebDAV ([RFC4918]) also apply to DASL. In addition, this section will include security risks inherent in ↑↓
searching and retrieval of resource properties and content.¶
A query MUST NOT allow clients to retrieve information that wouldn't have been available through the GET or PROPFIND methods in the first place. In particular: ¶
A server should prepare for ↑↓
denial of service attacks. For example a client may issue a query for which the result set is expensive to calculate or transmit because many resources match or must be evaluated.¶
XML supports a facility known as "external entities", defined in Section 4.2.2 of [XML], which instruct an XML processor to retrieve and perform an inline include of XML located at a particular URI. An external XML entity can be used to append or modify the document type declaration (DTD) associated with an XML document. An external XML entity can also be used to include XML within the content of an XML document. For non-validating XML, such as the XML used in this specification, including an external XML entity is not required by [XML]. However, [XML] does state that an XML processor may, at its discretion, include the external XML entity.¶
External XML entities have no inherent trustworthiness and are subject to all the attacks that are endemic to any HTTP GET request. Furthermore, it is possible for an external XML entity to modify the DTD, and hence affect the final form of an XML document, in the worst case significantly modifying its semantics, or exposing the XML processor to the security risks discussed in [RFC3023]. Therefore, implementers must be aware that external XML entities should be treated as untrustworthy.¶
There is also the scalability risk that would accompany a widely deployed application ↑↓
which made use of external XML entities. In this situation, it is possible that there would be significant numbers of requests for one external XML entity, potentially overloading any server ↑↓ which fields requests for the resource containing the external XML entity.¶
ANSI standard three↑↓
section 8.12, pp. 188-189, ↑↓ section 8.2, p. 169, General Rule 1)a), etc.).¶
ANSI standard three↑↓
Undefined expressions are expressions for which the value of the expression is not defined. Undefined expressions are a completely separate concept from the truth value UNKNOWN, which is, in fact, well defined. Property names and literal constants are considered expressions for purposes of this section. If a property in the current resource under scan has not been set to a value, then the value of that property is undefined for the resource under scan. 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, the whole arithmetic, string, or datetime subexpression is undefined.¶
There are no manifest constants to explicitly represent undefined number, string, or datetime values.¶
Since a Boolean value is ultimately returned by the search condition, arithmetic, string, and datetime expressions are always arguments to other operators. Examples of operators that convert arithmetic, string, and datetime expressions to Boolean values are the six relational operators ("greater than", "less than", "equals", etc.). If either or both operands of a relational operator have undefined values, then the relational operator evaluates to UNKNOWN. Otherwise, the relational operator evaluates to TRUE or FALSE, depending upon the outcome of the comparison.¶
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¶
Section summarizes issues ↑↓ which have been raised during the development of this specification, but for which no resolution could be found with the constraints in place. Future revisions of this specification should revisit these issues, though.¶
Matching and sorting of textual data relies on collations. With respect to WebDAV SEARCH, a combination of various design approaches could be used: ¶
In practice, the current implementations of WebDAV SEARCH usually rely on backends they do not control, and for which collation information may not be available. To make things worse, implementations of the DAV:basicsearch grammar frequently need to combine data from multiple underlying stores (such as properties and full text content), and thus collation support may vary based on the operator or property.¶
Another open issue is what collation formalism to support. At the time of this writing, the two specifications below seem to provide the necessary framework and thus may be the base for future work on collation support in WebDAV SEARCH: ¶
DAV:basicsearch does not 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.¶
Matching media types using the DAV:getcontenttype property and the DAV:like operator is hard due to DAV:getcontenttype also allowing parameters. A new operator specifically designed for the purpose of matching media types probably would simplify things a lot. See <http://lists.w3.org/Archives/Public/www-webdav-dasl/2003OctDec/0109.html> for a specific proposal.¶
DAV:basicsearch operates on the properties (and optionally the contents) of resources, and thus doesn't really allow matching on parts of the resource's URI. See <http://lists.w3.org/Archives/Public/www-webdav-dasl/2003OctDec/0100.html> for a proposed extension covering this use case.¶
A frequently discussed feature is the ability to specifically request the "next" set of results, when either the server decided to truncate the result, or the client explicitly asked for a limited set (for instance, using the DAV:limit element defined in Section 5.17).¶
In this case, it would be desirable if the server could keep the full query result, and provide a new URI identifying a separate result resource, allowing the client to retrieve additional data through GET requests, and remove the result through a DELETE request.¶
Update: draft-newman-i18n-comparator-14 is RFC4790. Update: RFC2518 replaced by draft-ietf-webdav-rfc2518bis. Updated BIND reference. Minor tweaks to intro (document organization and relation to DASL).
Update: draft-ietf-webdav-rfc2518bis replaced by RFC4918. Updated BIND reference.
Open and close issue "qsd-req-validity". Updated BIND reference.
RFC4234 obsoleted by RFC5234.
Add and resolve issues "5.19.8-opdesc-vs-contains" and "dtd".
Add clarifications about the behaviour when literal values are not compatible with the type of a comparison.
Minor editorial improvements.
Fix description of DAV:scope/DAV:href to use proper URI terminology, add reference to RFC 3986.
Clarify list nature of DASL header.
Clarify that the DAV:like pattern ABNF is defined in terms of Unicode code points.
Update to UNICODE5.
Aim for standards track (affects introduction to Appendix B). Thus, make the dependency on [RFC4437] clearly optional, and make the reference informative. Also, mention BCP 47 as candidate for future changes to language matching.
Mention definition of additional condition codes as candidate for future changes.
Consider DAV:contains in Security Considerations.
Update Surendra's and Alan's contact information.
Mention search scope discovery as future extensions. Add a SHOULD level requirement for DAV:basicsearch search arbiters to support their own URI as search scope.
In DASL header registration tepmplate, set "Status" to "standard".
Add missing bracket in DTD (Section 4.1). Fix broken and missing XML namespace declarations in examples.
Typo fixed ("SHOULD not" -> "SHOULD NOT"). Fixed namespace name "http://jennicam.org" to use a RFC 2606 compliant domain.
State that SEARCH is a safe method.
Clarify that the DASL header should be added to the permanent registry.
Add and resolve issue "ordering-vs-limiting".
Copyright © The IETF Trust (2008).
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an “AS IS” basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at email@example.com.