WEBDAV DASL Working Group | J. Reschke |
Internet-Draft | greenbytes |
Intended status: Informational | S. Reddy |
Expires: September 2002 | Oracle |
J. Davis | |
Intelligent Markets | |
A. Babich | |
Filenet | |
March 2002 |
This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026.¶
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 September 2002.¶
Copyright © The Internet Society (2002). All Rights Reserved.¶
1 This document specifies a set of methods, headers, and content-types composing DASL, an application of the HTTP/1.1 protocol to efficiently search for DAV resources based upon a set of client-supplied criteria.¶
2 Distribution of this document is unlimited. Please send comments to the Distributed Authoring and Versioning (WebDAV) working group at w3c-dist-auth@w3.org, which may be joined by sending a message with subject "subscribe" to w3c-dist-auth-request@w3.org.¶
3 Discussions of the WEBDAV working group are archived at URL: http://lists.w3.org/Archives/Public/w3c-dist-auth/.¶
4 This document specifies a set of methods, headers, properties and content-types composing WebDAV SEARCH, an application of the HTTP/1.1 protocol to efficiently search for DAV resources based upon a set of client-supplied criteria.¶
5 Distribution of this document is unlimited. Please send comments to the Distributed Authoring and Versioning (WebDAV) DASL working group at www-webdav-dasl@w3.org, which may be joined by sending a message with subject "subscribe" to www-webdav-dasl-request@w3.org.¶
6 Discussions of the WEBDAV DASL working group are archived at URL: http://www.w3.org/pub/WWW/Archives/Public/www-webdav-dasl/.¶
7 This document defines WebDAV SEARCH, an application of HTTP/1.1 forming a lightweight search protocol to transport queries and result sets and allows clients to make use of server-side search facilities. It is based on the expired draft for WebDAV DASL [DASL]. [DASLREQ] describes the motivation for DASL.¶
9 DASL will minimize the complexity of clients so as to facilitate widespread deployment of applications capable of utilizing the DASL search mechanisms.¶
10 DASL consists of: ¶
17 <ed:ins>
20 The augmented BNF used by this document to describe protocol elements is exactly the same as the one described in Section 2.1 of [RFC2616]. Because this augmented BNF uses the basic production rules provided in Section 2.2 of [RFC2616], those rules apply to this document as well.¶
21 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].¶
22 <ed:issue>
23 <ed:ins>
24 <ed:ins>
25 One can express the basic usage of DASL in the following steps: ¶
30 The client invokes the SEARCH method to initiate a server-side search. The body of the request defines the query. The server MUST emit <ed:ins>
31 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.¶
32 The client invokes the SEARCH method on the resource named by the Request-URI.¶
33 The Request-URI identifies the search arbiter. <ed:ins>
34 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, the FOO query grammar may force the request-URI to correspond exactly to the search scope.¶
35 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.¶
36 If the client sends a text/xml or application/xml body, it MUST include the DAV:searchrequest XML element. The DAV:searchrequest XML element identifies the query grammar, defines the criteria, the result record, and any other details needed to perform the search.¶
<!ELEMENT searchrequest ANY >
37 The DAV:searchrequest XML element contains a single XML element that defines the query. The name of the query element defines the type of the query. The value of that element defines the query itself.¶
38 If the server returns 207 (Multistatus), then the search proceeded successfully and the response MUST match that of a PROPFIND. <ed:ins>
39 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.¶
40 In addition, the server MAY include DAV:response items in the reply where the DAV:href element contains a URI that is not a matching resource, e.g. that of a scope or the query arbiter. Each such response item MUST NOT contain a DAV:propstat element, and MUST contain a DAV:status <ed:ins>
41 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.¶
42 This example demonstrates the request and response framework. The following XML document shows a simple (hypothetical) natural language query. <ed:del>
43 >> Request:
SEARCH / HTTP/1.1 Host: ryu.com Content-Type: application/xml Content-Length: xxx <?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>
44 >> Response:
HTTP/1.1 207 Multi-Status Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <D:multistatus xmlns:D="DAV:" xmlns:F="http://example.com/foo" xmlns:R="http://ryu.com/propschema"> <D:response> <D:href>http://siamiam.com/</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:propstat> </D:response> </D:multistatus>
45 >> Response:
HTTP/1.1 207 Multi-Status Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <D:multistatus xmlns:D="DAV:" xmlns:R="http://ryu.com/propschema"> <D:response> <D:href>http://siamiam.com/</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:propstat> </D:response> </D:multistatus>
46 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.¶
47 When a result set is truncated, there may be many more resources that satisfy the search criteria but that were not examined.¶
48 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.¶
49 Note that the partial results returned MAY be any subset of the result set that would have satisfied the original query.¶
50 >> Request:
SEARCH / HTTP/1.1 Host: gdr.com Content-Type: text/xml; charset="utf-8" Content-Length: xxx ... the query goes here ...
51 >> Response:
HTTP/1.1 207 Multistatus Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="utf-8"?> <D:multistatus xmlns:D="DAV:"> <D:response> <D:href>http://www.gdr.com/sounds/unbrokenchain.au</D:href> <D:propstat> <D:prop/> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> <D:response> <D:href>http://tech.mit.edu/archive96/photos/Lesh1.jpg</D:href> <D:propstat> <D:prop/> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> <D:response> <D:href>http://gdr.com</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>
52 If an error occurred that prevented execution of the query, the server MUST indicate the failure with the appropriate status code and SHOULD include a DAV:multistatus element to point out errors associated with scopes.¶
53 400 Bad Request. The query could not be executed. The request may be malformed (not valid XML for example). Additionally, this can be used for invalid scopes and search redirections.¶
54 422 Unprocessable entity. The query could not be executed. If a <ed:ins>
55 507 (Insufficient Storage). The query produced more results than the server was willing to transmit. Partial results have been transmitted. The server MUST send a body that matches that for 207, except that there MAY exist resources that matched the search criteria for which no corresponding DAV:response exists in the reply.¶
56 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 507. It SHOULD include the partial results.¶
57 When a result set is truncated, there may be many more resources that satisfy the search criteria but that were not examined.¶
58 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.¶
59 Note that the partial results returned MAY be any subset of the result set that would have satisfied the original query.¶
60 >> Request:
SEARCH / HTTP/1.1 Host: gdr.com Content-Type: application/xml Content-Length: xxxxx <?xml version="1.0" encoding="UTF-8"?> <D:searchrequest xmlns:D="DAV:"> <D:basicsearch> ... the query goes here ... </D:basicsearch> </D:searchrequest>
61 >> Response:
HTTP/1.1 507 Insufficient Storage Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <D:multistatus xmlns:D="DAV:"> <D:response> <D:href>http://www.gdr.com/sounds/unbrokenchain.au</D:href> <D:propstat> <D:prop/> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> <D:response> <D:href>http://tech.mit.edu/archive96/photos/Lesh1.jpg</D:href> <D:propstat> <D:prop/> <D:status>HTTP/1.1 200 OK</D:status> </D:propstat> </D:response> <D:response> <D:href>http://gdr.com</D:href> <D:status>HTTP/1.1 507 Insufficient Storage</D:status> <D:responsedescription> Only first two matching records were returned </D:responsedescription> </D:response> </D:multistatus>
62 A client may submit a scope that the arbiter may be unable to query. The inability to query may be due to network failure, administrative policy, security, etc. This raises the condition described as an "invalid scope".¶
63 To indicate an invalid scope, the server MUST respond with a 400 (Bad Request).¶
64 The response includes a <ed:del>
65 >> Response:
HTTP/1.1 400 Bad-Request Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <d:multistatus xmlns:d="DAV:"> <d:response> <d:href>http://www.foo.com/X</d:href> <d:status>HTTP/1.1 404 Object Not Found</d:status> <d:scopeerror/> </d:response> </d:multistatus>
66 Servers MUST support discovery of the query grammars supported by a search arbiter resource.¶
67 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.¶
68 <ed:ins>
71 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.¶
72 The client issues the OPTIONS method against a resource named by the Request-URI. This is a normal invocation of OPTIONS defined in [RFC2616].¶
73 If a resource supports the SEARCH method, then the server MUST list SEARCH in the OPTIONS response as defined by [RFC2616].¶
74 DASL servers MUST include the DASL header in the OPTIONS response. This header identifies the search grammars supported by that resource.¶
75 >> Response:
DASLHeader = "DASL" ":" Coded-URL-List Coded-URL-List : Coded-URL [ "," Coded-URL-List ] Coded-URL ; defined in section 9.4 of [RFC2518]
76 <ed:issue>
77 This header MAY be repeated.¶
78 For example:
DASL: <http://foo.bar.com/syntax1> DASL: <http://akuma.com/syntax2> DASL: <DAV:basicsearch> DASL: <http://example.com/foo/natural-language-query>
79 This WebDAV property is required for any server supporting either [RFC3253] and/or [ACL] and identifies the XML based query grammars that are supported by the search arbiter resource.¶
<!ELEMENT supported-query-grammar-set (supported-query-grammar*)> <!ELEMENT supported-query-grammar grammar> <!ELEMENT grammar ANY>
80 ANY value: a query grammar element type¶
81 This example shows that the server supports search on the /somefolder resource with the query grammars: DAV:basicsearch, http://foo.bar.com/syntax1 and http://akuma.com/syntax2. Note that every server MUST support DAV:basicsearch.¶
82 >> Request:
OPTIONS /somefolder HTTP/1.1 Host: ryu.com
83 >> Response:
HTTP/1.1 200 OK Date: Tue, 20 Jan 1998 20:52:29 GMT Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH DASL: <DAV:basicsearch> DASL: <http://foo.bar.com/syntax1> DASL: <http://akuma.com/syntax2>
84 This example shows the equivalent taking advantage of a server's support for DAV:supported-method-set and DAV:supported-query-grammar-set.¶
85 >> Request:
PROPFIND /somefolder HTTP/1.1 Host: ryu.com Depth: 0 Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8" ?> <propfind xmlns="DAV:"> <prop> <supported-query-grammar-set/> <supported-method-set/> </prop> </propfind>
86 >> Response:
HTTP/1.1 207 Multi-Status Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="utf-8" ?> <multistatus xmlns="DAV:"> <response> <href>http://ryu.com/somefolder</href> <propstat> <prop> <supported-query-grammar-set> <supported-query-grammar> <grammar><basicsearch/></grammar> </supported-query-grammar> <supported-query-grammar> <grammar><syntax1 xmlns="http://foo.bar.com" /></grammar> </supported-query-grammar> <supported-query-grammar> <grammar><syntax2 xmlns="http://akuma.com/"/></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>
87 Note that the query grammar element names marshalled as part of the DAV:supported-query-grammar-set can be directly used as element names in an XML based query.¶
88 Servers MAY support the discovery of the schema for a query grammar.¶
89 The DASL response header provides 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 a 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.¶
90 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 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.¶
91 <ed:issue>
92 The query schema for DAV:basicsearch is defined in Section 5.18.¶
<!ELEMENT queryschema ANY >
93 In this example, the arbiter is recipes.com, the grammar is DAV:basicsearch, the scope is also recipes.com.¶
94 >> Request:
<ed:issue>SEARCH / HTTP/1.1 Host: recipes.com Content-Type: application/xml Content-Length: xxx <?xml version="1.0"?> <D:searchrequest xmlns:D="DAV:" > <D:basicsearch> <D:select> <D:queryschema/> </D:select> <D:from> <D:scope> <D:href>http://recipes.com</D:href> </D:scope> </D:from> </D:basicsearch> </D:searchrequest>
95 >> Request:
SEARCH / HTTP/1.1 Host: recipes.com Content-Type: application/xml Content-Length: xxx <?xml version="1.0"?> <searchrequest xmlns="DAV:"> <basicsearch> <select> <prop> <queryschema/> </prop> </select> <from> <scope> <href>http://recipes.com</href> </scope> </from> </basicsearch> </searchrequest>
96 >> Request:
<ed:issue>HTTP/1.1 207 Multistatus Content-Type: application/xml Content-Length: xxx <?xml version="1.0"?> <D:multistatus xmlns:D="DAV:"> <D:response> <D:href>http://recipes.com</D:href> <D:propstat> <D:prop> <D:querygrammar> <D:basicsearchschema> /See section 5.19.9 for actual contents) </D:basicsearchschema> </D:querygrammar> </D:prop> <D:status>HTTP/1.1 200 Okay</D:status> </D:propstat> </D:response> </D:multistatus>
97 >> Response:
HTTP/1.1 207 Multistatus Content-Type: application/xml Content-Length: xxx <?xml version="1.0"?> <multistatus xmlns="DAV:"> <response> <href>http://recipes.com</href> <propstat> <prop> <queryschema> <basicsearchschema> (See section "Query schema for DAV:basicsearch" for the actual contents) </basicsearchschema> </queryschema> </prop> <status>HTTP/1.1 200 OK</status> </propstat> </response> </multistatus>
98 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 others grammars.¶
99 DAV:basicsearch has several components:¶
<!ELEMENT basicsearch (select, from, where?, orderby?, limit?) > <!ELEMENT select (allprop | prop) > <!ELEMENT from (scope) > <!ELEMENT scope (href, depth?) > <!ENTITY %comp_ops "eq | lt | gt| lte | gte"> <!ENTITY %log_ops "and | or | not"> <!ENTITY %special_ops "isdefined"> <!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 ) > <!ATTLIST lt casesensitive (1|0) "1" > <!ELEMENT lte ( prop , literal ) > <!ATTLIST lte casesensitive (1|0) "1" > <!ELEMENT gt ( prop , literal) > <!ATTLIST gt casesensitive (1|0) "1" > <!ELEMENT gte ( prop , literal ) > <!ATTLIST gte casesensitive (1|0) "1" > <!ELEMENT eq ( prop , literal ) > <!ATTLIST eq casesensitive (1|0) "1" > <!ELEMENT literal (#PCDATA)> <!ATTLIST literal xml:space (default|preserve) preserve > <!ELEMENT isdefined (prop) > <!ELEMENT like (prop, literal) > <!ATTLIST like casesensitive (1|0) "1" > <!ELEMENT contains (#PCDATA)> <!ELEMENT orderby (order+) > <!ELEMENT order (prop, (ascending | descending)?) <!ATTLIST order casesensitive (1|0) "1" > <!ELEMENT ascending EMPTY> <!ELEMENT descending EMPTY> <!ELEMENT limit (nresults) > <!ELEMENT nresults (#PCDATA) >
<!ELEMENT basicsearch (select, from, where?, orderby?, limit?) > <!ELEMENT select (allprop | prop) > <!ELEMENT from (scope) > <!ELEMENT scope (href, depth) > <!ENTITY %comp_ops "eq | lt | gt| lte | gte"> <!ENTITY %log_ops "and | or | not"> <!ENTITY %special_ops "is-collection | isdefined"> <!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 ) > <!ATTLIST lt casesensitive (1|0) "1" > <!ELEMENT lte ( prop , literal ) > <!ATTLIST lte casesensitive (1|0) "1" > <!ELEMENT gt ( prop , literal) > <!ATTLIST gt casesensitive (1|0) "1" > <!ELEMENT gte ( prop , literal ) > <!ATTLIST gte casesensitive (1|0) "1" > <!ELEMENT eq ( prop , literal ) > <!ATTLIST eq casesensitive (1|0) "1" > <!ELEMENT literal (#PCDATA)> <!ELEMENT isdefined (prop) > <!ELEMENT like (prop, literal) > <!ATTLIST like casesensitive (1|0) "1" > <!ELEMENT contains (#PCDATA)> <!ELEMENT orderby (order+) > <!ELEMENT order (prop, (ascending | descending)?) <!ATTLIST order casesensitive (1|0) "1" > <!ELEMENT ascending EMPTY> <!ELEMENT descending EMPTY> <!ELEMENT limit (nresults) > <!ELEMENT nresults (#PCDATA) >
106 This query retrieves the content length values for all resources located under the server's "/container1/" URI namespace whose length exceeds 10000.¶
<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>
107 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 [RFC2518].¶
108 If the value is DAV:allprop, the result record for a given resource includes all the properties for that resource.¶
109 If the value is DAV:prop, then the result record for a given resource includes only those properties named by the DAV:prop element. Each property named by the DAV:prop element must be referenced in the Multistatus response.¶
111 DAV:from defines the query scope. This contains exactly one DAV:scope element. <ed:del>
112 DAV:href indicates the URI for a collection to use as a scope.¶
113 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 (toplevel) members of the collection. When it is "infinity", the search includes all recursive members of the collection.¶
114 If the DAV:scope element is an absolute URI, the scope is exactly that URI.¶
115 If the DAV:scope element is <ed:del>
116 A Scope can be an arbitrary URI.¶
117 Servers, of course, may support only particular scopes. This may include limitations for particular schemes such as "http:" or "ftp:" or certain URI namespaces.¶
118 If a scope is given that is not supported the server MUST respond with a 400 status code that includes a Multistatus error. A scope in the query appears as a resource in the response and must include an appropriate status code indicating its validity with respect to the search arbiter.¶
119 Example:
HTTP/1.1 400 Bad Request Content-Type: text/xml; charset="utf-8" Content-Length: xxx <?xml version="1.0" encoding="UTF-8"?> <d:multistatus xmlns:d="DAV:"> <d:response> <d:href>http://www.foo.com/scope1</d:href> <d:status>HTTP/1.1 502 Bad Gateway</d:status> </d:response> </d:multistatus>
120 This example shows the response if there is a scope error. The response provides a Multistatus with a status for the scope. In this case, the scope cannot be reached because the server cannot search another server (502).¶
121 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.¶
122 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.¶
123 Consult Appendix A for details on the application of three-valued logic in query expressions.¶
124 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.¶
125 If a PROPFIND for a property value would yield a 404 or 403 response for that property, then that property is considered NULL.¶
126 NULL values are "less than" all other values in comparisons.¶
127 Empty strings (zero length strings) are not NULL values. An empty string is "less than" a string with length greater than zero.¶
128 The DAV:isdefined operator is defined to test if the value of a property is NULL.¶
129 Comparisons of properties that do not have simple types (text-only content) is out-of-scope for DAV:basicsearch. For querying the DAV:resourcetype property, see Section 5.1.¶
130 The example shows a single operator (DAV:eq) applied in the criteria.¶
<d:where> <d:eq> <d:prop> <d:getcontentlength/> </d:prop> <d:literal> 100 </d:literal> </d:eq> </d:where>
<d:where> <d:eq> <d:prop> <d:getcontentlength/> </d:prop> <d:literal>100</d:literal> </d:eq> </d:where>
131 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 that are "image/gifs" over 4K in size.¶
<D:where> <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>
<D:where> <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>
132 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.¶
133 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.¶
134 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 (<ed:ins>
135 Comparisons on strings take into account the language defined for that property. Clients MAY specify the language using the xml:lang attribute. If no language is specified either by the client or defined for that property by the server or if a comparison is performed on strings of two different languages, the results are undefined.¶
136 <ed:issue>
137 This sort orders first by last name of the author, and then by size, in descending order, so that the largest works appear first.¶
<d:orderby> <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>
138 The DAV:and operator performs a logical AND operation on the expressions it contains.¶
139 The DAV:or operator performs a logical OR operation on the values it contains.¶
140 The DAV:not operator performs a logical NOT operation on the values it contains.¶
141 The DAV:eq operator provides simple equality matching on property values.¶
142 The DAV:casesensitive attribute may be used with this element.¶
143 The DAV:lt, DAV:lte, DAV:gt, and DAV:gte operators provide comparisons on property values, using less-than, less-than or equal, greater-than, and greater-than or equal respectively. The DAV:casesensitive attribute may be used with these elements.¶
144 DAV:literal allows literal values to be placed in an expression.¶
145 <ed:del>
146 The DAV:is-collection operator allows clients to determine whether a resource is a collection (that is, whether it's DAV:resourcetype element contains the element DAV:collection).¶
147 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. <ed:issue>
148 This example shows a search criterion that picks out all and only the resources in the scope that are collections.¶
<where xmlns="DAV:"> <is-collection/> </where>
149 The DAV:isdefined operator allows clients to determine whether a property is defined on a resource. The meaning of "defined on a resource" is found in Section 5.5.3.¶
150 Example:¶
<d:isdefined> <d:prop><x:someprop/></d:prop> </d:isdefined>
151 The DAV:isdefined operator is optional.¶
152 The DAV:like is an optional operator intended to give simple wildcard-based pattern matching ability to clients.¶
153 The operator takes two arguments.¶
154 The first argument is a DAV:prop element identifying a single property to evaluate.¶
155 The second argument is a DAV:literal element that gives the pattern matching string.¶
Pattern := [wildcard] 0*( text [wildcard] ) wildcard := exactlyone | zeroormore text := 1*( <octet> | escapesequence ) exactlyone : = "?" zeroormore := "%" escapechar := "\" escapesequence := "\" ( exactlyone | zeroormore | escapechar )
Pattern := [wildcard] 0*( text [wildcard] ) wildcard := exactlyone | zeroormore text := 1*( <character> | escapesequence ) exactlyone : = "?" zeroormore := "%" escapechar := "\" escapesequence := "\" ( exactlyone | zeroormore | escapechar ) character: see section 2.2 of [XML]
156 The value for the literal is composed of wildcards separated by segments of text. Wildcards may begin or end the literal. Wildcards may not be adjacent.¶
157 The "?" wildcard matches exactly one character.¶
158 The "%" wildcard matches zero or more characters¶
159 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..¶
160 This example shows how a client might use DAV:like to identify those resources whose content type was a subtype of image.¶
<D:where> <D:like> <D:prop><D:getcontenttype/></D:prop> <D:literal>image%</D:literal> </D:like> </D:where>
161 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.¶
162 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.¶
163 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 left to the server.¶
164 The following things 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.¶
165 The DAV:score property is intended to be useful to rank documents satisfying the DAV:contains operator.¶
166 The example below shows a search for the phrase "Peter Forsberg".¶
167 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> <D:contains>Peter Forsberg</D:contains> </D:where>
168 The example below shows a search for resources that contain "Peter" and "Forsberg".¶
<D:where> <D:and> <D:contains>Peter</D:contains> <D:contains>Forsberg</D:contains> </D:and> </D:where>
<!ELEMENT limit (nresults) >
169 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.¶
<!ELEMENT nresults (#PCDATA)> ;only digits
170 The DAV:nresults XML element contains a requested maximum number of records to be returned in a reply. The server MAY disregard this limit. The value of this element is an integer.¶
171 <ed:issue>
172 The possible values for DAV:casesensitive are "1" or "0". The "1" value indicates case-sensitivity. The "0" value indicates case-insensitivity. The default value is server-specified. <ed:ins>
173 Support for the DAV:casesensitive is optional. A server should respond with an error 422 if the DAV:casesensitive attribute is used but cannot be supported.¶
<!ELEMENT score (#PCDATA)>
174 The DAV:score XML element is a synthetic property whose value is defined only in the context of a query result where the server computes a score, e.g. based on relevance. It may be used in DAV:select or DAV:orderby elements. Servers SHOULD support this property. 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).¶
175 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.¶
<!ELEMENT iscollection (#PCDATA)>
176 The DAV:iscollection XML element is a synthetic property whose value is defined only in the context of a query.¶
177 The property is TRUE (the literal string "1") of a resource if and only if a PROPFIND of the DAV:resourcetype property for that resource would contain the DAV:collection XML element. The property is FALSE (the literal string "0") otherwise.¶
178 Rationale: This property 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. <ed:issue>
179 This example shows a search criterion that picks out all and only the resources in the scope that are collections.¶
<D:where> <D:eq> <D:prop><D:iscollection></D:prop> <D:literal>1<D:literal> </D:eq> </D:where>
180 <ed:issue>
<!ELEMENT basicsearchschema (properties, operators)> <!ELEMENT properties (propdesc*)> <!ELEMENT propdesc (prop, ANY)> <!ELEMENT operators (opdesc*)> <!ELEMENT opdesc ANY> <!ELEMENT operand_property EMPTY> <!ELEMENT operand_literal EMPTY>
<!ELEMENT basicsearchschema (properties, operators)> <!ELEMENT any-other-property EMPTY> <!ELEMENT properties (propdesc*)> <!ELEMENT propdesc (prop|any-other-property), datatype?, searchable?, selectable?, sortable?, casesensitive?)> <!ELEMENT operators (opdesc*)> <!ELEMENT opdesc ANY> <!ELEMENT operand-literal EMPTY> <!ELEMENT operand-property EMPTY>
184 <ed:issue>
185 The DAV:operators element describes the optional operators that may be used in a DAV:where element.¶
186 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.¶
187 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:casesensitive) 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.¶
188 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).¶
189 <ed:issue>
<!ELEMENT datatype ANY >
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
191 DASL defines the following data type elements:¶
Name Example boolean 1, 0 string Foobar dateTime.iso8601tz 1994-11-05T08:15:5Z float .314159265358979E+1 int -259, 23
192 If the data type of a property is not given, then the data type defaults to <ed:ins>
<!ELEMENT searchable EMPTY>
193 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>
194 This element indicates that the property may appear in the DAV:select element.¶
195 This element indicates that the property may appear in the DAV:orderby element.¶
<!ELEMENT sortable EMPTY>
196 This element only applies to properties whose data type is "<ed:ins>
<!ELEMENT casesensitive EMPTY>
197 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 consists of the operator (as an empty element), followed by one element for each operand. The operand MUST be either <ed:del>
<D:propdesc> <D:like/><D:operand_property/><D:operand_literal/> </D:propdesc>
<operators xmlns='DAV:'> <opdesc> <like/><operand-property/><operand-literal/> </opdesc> </operators>
<D:basicsearchschema xmlns:D="DAV:" xmlns:t="urn:uuid:C2F41010-65B3-11d1-A29F-00AA00C14882/" xmlns:J="http://jennicam.org"> <D:properties> <D:propdesc> <D:prop><D:getcontentlength/></D:prop> <D:datatype><t:int/></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><J:fstop/></D:prop> <D:selectable/> </D:propdesc> </D:properties> <D:operators> <D:opdesc> <D:isdefined/><D:operand_property/> </D:opdesc> <D:opdesc> <D:like/><D:operand_property/><D:operand_literal/> </D:opdesc> </D:operators> </D:basicsearchschema>
<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://jennicam.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:isdefined/><D:operand-property/> </D:opdesc> <D:opdesc> <D:like/><D:operand-property/><D:operand-literal/> </D:opdesc> </D:operators> </D:basicsearchschema>
198 This response lists four properties. The datatype of the last three properties is not given, so it defaults to <ed:ins>
199 Note: The schema discovery defined here does not provide for discovery of supported values of the DAV:casesensitive attribute. This may require that the reply also list the mandatory operators.¶
200 Clients have the opportunity to tag properties when they are stored in a language. The server SHOULD read this language-tagging by examining the xml:lang attribute on any properties stored on a resource.¶
201 The xml:lang attribute specifies a nationalized collation sequence when properties are compared.¶
202 Comparisons when this attribute differs have undefined order.¶
203 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 also apply to DASL. In addition, this section will include security risks inherent in searching and retrieval of resource properties and content.¶
204 A query must not allow one to retrieve information about values or existence of properties that one could not obtain via PROPFIND. (e.g. by use in DAV:orderby, or in expressions on properties.)¶
205 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. 7.1 Implications of XML External Entities¶
206 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.¶
207 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.¶
208 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.¶
209 Query grammars are identified by URIs. Applications SHOULD not attempt to retrieve these URIs even if they appear to be retrievable (for example, those that begin with "http://")¶
210 Authentication mechanisms defined in WebDAV will also apply to DASL.¶
212 To be supplied.¶
213 To be supplied.¶
219 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.).¶
220 ANSI standard three valued logic is undoubtedly the most widely practiced method of dealing with the issues of properties in the search condition not having a value (e.g., being null or not defined) for the resource under scan, and with undefined expressions in the search condition (e.g., division by zero, etc.). Three valued logic works as follows.¶
221 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 (either because the property is not defined for the current resource, or because it is null for the current resource), 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.¶
222 If any subpart of an arithmetic, string, or datetime subexpression is undefined, the whole arithmetic, string, or datetime subexpression is undefined.¶
223 There are no manifest constants to explicitly represent undefined number, string, or datetime values.¶
224 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.¶
225 The Boolean operators DAV:and, DAV:or and DAV:not are evaluated according to the following rules:¶
226 UNKNOWN and UNKNOWN = UNKNOWN¶
227 UNKNOWN or UNKKNOWN = UNKNOWN¶
228 not UNKNOWN = UNKNOWN¶
229 UNKNOWN and TRUE = UNKNOWN¶
230 UNKNOWN and FALSE = FALSE¶
231 UNKNOWN and UNKNOWN = UNKNOWN¶
232 UNKNOWN or TRUE = TRUE¶
233 UNKNOWN or FALSE = UNKNOWN¶
234 UNKNOWN or UNKNOWN = UNKNOWN¶
Copyright © The Internet Society (2002). All Rights Reserved.¶
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.¶
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.¶
This document and the information contained herein is provided on an “AS IS” basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS 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 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; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP-11. Copies of claims of rights made available for publication 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 implementors or users of this specification can be obtained from the IETF Secretariat.¶
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director.¶