Internet DRAFT - draft-godoy-webdav-xmlsearch

draft-godoy-webdav-xmlsearch






Network Working Group                                         R J. Godoy
Internet-Draft                                                  H. Minni
Intended status: Experimental           Universidad Nacional del Litoral
Expires: August 28, 2008                               February 25, 2008


               A WebDAV Search Grammar for XML Properties
                    draft-godoy-webdav-xmlsearch-02

Status of This Memo

   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 on August 28, 2008.

Copyright Notice

   Copyright (C) The IETF Trust (2008).

Abstract

   This document specifies xml-search, a search grammar for use with the
   Web Distributed Authoring and Versioning (WebDAV) SEARCH protocol.
   It extends the DAV:basicsearch grammar with XPath expressions that
   are evaluated on resources' properties whose values are XML
   fragments.

   The full expression power of XPath may exceed the requirement in
   simple use cases; therefore, some provisions are made in order to



Godoy & Minni            Expires August 28, 2008                [Page 1]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   reduce the computational cost of evaluating allowed queries.

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
     1.1.  Notational conventions . . . . . . . . . . . . . . . . . .  4
     1.2.  Terms  . . . . . . . . . . . . . . . . . . . . . . . . . .  5
     1.3.  Overview . . . . . . . . . . . . . . . . . . . . . . . . .  6
     1.4.  WXS:xml-search and the PROPFIND response . . . . . . . . .  7
   2.  XPath  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
     2.1.  Static and Dynamic Contexts  . . . . . . . . . . . . . . .  8
     2.2.  Error and warnings . . . . . . . . . . . . . . . . . . . . 10
       2.2.1.  Warnings . . . . . . . . . . . . . . . . . . . . . . . 10
       2.2.2.  Errors (in SAP)  . . . . . . . . . . . . . . . . . . . 11
       2.2.3.  Errors (in DEP)  . . . . . . . . . . . . . . . . . . . 11
     2.3.  Numeric Predicates . . . . . . . . . . . . . . . . . . . . 12
   3.  Discovery of the Query Grammar . . . . . . . . . . . . . . . . 13
     3.1.  The DASL Response Header . . . . . . . . . . . . . . . . . 13
     3.2.  DAV:supported-query-grammar-set  . . . . . . . . . . . . . 13
     3.3.  Discovery of the WXS:xml-search Query Schema . . . . . . . 14
   4.  The WXS:xml-search Grammar . . . . . . . . . . . . . . . . . . 15
     4.1.  Accepted Role Precondition . . . . . . . . . . . . . . . . 16
     4.2.  Selection  . . . . . . . . . . . . . . . . . . . . . . . . 17
     4.3.  Query criteria . . . . . . . . . . . . . . . . . . . . . . 18
       4.3.1.  DAV:prop operand . . . . . . . . . . . . . . . . . . . 19
       4.3.2.  Literal Operands . . . . . . . . . . . . . . . . . . . 19
       4.3.3.  Relational operators . . . . . . . . . . . . . . . . . 19
       4.3.4.  The WXS:filter operator  . . . . . . . . . . . . . . . 20
       4.3.5.  The WXS:is-well-formed operator  . . . . . . . . . . . 20
     4.4.  Ordering . . . . . . . . . . . . . . . . . . . . . . . . . 20
     4.5.  SEARCH Status Codes for responses to WXS:xml-search
           queries  . . . . . . . . . . . . . . . . . . . . . . . . . 21
     4.6.  Status Codes for Use in 'response' Elements  . . . . . . . 22
     4.7.  Status Codes for Use in 'propstat' Elements  . . . . . . . 22
     4.8.  Precondition and postcondition Codes . . . . . . . . . . . 22
       4.8.1.  WXS:property-must-be-well-formed-xml . . . . . . . . . 22
       4.8.2.  WXS:acceptable-role  . . . . . . . . . . . . . . . . . 23
       4.8.3.  WXS:XPath-error  . . . . . . . . . . . . . . . . . . . 23
       4.8.4.  DAV:search-scope-valid . . . . . . . . . . . . . . . . 23
       4.8.5.  WXS:known-literal-type . . . . . . . . . . . . . . . . 23
   5.  Query Schema for WXS:xml-search  . . . . . . . . . . . . . . . 24
     5.1.  Property descriptions  . . . . . . . . . . . . . . . . . . 24
     5.2.  Operator descriptions  . . . . . . . . . . . . . . . . . . 25
       5.2.1.  WXS:opdesc-rule and WXS:operator . . . . . . . . . . . 26
       5.2.2.  WXS:repetition . . . . . . . . . . . . . . . . . . . . 27
       5.2.3.  WXS:alternative  . . . . . . . . . . . . . . . . . . . 28
       5.2.4.  Implied operator description . . . . . . . . . . . . . 28
       5.2.5.  Extended operator description for
               DAV:typed-literal Operand  . . . . . . . . . . . . . . 29


Godoy & Minni            Expires August 28, 2008                [Page 2]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


       5.2.6.  Description of DAV:like Operator . . . . . . . . . . . 30
     5.3.  Supporting Optional Functions  . . . . . . . . . . . . . . 30
   6.  XML Extensibility  . . . . . . . . . . . . . . . . . . . . . . 32
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 33
   8.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 34
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 34
     9.1.  Normative References . . . . . . . . . . . . . . . . . . . 34
     9.2.  Informative References . . . . . . . . . . . . . . . . . . 36
   Editorial Comments . . . . . . . . . . . . . . . . . . . . . . . .
   Appendix A.  Example WXS:xml-search query  . . . . . . . . . . . . 39
   Appendix B.  Reported Issues . . . . . . . . . . . . . . . . . . . 40
     B.1.  Editorial Issues . . . . . . . . . . . . . . . . . . . . . 40
     B.2.  Technical Issues . . . . . . . . . . . . . . . . . . . . . 41
   Appendix C.  Change log (To be removed by RFC Editor before
                publication)  . . . . . . . . . . . . . . . . . . . . 42
     C.1.  changes in draft-godoy-webdav-xmlsearch-01 . . . . . . . . 42
     C.2.  changes in draft-godoy-webdav-xmlsearch-02 . . . . . . . . 42
   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42


Note

   Discussion about this draft should be addressed via
   <www-webdav-dasl@w3.org>.

   The latest version of this document can be accessed at
   <http://purl.net/rjgodoy/webdav-xmlsearch-latest>.



   
   
   
   
   
   
   
   
   
   
   
   









Godoy & Minni            Expires August 28, 2008                [Page 3]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


1.  Introduction

   This document specifies xml-search, an OPTIONAL search grammar for
   use with the Web Distributed Authoring and Versioning (WebDAV) SEARCH
   protocol.  The search grammar defined by this document is a superset
   of DAV:basicsearch [I-D.reschke-webdav-search].

   The intent of this document is to extend the DAV:basicsearch grammar
   for dealing with properties whose values are XML fragments.  Since
   the WebDAV property namespace is flat, and resources may have at most
   one value for a property of a given name (Section 9.1 of [RFC4918]),
   XML documents allowing repeatable elements cannot be expressed as a
   set of independent WebDAV properties (e.g., by mapping some elements
   to properties), and the DAV:basicsearch schema cannot be applied to
   such XML content because it deals with property values as a whole.
   [note-intent]

   WXS:xml-search is proposed as a different search grammar because it
   defines a new element (namely WXS:filter) that modify the query
   semantics.  Had this been an extension of DAV:basicsearch, a server
   would have ignored the WXS:filter elements (according to Section 17
   of [RFC4918]) yielding results different from those requested by the
   client. [note-RFC4918-sect17]

1.1.  Notational conventions

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

   This specification defines elements in the
   urn:ietf:params:xml:ns:webdav-xml-search XML namespace. (hereinafter
   referred to as the "WXS namespace", though the prefix binding "WXS:"
   is not normative).  In natural language, an element like "xml-search"
   in this namespace is sometimes referred to as "WXS:xml-search"
   (without quotes). [note-namespace]

   In element definitions, an element name prefixed with "WXS:" refers
   to an element in the WXS namespace, and un-prefixed element names
   refers to elements in the "DAV:" namespace.

   The DTD fragments are normative up to extensibility rules defined in
   Section 6.  Unless noted otherwise, ordering of declared content is
   not significative.

   Note: when an error condition is described, it is said that "the
   server MUST return" some indication of that error.  Unless stated
   otherwise, if several errors occur at the same time, any of them MAY



Godoy & Minni            Expires August 28, 2008                [Page 4]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   be reported and any of them MAY be omitted as long as one of them is
   reported.

1.2.  Terms

   This document uses the terms defined in [RFC2616], [RFC4918],
   [W3C.REC-xpath20-20070123], and this section.  Some definitions of
   frequently used terms from [W3C.REC-xpath20-20070123] are
   informatively included here.

   Dynamic Context: (of an XPath expression) "the dynamic context of an
   expression is defined as information that is available at the time
   the expression is evaluated" (Section 2.1.2,
   [W3C.REC-xpath20-20070123]).

   Dynamic Evaluation Phase (DEP): "The dynamic evaluation phase is the
   phase during which the value of an expression is computed.  It occurs
   after completion of the static analysis phase" (Section 2.3.3.2,
   [W3C.REC-xpath20-20070123]).

   Dynamic Error: "A dynamic error is an error that must be detected
   during the dynamic evaluation phase and may be detected during the
   static analysis phase.  Numeric overflow is an example of a dynamic
   error" (Section 2.3.1, [W3C.REC-xpath20-20070123]).

   Implementation-defined: "indicates an aspect that MAY differ between
   implementations, but MUST be specified by the implementor for each
   particular implementation" (Section 1, [W3C.REC-xpath20-20070123]).

   Implementation-dependent: "indicates an aspect that MAY differ
   between implementations, is not specified by [this or any other]
   specification, and is not required to be specified by the implementor
   for any particular implementation" (Section 1,
   [W3C.REC-xpath20-20070123]).

   Role: a context within WXS:xml-search where the DAV:prop element is
   expected.  A role is "plain" if the DAV:prop element occurs as a
   direct child of DAV:select, DAV:where, or DAV:order, and it is
   "filtered" (also referred as XPath-enabled) if the DAV:prop element
   occurs as a direct child of WXS:XPath.

   Static Analysis Phase (SAP): "The static analysis phase depends on
   the expression itself and on the static context.  The static analysis
   phase does not depend on input data (other than schemas)" (Section
   2.3.3.1, [W3C.REC-xpath20-20070123]).

   Static Context: (of an XPath expression) "the static context of an
   expression is the information that is available during static



Godoy & Minni            Expires August 28, 2008                [Page 5]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   analysis of the expression, prior to its evaluation" (Section 2.1.1,
   [W3C.REC-xpath20-20070123]).

   Static Error: "A static error is an error that MUST be detected
   during the static analysis phase.  A syntax error is an example of a
   static error" (Section 2.3.1, [W3C.REC-xpath20-20070123]).

   Type Error: "A type error may be raised during the static analysis
   phase or the dynamic evaluation phase.  During the static analysis
   phase, a type error occurs when the static type of an expression does
   not match the expected type of the context in which the expression
   occurs.  During the dynamic evaluation phase, a type error occurs
   when the dynamic type of a value does not match the expected type of
   the context in which the value occurs" (Section 2.3.1,
   [W3C.REC-xpath20-20070123]).

1.3.  Overview

   Section 1.4 summarizes how this query grammar matches the PROPFIND
   response, according to the requirement imposed by Section 2.3.2 of
   [I-D.reschke-webdav-search].

   Section 2 describes WXS:xml-search as an XPath host language, i.e., a
   language where XPath expressions are embedded.  This section
   constrains some implementation-defined items from XPath.  It also
   includes design decisions in order to reduce the computational cost
   of evaluating allowed queries.

   Section 3 describes how this grammar is advertised, according to the
   mechanisms for discovery of supported query grammars, defined in
   Section 3 of [I-D.reschke-webdav-search].  This includes the Allow
   and DASL headers in OPTIONS responses (Section 3.1), the DAV:
   supported-query-grammar-set property (Section 3.2) and Query Schema
   Discovery (Section 3.3 and Section 5).

   Section 4 describes the grammar of a WXS:xml-search query.  This
   includes extending the specification of selection (Section 4.2) query
   criteria (Section 4.3) and ordering (Section 4.4) with respect to
   DAV:basicsearch.  Additionally, some status (Section 4.5 to
   Section 4.7) and precondition/postcondition codes (Section 4.8) are
   defined.

   Section 5 describes the Query Schema for advertising supported
   features about properties (Section 5.1) and operators (Section 5.2),
   and optional XPath functions available in a WXS:xml-search query
   (Section 5.3).

   Section 6 describes the specified behaviour when unexpected elements



Godoy & Minni            Expires August 28, 2008                [Page 6]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   are found, providing a common ground for allowing clients that
   implement arbitrary extensions to interoperate with other
   implementations that does not include it.

1.4.  WXS:xml-search and the PROPFIND response

   A WXS:xml-search response contains a subset of the elements that a
   PROPFIND response, listing the same properties on the same scope and
   with the same depth, contains.

   If a server supports specifying several scopes in a single query, and
   these scopes exist, then the WXS:xml-search response will describe a
   subset of the elements in several PROPFIND responses (one PROPFIND
   for each scope).

   The DAV:select element of a WXS:xml-search request defines the result
   record.  When either DAV:allprop or DAV:prop are used, both DAV:
   select and PROPFIND define the same result set.  Besides, a WXS:xml-
   search request specifying not only DAV:allprop but also DAV:prop
   defines the same result set as a PROPFIND specifying DAV:allprop and
   DAV:include does.

   WXS:xml-search introduce a new way for selecting properties: WXS:
   filter, which "filters" elements from some property value according
   to an XPath expression.  If WXS:filter is used, the WXS:xml-search
   response will contain a subset of elements from the filtered
   property, while the PROPFIND response will contain the complete
   value.

   Queries may impose conditions about which or how many resources will
   be included in the response, and servers may truncate the response at
   their choice.  Thus, a SEARCH response may not include some resources
   from the specified scope, while all of them have to be included when
   using PROPFIND.

   Furthermore, WXS:xml-search defines additional preconditions and
   postconditions codes that are not used with a PROPFIND response.

2.  XPath

   There are several items in XPath that are implementation-defined.
   Some of them are defined in this section (as this protocol specifies
   an XPath host language) while other are left to the criteria of the
   implementors.

   * Some components of the static and dynamic contexts are constrained
   (Section 2.1).




Godoy & Minni            Expires August 28, 2008                [Page 7]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   * A way for reporting errors and warnings is specified (Section 2.2).

   * In some expressions, supporting numeric predicates is OPTIONAL
   (Section 2.3).

   * Implementations of this protocol MUST be based on the rules of
   [W3C.REC-xml11-20060816] and [W3C.REC-xml-names11-20060816], and
   apply them consistently.

   * The self, child, descendant, descendant-or-self, parent and
   attribute axes MUST be supported.  An implementation MAY support
   other axes, as described in the query schema.  (This requirement is
   aligned with the mandatory axes from [W3C.REC-xquery-20070123].)

   * Support for the "Static Typing Feature" and "Static Typing
   Extensions" (Appendix F.1 of [W3C.REC-xpath20-20070123]) is
   implementation-defined.

2.1.  Static and Dynamic Contexts

   This specification defines REQUIRED values for some components of the
   XPath static and dynamic context.  Unless specified otherwise, the
   constant values specified below MUST NOT be overwritten.  Components
   not listed here are "implementation-dependent".

   Evaluation of an expression that relies on one or more "unassigned"
   components raises the static error err:XPST0001 (if the component is
   static) or the dynamic error err:XPDY0002 (if the component is
   dynamic).

   Definition of functions in the "Function signatures" set is given in
   [W3C.REC-xpath-functions-20070123].

                          REQUIRED static values

   +---------------------+---------------------------------------------+
   | Component           | Specified Value                             |
   +---------------------+---------------------------------------------+
   | XPath 1.0           | "false".                                    |
   | compatibility mode  |                                             |
   |                     |                                             |
   | Statically known    | All the namespace bindings in scope at the  |
   | namespaces          | WXS:XPath element where the expression      |
   |                     | occurs plus ("fn:",                         |
   |                     | "http://www.w3.org/2005/XPath-functions")   |
   |                     | unless overwritten.                         |
   |                     |                                             |
   | Default             | The default namespace of the WXS:XPath      |



Godoy & Minni            Expires August 28, 2008                [Page 8]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   | element/type        | element where the expression occurs ("none" |
   | namespace           | if there is no default namespace).          |
   |                     |                                             |
   | Default function    | "http://www.w3.org/2005/XPath-functions".   |
   | namespace           |                                             |
   |                     |                                             |
   | Function signatures | fn:root($arg as node()?) as node()?         |
   |                     | fn:not($arg as item()*) as xs:boolean       |
   |                     | fn:count ($arg as item()*) as xs:integer    |
   |                     | fn:exists($arg as item()*) as xs:boolean    |
   |                     | fn:empty ($arg as item()*) as xs:boolean    |
   |                     | (may be overwritten).                       |
   |                     |                                             |
   | Statically known    | At least                                    |
   | collations          | "http://www.iana.org/assignments/collation/ |
   |                     | default" and applicable wildcard collations |
   |                     | (Sections 3.1 and 3.2 of [RFC4790]).  MAY   |
   |                     | be augmented with an implementation-defined |
   |                     | set of collations.                          |
   |                     |                                             |
   | Default collation   | The collation matched by                    |
   |                     | "http://www.iana.org/assignments/collation/ |
   |                     | default" (the actual collation is           |
   |                     | implementation-defined)                     |
   |                     |                                             |
   | Base URI            | Unassigned.                                 |
   |                     |                                             |
   | Statically known    | Initially unassigned.  Overwriteable with   |
   | documents           | an implementation-defined value.            |
   |                     |                                             |
   | Statically known    | Initially unassigned.  Overwriteable with   |
   | collections         | an implementation-defined value.            |
   |                     |                                             |
   | Statically known    | node()*                                     |
   | default collection  |                                             |
   | type                |                                             |
   +---------------------+---------------------------------------------+

                          REQUIRED dynamic values

   +------------------+------------------------------------------------+
   | Component        | Specified Value                                |
   +------------------+------------------------------------------------+
   | Function         | Implementation-defined, MUST be consistent     |
   | implementations  | with function signatures.                      |
   |                  |                                                |
   | Current dateTime | REQUIRED implementation-dependent value.       |
   |                  |                                                |



Godoy & Minni            Expires August 28, 2008                [Page 9]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   | Implicit         | REQUIRED implementation-defined value.         |
   | timezone         |                                                |
   |                  |                                                |
   | Available        | Initially unassigned.  Overwriteable with an   |
   | documents        | implementation-defined value.                  |
   |                  |                                                |
   | Available        | Initially unassigned.  Overwriteable with an   |
   | collections      | implementation-defined value.                  |
   |                  |                                                |
   | Default          | Initially unassigned.  Overwriteable with an   |
   | collection       | implementation-defined value.                  |
   +------------------+------------------------------------------------+

2.2.  Error and warnings

   This section describes the method for reporting XPath errors and
   warnings.  Error conditions are defined in
   [W3C.REC-xpath20-20070123], and warning conditions are OPTIONAL and
   implementation-defined.

   For conformance with [W3C.REC-xpath20-20070123], implementations MAY
   report any non-empty subset of errors.  Additionally, if there is an
   error (other than an XPath error) that causes the request to be
   rejected, implementations MAY report the latter, with no mention to
   the XPath errors.

   The idref attributes of WXS:xpath-error and WXS:warning MAY be used
   to refer to the id attribute of the WXS:xpath element whose content
   raised the error or warning.  The mechanism that implementations use
   to return additional information is implementation-defined.

2.2.1.  Warnings

   The WXS:warning element contains at least one XML element, and MUST
   NOT contain text or mixed content.  Children of the WXS:warning
   element represent warnings signaled during the analysis of the
   expression.


   <!ELEMENT WXS:warning ANY>
   <!ATTLIST WXS:warning idref NAME #IMPLIED>

   The DAV:multistatus and DAV:response elements, when used in response
   to WXS:xml-search queries, are modified to include an OPTIONAL WXS:
   warning element.  Warnings raised during SAP apply to the whole query
   and are reported within the WXS:warning element contained by DAV:
   multistatus.  Warnings raised during DEP only apply to a particular
   resource and are reported within the DAV:response for that resource.



Godoy & Minni            Expires August 28, 2008               [Page 10]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   <!ELEMENT multistatus (response*, responsedescription?,
                          WXS:warning?) >

   <!ELEMENT response (href, ((href*, status)|(propstat+)),
                       error?, WXS:warning?,
                       responsedescription?, score?)

2.2.2.  Errors (in SAP)

   Any error (either a static, dynamic or type error) detected during
   SAP invalidates the request.  At this stage, errors are reported
   through a WXS:xpath-error element included in a response whose root
   element is DAV:error.  The response status code is 400 (Bad Request).

   <!ELEMENT WXS:xpath-error ANY>
   <!ATTLIST WXS:xpath-error idref NAME #IMPLIED>

   The WXS:xpath-error element MUST contain one or more elements
   describing the error.  For instance, if an err:XPST0003 were raised
   (i.e. the XPath static error 0003: "a XPath expression is not a valid
   instance of the grammar") the response would be:

   HTTP/1.1 400 Bad Request
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxx

   <error xmlns="DAV:">
     <WXS:XPath-error
         xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search">
       <err:XPST0003 xmlns:err="http://www.w3.org/2005/xqt-errors"/>
     </WXS:XPath-error>
   </error>

   (Note: the use of the "err:" prefix follows the convention of
   [W3C.REC-xpath20-20070123] but it is not normative.)

2.2.3.  Errors (in DEP)

   An expression may be statically valid and raise an error under some
   dynamic conditions.  Dynamic and type errors detected during DEP only
   invalidates the expression which raises them, when evaluated with the
   actual values of some resource property.

   A server MAY ignore errors detected in DEP if:
      -The error would occur within DAV:order, but that ordering
   criteria is not evaluated (e.g., because other orders take
   precedence, or because the query matches one or no resource).
      -The error occurs within DAV:where part, and it does not affect



Godoy & Minni            Expires August 28, 2008               [Page 11]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   the result.  For instance, the error in (FALSE AND ERROR) may be
   omitted because the result would have been FALSE anyway, and the
   error in (TRUE OR ERROR) may be omitted because the result would have
   been TRUE anyway.

   If the error is not ignored, and the XPath expression was specified
   within the DAV:select part, it MAY be reported in the DAV:propstat
   element for the current property and resource.  Otherwise, it MAY be
   reported in the DAV:response element for the current resource.  In
   both cases the status code 409 (Conflict) MUST be used.

   Although errors in DEP depend on the value of the property, an error
   that is too frequent might have been caused by mistakes in the
   client's request.  Therefore, instead of returning a sequence of DAV:
   response elements, all of which represent failures because of the
   same error, a server MAY report an error in DEP as a general failure
   invalidating the query itself, even if it is possible to evaluate
   some resources or properties. [error-DEP]

   When an error raised in DEP is reported as a general failure, the
   response will be marshaled as in Section 2.2.2, but the response
   status code MUST be 409 (Conflict) instead of 400 (Bad Request).

   For instance, if err:XPTY0004 were raised during DEP ("the dynamic
   type of a value does not match a required type"), the response would
   be:

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

   <error xmlns="DAV:">
     <WXS:XPath-error
         xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search">
       <err:XPTY0004 xmlns:err="http://www.w3.org/2005/xqt-errors"/>
     </WXS:XPath-error>
   </error>

   the dynamic type of a value does not match a required type

2.3.  Numeric Predicates

   "A step is a part of a path expression that generates a sequence of
   items and then filters the sequence by zero or more predicates"
   (Section 3.2.1 of [W3C.REC-xpath20-20070123]).  A step expression may
   be either a FilterExpr or an AxisExpr.

   "A predicate consists of an expression, called a predicate



Godoy & Minni            Expires August 28, 2008               [Page 12]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   expression, enclosed in square brackets.  A predicate serves to
   filter a sequence, retaining some items and discarding others".
   (Section 3.2.2 of [W3C.REC-xpath20-20070123])

   Support for numeric predicates and other references to the context
   position -e.g. by evaluating the fn:position() function- depends on
   the sequence where the predicate applies.

   Supporting numeric predicates in FilterExpr is OPTIONAL.  If the step
   expression is an AxisStep, the requirement level depends on the
   specified axis.  It is:

   * NOT RECOMMENDED for the namespace and attribute axes, because the
   relative order of elements within these axes is implementation-
   dependent.
   * Always REQUIRED for the parent, self, and ancestor axes.
   * For the child, preceding-sibling, and following-sibling axes:
   RECOMMENDED if the sequence order is semantically meaningful,
   OPTIONAL otherwise.
   * Always OPTIONAL for the descendant, descendant-or-self, ancestor-
   or-self, preceding, and following axes.
   [note-context-position]

   The way this feature is supported when it is not REQUIRED is
   implementation-dependent.

3.  Discovery of the Query Grammar

   If a resource supports the SEARCH method, then the server MUST list
   SEARCH in the Allow header, as described in Section 3.1 of
   [I-D.reschke-webdav-search].

3.1.  The DASL Response Header

   The DASL response header indicates server support for a query grammar
   in the OPTIONS method.  (Section 3.2 of [I-D.reschke-webdav-search])
   The value of this header is a URI that indicates the type of grammar
   supported.  Servers MUST return the following header when the OPTIONS
   method is invoked on any arbiter that supports the WXS:xml-search
   grammar:

      DASL:<urn:ietf:params:xml:ns:webdav-xml-search>

3.2.  DAV:supported-query-grammar-set

   The WebDAV property DAV:supported-query-grammar-set is REQUIRED for
   any server supporting either [RFC3253] and/or [RFC3744] and
   identifies the XML based query grammars that are supported by the



Godoy & Minni            Expires August 28, 2008               [Page 13]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   search arbiter resource (Section 3.3 of [I-D.reschke-webdav-search]).
   Servers implementing DAV:supported-query-grammar-set MUST report the
   following grammar for each arbiter resource supporting WXS:xml-
   search:

   <DAV:grammar xmlns:DAV="DAV:">
     <WXS:xml-search
       xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search"/>
   </DAV:grammar>

3.3.  Discovery of the WXS:xml-search Query Schema

   Query Schema Discovery (QSD) is requested by means of the SEARCH
   method, including an entity with a DAV:query-schema-discovery root
   element.  As specified in Section 4.1 of [I-D.reschke-webdav-search],
   the response body takes the form of a DAV:multistatus element
   (Section 13 of [RFC4918]), where DAV:response is extended to hold the
   returned query grammar inside a DAV:query-schema container element.

   If the DAV:query-schema-discovery element contains WXS:xml-search,
   then the response marshaling MUST be performed as described in this
   section and Section 5.

   Since the supported query grammars may depend on the scope, the WXS:
   xml-search element (when used for QSD) MAY contain a DAV:from
   element.  Other content is unexpected in this context.

   If a request specifies several scopes, and the server supports them,
   the response MUST only contain those descriptions that are common to
   each scope.

   Request:

   SEARCH / HTTP/1.1
   Host: host.example
   Content-Type: application/xml
   Content-Length: xxx

   <query-schema-discovery xmlns="DAV:">
     <WXS:xml-search
       xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search"/>
   </query-schema-discovery>

   Response:

   HTTP/1.1 207 Multistatus
   Content-Type: application/xml
   Content-Length: xxx



Godoy & Minni            Expires August 28, 2008               [Page 14]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   <multistatus xmlns="DAV:">
     <response>
       <href>http://host.example</href>
       <status>HTTP/1.1 200 OK</status>
       <query-schema>
         <WXS:xml-search-schema
           xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search"/>
           <!-- (See Section 5 for the actual contents) -->
         </WXS:xml-search-schema>
       </query-schema>
     </response>
   </multistatus>

4.  The WXS:xml-search Grammar

   The elements used in WXS:xml-search conform the semantics given in
   [I-D.reschke-webdav-search] for the DAV:basicsearch grammar, and all
   the operators defined in Section 5 of [I-D.reschke-webdav-search]
   (i.e. %all_ops;) are valid in the context of a WXS:xml-search query.
   Additionally, some elements in the "DAV:" namespace are allowed to
   contain specific elements from the WXS:xml-search grammar.

   Therefore, the semantics of a DAV:basicsearch valid query is
   preserved when it is submitted as a WXS:xml-search query.

   This grammar also allows the additional element WXS:filter, as well
   as optional implementation-defined operators.  The WXS:filter element
   specifies an XPath expression (rooted on a single property, i.e. the
   root element is the property whose name is included in the DAV:prop
   element).  It is both a query-operator and a special construct valid
   within DAV:select and DAV:order elements.


   <!-- "WXS:xml-search" element -->
   <!ELEMENT WXS:xml-search (select?, from, where?, orderby?, limit?) >

   <!-- "WXS:filter" and "WXS:xpath" -->
   <!ELEMENT WXS:filter  (prop, WXS:XPath)>
   <!ELEMENT WXS:XPath    #PCDATA >
   <!ATTLIST WXS:xpath id ID                 #IMPLIED>

   <!-- "DAV:select" element -->
   <!ELEMENT select     ( (allprop | prop | WXS:filter)+ )>

   <!-- "DAV:where" element -->
   <!ENTITY % wxs_ops "WXS:filter | WXS:is-well-formed" >
   <!ELEMENT where       (  %all_ops;|%wxs_ops;)      >




Godoy & Minni            Expires August 28, 2008               [Page 15]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   <!ELEMENT not         (  %all_ops;|%wxs_ops;   )   >
   <!ELEMENT and         ( (%all_ops;|%wxs_ops;)+ )   >
   <!ELEMENT or          ( (%all_ops;|%wxs_ops;)+ )   >

   <!ELEMENT WXS:is-well-formed ( prop )               >

   <!-- "DAV:order" element for WXS:xml-search-->

   <!ELEMENT order      ((prop | score | WXS:filter),
                         (ascending | descending)?)


4.1.  Accepted Role Precondition

   If the WXS:xml-search request includes a property with a role that is
   not acceptable (e.g. the request specifies a filtered selection of a
   property that is not XPath-enabled or it specifies ordering by a non-
   sortable property), the server MUST reply with a 422 (Unprocessable
   Entity) status code.  The response's DAV:error element MUST contain
   at least one WXS:acceptable-role preconditions (Section 4.8)
   describing the failure for each rejected property.

   If the request is not accepted because of a WXS:acceptable-role
   precondition, the server SHOULD report all the failures, so that if
   the client removes the conflicting properties then the modified query
   will succeed this test.

   If a property violates the preconditions for a role in both plain and
   filtered forms, then the filtered form MAY be omitted in the error
   response.  (This rule does not apply for DAV:selectable since a
   property may not be specified for both plain and filtered selection
   in the same request).

   Rejections because of several reasons (e.g. because a property is
   neither DAV:searchable nor DAV:selectable) MAY be reported by means
   of a single WXS:acceptable-role element.  The DAV:prop element within
   WXS:acceptable-role must contain a single property element.

   If the server supports QSD, it MUST accept properties in the roles
   described by the QSD response for the specified search scopes.

   When a WXS:filter element refers to a live property that is known not
   to be well-formed XML (because the server enforces other syntax), the
   server SHOULD reject the request as described in this section,
   instead of accepting the query and reporting a 409 (Conflict) for
   each occurrence.  (This implies that its QSD description SHOULD NOT
   include any XPath-enabled role.)




Godoy & Minni            Expires August 28, 2008               [Page 16]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


4.2.  Selection

   DAV:select defines the result record, which is a set of properties
   and values (Section 5.3 of [I-D.reschke-webdav-search]).  The allowed
   children are DAV:allprop and DAV:prop (defined in Section 14 of
   [RFC4918]) and WXS:filter (defined in this document).

   If the DAV:select element is omitted, the successful response MUST
   only contain the URIs of matched resources in one or more DAV:
   response elements with status code 204 (No content).  The response
   root element is DAV:multistatus.  If an error occurs, it MUST be
   reported as described for the non-empty case.

   The rest of this section describes the handling of non-empty DAV:
   select elements

   For each resource matching the query criteria and scope, the results
   from all the WXS:filter selection-elements (i.e. all the WXS:filter
   elements included within a DAV:select element) referred to the same
   property MUST be returned into a single property of the DAV:response.
   Because of filtering, the response is not required to be valid even
   if the selected property contains an XML document that is valid
   according to some DTD or XML schema.

   For each resource matching the query criteria and scope, and for each
   property selected through WXS:filter:

   - When the actual property value does not contain a well-formed XML
   fragment, a DAV:propstat with 409 (Conflict) code and postcondition
   code WXS:property-must-be-well-formed-xml MUST be returned for that
   resource and property (since the query semantics is not appropriate
   for the actual property value).

   - If the actual property value contains a well-formed XML fragment,
   the matched elements are aggregated into the XML fragment for that
   property and resource.

   - If no elements are matched for that property and resource, it will
   be reported as an empty element.

   If a property does not exist, the server MUST either omit the
   selected property from that resource record-set or return it within a
   404 (Not Found) status code DAV:propstat.[note-OPTIONAL-404]

   A client MUST NOT request both the plain property value and the
   filtered one, since it is ambiguous (or, in the best case, redundant)
   [note-select-prop-filter].  Hence, if DAV:select contains one or more
   WXS:filter elements referring a property that is also selected via a



Godoy & Minni            Expires August 28, 2008               [Page 17]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   plain DAV:prop element, the server MUST return a 400 (Bad Request)
   response.

   For instance, the following DAV:select element causes a 400 response:


   <select xmlns="DAV:">
      <filter>
       <prop xmlns:A="http://a.example/"/>
         <A:property/>
       </prop>
       <XPath>//foo</XPath>
     </filter>
     <prop xmlns:A="http://a.example/"/>
         <A:property/>
     </prop>
   </select>

   If DAV:allprop is specified, it is understood as in a PROPFIND
   request [RFC4918]: (i.e., properties defined in RFC 4918, at a
   minimum, plus dead properties MUST be returned).  Hence, the set of
   properties selected by allprop vary from resource to resource.

   If the request includes not only DAV:allprop but also one or more
   DAV:prop elements specifying properties that are already returned per
   DAV:allprop, or the request includes a property twice in DAV:prop
   elements, then the redundant properties MUST be ignored (i.e. a
   single property value will be returned).  This behaviour is similar
   to that of the DAV:include element in a PROPFIND request (but DAV:
   include is not defined for WXS:xml-search requests).

   There is no error when a property that would be returned per DAV:
   allprop is also specified within a WXS:filter element (since the
   client may not be aware of the properties that will be returned when
   DAV:allprop is specified).  This combination MUST be addressed as
   follows:
       - Process the WXS:filter elements as usual.  This result in
   properties contained in DAV:propstat; elements with status code 200,
   4xx, or 5xx, as appropriate.
       - Select each property that would have been returned per DAV:
   allprop in a PROPFIND request and was not included within a WXS:
   filter element.

4.3.  Query criteria

   The DAV:where element specifies optional query criteria.  Only those
   resources that verify the query criteria are included in the result
   set.



Godoy & Minni            Expires August 28, 2008               [Page 18]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


4.3.1.  DAV:prop operand

   The result of the DAV:prop operand is the value of the specified
   property of the resource being evaluated.  If the property is a live
   one, the result datatype SHOULD be the actual property datatype.  If
   the property is dead, or the server chooses to ignore the live
   property datatype, the result MUST be of type xs:string.

   Note: "A property name is a universally unique identifier that is
   associated with a schema that provides information about the syntax
   and semantics of the property" (Section 4.4 of [RFC4918]).
   Therefore, each property name SHOULD be permanently associated with
   at most one datatype.

4.3.2.  Literal Operands

   DAV:literal and DAV:typed-literal allow literal values to be placed
   in an expression.  Both literal are interpreted as defined in Section
   5.10 and Section 5.11 of [I-D.reschke-webdav-search].

   Besides, a request with a DAV:typed-literal specifying an unknown
   type MUST be rejected by returning a response with status code 422
   (Unprocessable Entity) and precondition code WXS:known-literal-type.
   The xs:string type MUST NOT be unknown.

4.3.3.  Relational operators

   The relational operators take a property and literal operand.  WXS:
   xml-search inherits the five relational operators defined in
   [I-D.reschke-webdav-search]: DAV:eq, DAV:lt, DAV:gt, DAV:lte and DAV:
   gte.

   For each property and pair of values being compared:
      - per Section 4.2.1 of [W3C.REC-xmlschema-2-20041028] the result
   of DAV:eq; is always defined, then DAV:eq; MUST NOT return NULL.
      - all of DAV:lt, DAV:gt, DAV:lte and DAV:gte MUST be either
   undefined or consistently defined.  If they are defined, they MUST
   also conform the result of DAV:eq (i.e., A == B iff A<=B and A>=B).

   If the property type is known and it is a complex type, the result of
   these operations SHOULD be undefined. [note-comparison-complex-type]
   (Values within such properties may be compared by means of XPath
   predicates.)

   If the property type is known and it is a simple built-in ordered
   type, the order relation used in the comparison SHOULD be that
   defined in [W3C.REC-xmlschema-2-20041028].




Godoy & Minni            Expires August 28, 2008               [Page 19]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   If the property type is known and it is a simple type, an
   implementation-dependent order relation MAY be used.  If a partial
   order is used, then trying to compare two values that are not
   comparable yields an undefined result.

   In any case, the collation algorithm is implementation-dependent.

   Other operators and operands retain the behaviours defined in
   [I-D.reschke-webdav-search].

4.3.4.  The WXS:filter operator

   When used inside a DAV:where element (or a sub-element thereof) WXS:
   filter evaluates as:
      - TRUE if (and only if) the XPath expression matches at least one
   element,
      - FALSE if (and only if) no element within the property is
   matched,
      - NULL if (and only if) the property does not exist or its value
   is not a well-formed XML fragment.

4.3.5.  The WXS:is-well-formed operator

   The WXS:is-well-formed operator takes a DAV:prop operand and returns:
      - TRUE if (and only if) the property value is a well formed XML
   fragment.
      - FALSE if (and only if) the property value is not a well formed
   XML fragment.
      - NULL if (and only if) the property does not exist.

   Supporting this operator is REQUIRED for properties that are WXS:
   searchable, and OPTIONAL for properties that are only DAV:searchable.

4.4.  Ordering

   DAV:orderby specifies a lexicographical order on the result set to be
   returned.  Comparisons are applied as they occur in the DAV:orderby
   element, earlier comparisons being more significant (Section 5.6 of
   [I-D.reschke-webdav-search]).

   When used within WXS:xml-search, a DAV:orderby element MUST contain
   one or more DAV:order elements, which are allowed to contain a DAV:
   prop, a DAV:score, or a WXS:filter elements.

   When DAV:order contains a DAV:prop element, the ascending
   (alternatively, descending) order MUST be consistent with the
   comparison performed by DAV:lte (alternatively, DAV:gte):
   - If A<=B (alternatively, A>=B) according to DAV:lte, then A collates



Godoy & Minni            Expires August 28, 2008               [Page 20]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   before B.
   - If A<=B (alternatively, A>=B) is undefined, then the collation
   order is implementation-dependent.

   When DAV:order contains a DAV:score element, an integer comparison is
   performed on each DAV:score value computed for the DAV:contains
   operation.

   When DAV:order contains a WXS:filter element, result-sets will be
   logically partitioned in three equivalence classes, based on the
   evaluation of WXS:filter (as defined in Section 4.3).  The
   equivalence classes are totally ordered (in ascending order) as: NULL
   < false < true.

   Ordering within each equivalence class (i.e. ordering among all the
   responses for which the WXS:filter element evaluates to the same
   value) is implementation-dependent.  (The order specified for the
   item-type in the sequence returned by the xpath expression MAY be
   used.)

4.5.  SEARCH Status Codes for responses to WXS:xml-search queries

      - 207 (Multistatus) The server accepted the request.  The result
   set are returned within a DAV:multistatus element.
      - 400 (Bad Request) Error in SAP, or the query includes both a
   plain DAV:prop and a WXS:filter specifying the same property name.
      - 403 (Forbidden) The server rejected the request because the user
   has no privileges for performing queries under the specified arbiter
   resource.
      - 404 (Not found) The arbiter resource does not exist.
      - 409 (Conflict) Error in DEP (general failure) or invalid scope.
      - 422 (Unprocessable Entity)
          A property was specified in a role that is rejected for that
   property.
          An unknown type was specified in DAV:typed-literal.
          A required extension is not supported.

   Other status codes may be returned (redirections, client errors,
   server errors), with the meaning defined in [RFC2616].

   The 207 status code MUST be used if and only if a result set is
   included in the response (an empty result set is allowed if the query
   does not match any resource).

   If the query could not be performed because of several errors, the
   error that is reported is implementation-dependent.

   If the client has no privileges for testing whether the arbiter



Godoy & Minni            Expires August 28, 2008               [Page 21]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   exists then 403 (Forbidden) SHOULD be used instead of 404 (Not
   found).  If the client has no privileges for accessing the specified
   scope then 409 (Conflict) MUST be returned

4.6.  Status Codes for Use in 'response' Elements

      - 204 (No Content) if the resource exists and no selection list
   was specified (i.e. the DAV:select element is empty).
      - 209 (Conflict) Error in DEP.  The search was invalidated for
   resources identified by DAV:href elements in the response.

   If a selection list was specified, the response MUST NOT contain a
   DAV:status element, but a DAV:propstat listing the selected
   properties.

   If the client has no privileges for testing whether a resource
   exists, that resource MUST be silently omitted from the response.

   5xx status codes MAY be used if an error occurs when accessing the
   resource.

4.7.  Status Codes for Use in 'propstat' Elements

      - 200 (OK) for each selected property, if the property exists.
      - 403 (Forbidden) if the client has no privileges for accessing
   the selected property.
      - 404 (Not Found) for each property selected through DAV:allprop,
   DAV:prop or WXS:filter if the property does not exist (OPTIONAL).
      - 409 (Conflict) if a property specified in a selection WXS:filter
   element does not contains well-formed XML.  The associated
   postcondition MUST be WXS:property-must-be-well-formed-xml.

   If the client has no privileges for testing whether the property
   exists, the server SHOULD either omit the property or return a 404
   (Not found) status code (instead of 403).

   5xx status codes MAY be used if an error occurs when accessing the
   property value.

4.8.  Precondition and postcondition Codes

4.8.1.  WXS:property-must-be-well-formed-xml

   Type: postcondition

   Use with: /multistatus/response/propstat/error, 409 Conflict

   Purpose: the actual property value does not contain a well-formed XML



Godoy & Minni            Expires August 28, 2008               [Page 22]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   fragment, and the property was specified in a WXS:filter element.


   <!ELEMENT WXS:property-must-be-well-formed-xml EMPTY>

4.8.2.  WXS:acceptable-role

   Type: precondition

   Use with: /error, 422 Unprocessable Entity

   Purpose: the WXS:xml-search request includes a property for a role
   where it is not acceptable.


   <!ELEMENT WXS:acceptable-role (prop, searchable?,
                                 selectable?, sortable?)>

4.8.3.  WXS:XPath-error

   Type: precondition/postcondition

   Use with:
      /error, 400 Bad Request (precondition)
      /error, 409 Conflict (precondition)
      /multistatus/response/error, 409 Conflict (postcondition)
      /multistatus/response/propstat/error, 409 Conflict (postcondition)

   Purpose: The query includes an XPath expression that raises an error.

   (see Section 2.2.)

4.8.4.  DAV:search-scope-valid

   Type: precondition

   Use with: /error, 409 Conflict

   Defined in [I-D.reschke-webdav-search]

4.8.5.  WXS:known-literal-type

   Type: precondition

   Use with: /error, 422 Unprocessable Entity

   Purpose: The query includes a DAV:typed-literal that specifies an
   unknown data-type.  The data-type name is included into the element



Godoy & Minni            Expires August 28, 2008               [Page 23]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   content.


   <!ELEMENT WXS:known-literal-type #PCDATA>

5.  Query Schema for WXS:xml-search

   The query schema provides information about the set of available
   properties and implemented operators.

   The query schema is marshaled within a WXS:xml-search-schema element.
   This element contains an unordered set of property descriptions (DAV:
   propdesc), operator description rules (WXS:opdesc-rule) and supported
   optional functions (WXS:function-set).


   <!ELEMENT WXS:xml-search-schema  (propdesc|WXS:opdesc-rule
                                    |WXS:function-set)* ) >

5.1.  Property descriptions

   The semantics of DAV:propdesc, when used within a WXS:xml-search-
   schema is extended for describing whether a property may be used as
   root element of an XPath expression within a WXS:filter element.

   Since WXS:filter may appear in three different places (the record-set
   definition, the query criteria and the ordering criteria), the server
   may allow or disallow it on a separate basis.  If WXS:selectable,
   WXS:searchable or WXS:sortable is present, then the server MUST allow
   this property to be used within a WXS:filter element in the
   applicable context (role)


   <!ELEMENT propdesc           (prop|any-other-property), datatype?,
                                (searchable | WXS:searchable)?,
                                (selectable | WXS:selectable)?,
                                (sortable   | WXS:sortable?),
                                 caseless?,
                                 WXS:axis*, WXS:function-set* >


   <!ELEMENT WXS:selectable       EMPTY >
   <!ELEMENT WXS:searchable       EMPTY >
   <!ELEMENT WXS:sortable         EMPTY >

   <!ELEMENT WXS:axis EMPTY>
   <!ATTLIST WXS:axis name (namespace |
                     | ancestor | ancestor-or-self



Godoy & Minni            Expires August 28, 2008               [Page 24]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                     | following  | following-sibling
                     | preceding | preceding-sibling) #REQUIRED>

   Properties that are WXS:selectable or WXS:searchable are also DAV:
   selectable or DAV:searchable respectively.  For instance, if a
   property may be selected through an XPath expression then it is
   plainly selectable, and if a property may be used within a WXS:filter
   query criterion then it may be used as an operand of DAV:is-defined,
   DAV:is-well-formed.

   Properties that are WXS:sortable are not DAV:sortable, because
   comparison of complex types is undefined.  Properties MUST NOT be
   DAV:sortable and WXS:sortable at the same time.

   The server MUST allow described properties to be used in the role for
   which they were advertised.  This hint does not assert whether the
   property is defined on every resource in the scope, and does not
   assert whether the property value is well-formed XML.

   There SHOULD be one description for DAV:any-other-property.  There
   MUST NOT be more than one description for each property, and one
   description for DAV:any-other-property.

   The "name" attribute of the WXS:axis element specifies the name of an
   optional axis, and the WXS:function-set element (Section 5.3)
   specifies optional functions, which the server supports for the
   property being described.

5.2.  Operator descriptions

   Operators are described in a way that borrows some elements from ABNF
   [RFC4234] (namely repetitions and alternatives).  This approach
   allows a flexible and compact description of operators. [note-opdesc]


   <!-- "allow-pcdata" attribute -->
   <!ATTLIST WXS:opdesc-rule allow-pcdata (yes|no) #IMPLIED >

   <!-- "WXS:operator" element -->
   <!ELEMENT WXS:operator             EMPTY                 >
   <!ATTLIST WXS:operator name        NAME   #REQUIRED      >
   <!ATTLIST WXS:operator namespace   CDATA
      "urn:ietf:params:xml:ns:webdav-xml-search"            >


   <!-- terminal elements -->
   <!ENTITY  % WXS:terminal       (operand-literal|
                                  operand-typed-literal|



Godoy & Minni            Expires August 28, 2008               [Page 25]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                                  operand-property|
                                  WXS:operand-XPath|
                                  WXS:operand-nested-op) >

   <!ELEMENT WXS:operand-XPath       EMPTY>
   <!ELEMENT WXS:operand-nested-op   EMPTY>

   <!-- content model description-->
   <!ELEMENT WXS:opdesc-rule (WXS:operator+,
                             (WXS:alternative|WXS:repetition|
                              %terminal;)*
   )>

   <!ELEMENT WXS:alternative (WXS:repetition|%terminal;)>

   <!ELEMENT WXS:repetition  (WXS:alternative|WXS:repetition|
                              %terminal;)* >
   <!ATTLIST WXS:repetition   atleast    CDATA "0" >
   <!ATTLIST WXS:repetition   atmost     CDATA "infinity" >

5.2.1.  WXS:opdesc-rule and WXS:operator

   WXS:operator references the name of an operator.  Several operators
   may be defined by the same WXS:opdesc-rule, and several WXS:opdesc-
   rule may define incremental alternatives (that is, an initial rule
   may match one or more alternatives, with later rule definitions
   adding to the set of alternatives, as in the ABNF construction Rule1
   =/ Rule2 defined in section 3.3 of [RFC4234]).

   For instance,

     <opdesc-rule>
       <operator name="lt" namespace="DAV:"/>
       <operator name="gt" namespace="DAV:"/>
       <operand-property/>
       <alternative>
         <operand-literal/>
         <operand-typed-literal/>
       </alternative>
     </opdesc-rule>

   is equivalent to

     <opdesc-rule>
       <operator name="lt" namespace="DAV:"/>
       <operand-property/>
       <operand-literal/>
     </opdesc-rule>



Godoy & Minni            Expires August 28, 2008               [Page 26]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


     <opdesc-rule>
       <operator name="lt" namespace="DAV:"/>
       <operand-property/>
       <operand-typed-literal/>
     </opdesc-rule>

     <opdesc-rule>
       <operator name="gt" namespace="DAV:"/>
       <operand-property/>
       <operand-literal/>
     </opdesc-rule>

     <opdesc-rule>
       <operator name="gt" namespace="DAV:"/>
       <operand-property/>
       <operand-typed-literal/>
     </opdesc-rule>

   Mandatory operators SHOULD be omitted from the actual schema returned
   by a server (since their grammar is implied).  If an operator is
   defined or enhanced by an extension of this protocol, the server MUST
   return rules (i.e. one or more WXS:opdesc-rule elements) for them.
   If the enhanced operator is a mandatory one, then the alternative
   rule applies.  Hence, if the response includes

     <opdesc-rule>
       <operator name="eq" namespace="DAV:"/>
       <operand-property/>
       <FOO:operand-bar xmlns:FOO="http://foo.example/"/>
     </opdesc-rule>

   it means that the DAV:eq operator accepts a pair of (property, foo:
   bar) operands, as well as it accepts the above-defined (property,
   literal) and (property, typed-literal) alternatives (from the
   implicit grammar).

   The order in which operands are described is significant, because the
   ordering of operands within an expression is significant.

5.2.2.  WXS:repetition

   The semantics of element WXS:repetition is similar to the ABNF
   Variable Repetition (e.g: *Rule) defined in Section 3.6 of [RFC4234].

   The optional attributes "atleast" and "atmost" indicates minimum and
   maximum allowed occurrences of the described content.

   Default values are atleast="0" and atmost="infinity" so that <WXS:



Godoy & Minni            Expires August 28, 2008               [Page 27]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   repetition> allows any number of occurrences, including zero; <WXS:
   repetition atleast="1"> requires at least one, with no upper limit;
   <WXS:repetition atleast="3" atmost="3"> allows exactly 3 and <WXS:
   repetition atleast="1" atmost="2"> allows one or two.

5.2.3.  WXS:alternative

   The semantics of element WXS:alternative is similar to the ABNF
   Alternatives (e.g: Rule1 / Rule2) defined in Section 3.2 of
   [RFC4234].

   For instance, <WXS:alternative> <WXS:operand-literal/> <WXS:operand-
   typed-literal/> </WXS:alternative> will accept either an operand-
   typed-literal or an operand-literal but not both.

5.2.4.  Implied operator description

   The following query schema describes the operators specified in this
   document, as well as the operators from [I-D.reschke-webdav-search],
   as they would be reported in a QSD response.

   This description is implied, i.e. servers SHOULD NOT include it in
   the response because these operators with these signatures are
   mandatory.


   <search-schema xmlns="DAV:"

     <WXS:opdesc-rule>
       <WXS:operator name="eq"  namespace="DAV:"/>
       <WXS:operator name="gt"  namespace="DAV:"/>
       <WXS:operator name="lt"  namespace="DAV:"/>
       <WXS:operator name="lte" namespace="DAV:"/>
       <WXS:operator name="gte" namespace="DAV:"/>
       <operand-property/>
       <operand-literal/>
     </WXS:opdesc-rule>

     <WXS:opdesc-rule>
       <WXS:operator name="not" namespace="DAV:"/>
       <WXS:operand-nested-op/>
     </WXS:opdesc-rule>

     <WXS:opdesc-rule>
       <WXS:operator name="and" namespace="DAV:"/>
       <WXS:operator name="or"  namespace="DAV:"/>
       <WXS:repetition atleast="1">
         <WXS:operand-nested-op/>



Godoy & Minni            Expires August 28, 2008               [Page 28]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


       </WXS:repetition>
     </WXS:opdesc-rule>

     <WXS:opdesc-rule>
       <WXS:operator name="filter"/>
       <operand-property/>
       <WXS:operand-XPath/>
     </WXS:opdesc-rule>

     <WXS:opdesc-rule>
       <WXS:operator name="is-defined" namespace="DAV:"/>
       <WXS:operator name="is-well-formed"/>
       <operand-property/>
     </WXS:opdesc-rule>

     <WXS:opdesc-rule>
       <WXS:operator name="is-collection" namespace="DAV:"/>
     </WXS:opdesc-rule>

   </search-schema>

   The DAV:is-collection operator is supported because WXS:xml-search
   extends DAV:basicsearch grammar.  It can be expressed by using WXS:
   filter as:


    <WXS:filter>
     <prop><resourcetype/></prop>
     <WXS:xpath>/collection</WXS:xpath>
    </WXS:filter>

   Tests for other resource types, as well as test for no resource type
   may be expressed by the WXS:filter operator (provided that DAV:
   resourcetype is WXS:searchable).  For instance, testing whether a
   resource has no resource type may be expressed as:


    <WXS:filter>
     <prop><resourcetype/></prop>
     <WXS:xpath>count(/*)==0</WXS:xpath>
    </WXS:filter>

5.2.5.  Extended operator description for DAV:typed-literal Operand

   The DAV:eq, DAV:gt, DAV:lt, DAV:lte, and DAV:gte operators MAY accept
   a DAV:typed-literal operand, instead of DAV:literal.  This
   alternative is not implied (i.e. if supported, it MUST be included in
   the QSD response).  If DAV:typed-literal were supported (as defined



Godoy & Minni            Expires August 28, 2008               [Page 29]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   in [I-D.reschke-webdav-search]), the QSD response would include the
   following rule:


     <WXS:opdesc-rule>
       <WXS:operator name="eq"  namespace="DAV:"/>
       <WXS:operator name="gt"  namespace="DAV:"/>
       <WXS:operator name="lt"  namespace="DAV:"/>
       <WXS:operator name="lte" namespace="DAV:"/>
       <WXS:operator name="gte" namespace="DAV:"/>
       <operand-property/>
       <operand-typed-literal/>
     </WXS:opdesc-rule>

5.2.6.  Description of DAV:like Operator

   If the DAV:like operator is supported (as described in Section 5.2.2
   of [I-D.reschke-webdav-search], the following rule MUST be included
   in the QSD:


     <WXS:opdesc-rule>
       <WXS:operator name="like"  namespace="DAV:"/>
       <operand-property/>
       <operand-literal/>
     </WXS:opdesc-rule>

5.3.  Supporting Optional Functions

   Optional XPath functions supported by the server are described by
   means of one or more WXS:function-set elements.  The WXS:function-set
   element may occur:

   - As a child of WXS:xml-search-schema (with the "id" attribute
   setted) defining a set of functions (WXS:function elements) that may
   be referred from several properties.

   - As a child of DAV:propdesc, with the "id" and "idref" attributes
   implied, defining a set of functions (WXS:function elements) that is
   specific for the property being described.

   - As a child of DAV:propdesc, with the "idref" attribute pointing to
   a "global" WXS:xml-search-schema element.


   <!ELEMENT WXS:function-set    (WXS:function*)>

   <!ELEMENT WXS:function        (WXS:function-param*,



Godoy & Minni            Expires August 28, 2008               [Page 30]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                                  WXS:function-result?)>
   <!ELEMENT WXS:function-param   EMPTY >
   <!ELEMENT WXS:function-result  EMPTY >

   <!ATTLIST WXS:function-set    id    ID      #IMPLIED>
   <!ATTLIST WXS:function-set    idref IDREF   #IMPLIED>
   <!ATTLIST WXS:function        name  NMTOKEN #REQUIRED>

   <!ATTLIST WXS:function-param  type        CDATA #REQUIRED
                                 cardinality CDATA #IMPLIED
                                 repeatable (true|false) false>

   <!ATTLIST WXS:function-result type        CDATA #REQUIRED
                                 cardinality CDATA #IMPLIED>
   >


   Each WXS:function element contains zero or more WXS:function-param
   elements, and zero or one WXS:function-result element, describing the
   data type of function's parameters and result.

   The "name" attribute of WXS:function represents the name of the
   function being described.

   The "type" attribute of WXS:function-param and WXS:function-result
   specifies the data type of one function parameter, or the data type
   of the function result, respectively.

   The "cardinality" attribute is used for specifying the cardinality of
   the sequence accepted as parameter or returned as a result.  Its
   allowed values are "?" (zero or one), "*" (zero or more) and "+" (one
   or more), as specified in Section 1.4 of
   [W3C.REC-xpath-functions-20070123].

   The "repeatable" attribute is used for specifying whether a parameter
   may be specified several times.  It allows the values "true" and
   "false", defaulting to "false" when not present.  (Note:
   cardinality="*" states that the actual parameter value may be a
   sequence containing several instances of the specified type, thus it
   is different from repeatable="true".)

   Function name prefixes and type name prefixes are interpreted
   according to the namespaces in scope.  For this purpose, the item
   type, the node types -e.g. node, element-
   [W3C.REC-xpath-datamodel-20070123] and the pseudo-type "numeric" (a
   shorthand for xs:integer, xs:decimal, xs:float and xs:double, defined
   in Section 1.4 of [W3C.REC-xpath-functions-20070123]) are unprefixed,
   and overrides any homonym name in the current default namespace.



Godoy & Minni            Expires August 28, 2008               [Page 31]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   For instance, the following function-set describes: the two-
   parameters version of fn:starts-with, the fn:concat function, and the
   fn:trace function (defined in Section 4, 7.4.1 and 7.5.2 of
   [W3C.REC-xpath-functions-20070123], respectively).


     <WXS:function-set
       xmlns:fn="http://www.w3.org/2005/XPath-functions"
       xmlns:xs="http://www.w3.org/2001/XMLSchema">

       <WXS:function name="fn:starts-with">
         <WXS:function-param  type="xs:string"/>
         <WXS:function-param  type="xs:string"/>
         <WXS:function-result type="xs:boolean"/>
       </WXS:function>

       <WXS:function name="fn:concat">
         <WXS:function-param  type="xs:anyAtomicType"
                              repeatable="true"/>
         <WXS:function-result type="xs:string"/>
       </WXS:function>

       <WXS:function name="fn:trace">
         <WXS:function-param  type="item" cardinality="*"/>
         <WXS:function-param  type="xs:string"/>
         <WXS:function-result type="item" cardinality="*"/>
       </WXS:function>

    </WXS:function-set>

6.  XML Extensibility

   The extensibility mechanism from Section 17 of [RFC4918] (i.e., to
   process received XML documents as if unexpected elements and
   attributes, and all children of unrecognized elements, were not
   present) may be inappropriate when dealing with queries because they
   would not be evaluated as specified by the client (e.g. the query
   criteria may be loosen or the result record or may be incomplete).
   The omission of unexpected content might not be realized by the
   client.

   The QSD response is the preferred method for advertising enhanced
   capabilities for xml-search queries.  Thus clients could assert
   whether an extension is implemented by looking in the QSD beforehand.
   Any extension of this grammar that modifies the query semantics (as
   long as for yielding useless results if the extension were ignored)
   SHOULD univocally identify itself by including one or more elements
   in the QSD response.  If the extension defines several conformance



Godoy & Minni            Expires August 28, 2008               [Page 32]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   degrees, it should be clear from the QSD response which part of the
   extension is actually implemented.

   When an unexpected or unknown element is present in the request, the
   server MUST:
      - Ignore it (and its descendants), if the element is not a
   descendant of DAV:where).  The request is then processed as if the
   element were not there.
      - Fail with status code 422 (Unprocessable Entity) and
   precondition code WXS:unexpected-operator, if the element is a
   descendant of DAV:where).

   The server MUST ignore all unexpected or unknown attributes which
   occurs within expected elements.



   <!ELEMENT WXS:unexpected-operator EMPTY>

7.  Security Considerations

   The security considerations of WebDAV SEARCH
   [I-D.reschke-webdav-search], and WebDAV [RFC4918], as well as those
   of HTTP/1.1 [RFC2616] and XML [RFC3023] are applicable to the WebDAV
   extension described in this document.

   The risk of denial of service attacks is greater than in the DAV:
   basicsearch case, because evaluating some XPath expressions may be
   computationally expensive.  Implementors must be aware that many
   valid (and required, even after subsetting optional XPath features)
   expressions are computationally expensive to evaluate.
   Implementations should deal with these expressions as a possible
   denial of service attack (DOS), which may be committed either by
   intention or by a good faith client submitting an overwhelming query.

   Some examples of this queries include: visiting repeatedly the parent
   and child axes, visiting several nodes with no apparent purpose (e.g.
   a predicate that is evaluated on some other node, unrelated to the
   focus), and requesting a result-set with redundant information (e.g.
   nodes and information derived from those nodes by applying some
   function).

   There are no universally valid rules for determining whether an
   expression is part of a DOS attack.  Indeed, a server may accept an
   expression that is deemed to be useful by the server implementors or
   administrators, while other may reject it because of security
   concerns.  It may also accept or reject an expression because of
   other variables, such as credentials presented by the user when



Godoy & Minni            Expires August 28, 2008               [Page 33]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   authenticating (i.e. some users may be allowed to perform certain
   kind of queries that would have been considered DOS if submitted by
   other user).

   For protecting from false negatives when detecting DOS, servers
   should timeout when queries take too much time before completion.

8.  IANA Considerations

   This document defines XML elements in an XML namespace described by a
   URN conforming the registry mechanism described in [RFC3688].  The
   following URI assignment is requested

   URI: urn:ietf:params:xml:ns:webdav-xml-search

   Registrant Contact: See the "Author's Address" section of this
   document.

   XML: None.  Namespace URIs do not represent an XML specification.

   Reference: The last version of this document.

9.  References

9.1.  Normative References

   [I-D.reschke-webdav-search]         Reschke, J., "Web Distributed
                                       Authoring and Versioning (WebDAV)
                                       SEARCH",
                                       draft-reschke-webdav-search-15
                                       (work in progress),
                                       February 2008.

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

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

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




Godoy & Minni            Expires August 28, 2008               [Page 34]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


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

   [RFC3688]                           Mealling, M., "The IETF XML
                                       Registry", BCP 81, RFC 3688,
                                       January 2004.

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

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

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

   [W3C.REC-xml-names11-20060816]      Hollander, D., Layman, A., Tobin,
                                       R., and T. Bray, "Namespaces in
                                       XML 1.1 (Second Edition)", World
                                       Wide Web Consortium Recommendatio
                                       n REC-xml-names11-20060816,
                                       August 2006, <http://www.w3.org/
                                       TR/2006/
                                       REC-xml-names11-20060816>.

   [W3C.REC-xml11-20060816]            Maler, E., Sperberg-McQueen, C.,
                                       Cowan, J., Paoli, J., Bray, T.,
                                       and F. Yergeau, "Extensible
                                       Markup Language (XML) 1.1 (Second
                                       Edition)", World Wide Web
                                       Consortium Recommendation REC-
                                       xml11-20060816, August 2006, <htt
                                       p://www.w3.org/TR/2006/
                                       REC-xml11-20060816>.

   [W3C.REC-xmlschema-2-20041028]      Malhotra, A. and P. Biron, "XML
                                       Schema Part 2: Datatypes Second



Godoy & Minni            Expires August 28, 2008               [Page 35]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                                       Edition", World Wide Web
                                       Consortium Recommendation REC-
                                       xmlschema-2-20041028,
                                       October 2004, <http://www.w3.org/
                                       TR/2004/
                                       REC-xmlschema-2-20041028>.

   [W3C.REC-xpath-datamodel-20070123]  Fernandez, M., Malhotra, A.,
                                       Nagy, M., Walsh, N., and J.
                                       Marsh, "XQuery 1.0 and XPath 2.0
                                       Data Model (XDM)", World Wide Web
                                       Consortium Recommendation REC-
                                       xpath-datamodel-20070123,
                                       January 2007, <http://www.w3.org/
                                       TR/2007/
                                       REC-xpath-datamodel-20070123>.

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

   [W3C.REC-xpath20-20070123]          Berglund, A., Boag, S.,
                                       Chamberlin, D., Kay, M., Robie,
                                       J., Fernandez, M., and J. Simeon,
                                       "XML Path Language (XPath) 2.0",
                                       World Wide Web Consortium Recomme
                                       ndation REC-xpath20-20070123,
                                       January 2007, <http://www.w3.org/
                                       TR/2007/REC-xpath20-20070123>.

9.2.  Informative References

   [RFC4234]                           Crocker, D., Ed. and P. Overell,
                                       "Augmented BNF for Syntax
                                       Specifications: ABNF", RFC 4234,
                                       October 2005.

   [W3C.REC-xquery-20070123]           Boag, S., Robie, J., Chamberlin,
                                       D., Fernandez, M., Florescu, D.,
                                       and J. Simeon, "XQuery 1.0: An
                                       XML Query Language", World Wide
                                       Web Consortium Recommendation REC
                                       -xquery-20070123, January 2007, <



Godoy & Minni            Expires August 28, 2008               [Page 36]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                                       http://www.w3.org/TR/2007/
                                       REC-xquery-20070123>.

Editorial Comments

   [error-DEP]                     Besides, handling dynamic errors on a
                                   separate basis imposes an additional
                                   requirement, then supporting this
                                   feature is left to the criteria of
                                   implementors.

   [note-comparison-complex-type]  This seems to be a MUST in
                                   [draft-reschke-webdav-search-14]
                                   Section 5.5.4, but is relaxed here
                                   since the property would be treated
                                   as xs:string if the type were
                                   ignored.

   [note-context-position]         When supporting numeric predicates
                                   and context position references there
                                   is a trade-off between expressive
                                   power and implementation costs.

   [note-intent]                   The authors' motivation for writing
                                   this document is allowing metadata to
                                   be searchable when presented as a
                                   WebDAV property.  Since it may be
                                   encoded as specified by a third-party
                                   schema,  it should not be modified in
                                   order to conform WebDAV.

   [note-namespace]                Since this protocol is experimental,
                                   the authors do not suggest new
                                   elements in order to not pollute the
                                   "DAV:" namespace. Thus, an
                                   experimental implementation of this
                                   protocol will not conflict with the
                                   following requirement from RFC 4918:
                                   "(...) an XML element in the "DAV:"
                                   namespace SHOULD NOT be used in the
                                   request or response body unless that
                                   XML element is explicitly defined in
                                   an IETF RFC reviewed by a WebDAV
                                   working group".

   [note-opdesc]                   The operator description is only
                                   intended for discovering whether the
                                   server implements an extension



Godoy & Minni            Expires August 28, 2008               [Page 37]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


                                   operator. The DAV:operators element
                                   from [I-D.reschke-webdav-search] is
                                   not adopted here,  because it cannot
                                   describe the mandatory operators. On
                                   the other hand, while XML Schemas
                                   would have sufficed for this purpose,
                                   this approach would have required
                                   WXS:xml-search clients to be in
                                   conformance to the XML Representation
                                   of Schemas, which is much more than
                                   necessary for achieving the above
                                   mentioned goal (given that the
                                   operators are not too complex). The
                                   chosen approach is compared to ABNF,
                                   in order to avoid further relation
                                   with features that are available in
                                   XML schemas but are unsupported for
                                   xml-search-schema descriptions.

   [note-OPTIONAL-404]             The 404 status code for missing
                                   properties is OPTIONAL in order to
                                   avoid an extensive response if the
                                   client selects several properties
                                   that are seldom defined.  Note this
                                   behaviour is different from the
                                   PROPFIND case, where the 404 status
                                   code is REQUIRED for missing
                                   properties (Section 9.1 of [RFC
                                   4918], page 35).

   [note-RFC4918-sect17]           RFC4918: "(...) servers MUST process
                                   received XML  documents as if
                                   unexpected elements and attributes
                                   (and all children of unrecognized
                                   elements) were not there"

   [note-select-prop-filter]       If the property value is not well-
                                   formed XML specifying both DAV:prop
                                   and WXS:filter is ambiguous because a
                                   409 (Conflict) status code must be
                                   returned per WXS:filter and the
                                   complete property value must be
                                   returned per DAV:prop.  On the other
                                   hand, if the property value were
                                   well-formed XML, one of those
                                   elements would have to be ignored.

Appendix A.  Example WXS:xml-search query



Godoy & Minni            Expires August 28, 2008               [Page 38]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   This example shows a request/response exchange for selecting the DAV:
   getcontentlength property and the <M:title> and first <M:author>
   elements of the <M:metadata> property, from resources that are
   directly contained in the http://host.example.com/ collection, such
   that the title (as described by an M:title element within the
   M:metadata property) starts with letter "S".  The first results will
   have at least one M:author element present.

   The response describes two resources:
      - foo.pdf, with DAV:getcontentlength = 65536, author = "John Doe"
   and title = "Sample Title"
      - bar.txt, with DAV:getcontentlength = 1024, title = "Sample
   Anonymous Resource" and no author.

   Request:

   SEARCH / HTTP/1.1
   Host: host.example.com
   Content-Type: application/xml
   Content-Length: xxx

   <searchrequest xmlns="DAV:">
     <WXS:xml-search xmlns="DAV:"
        xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search"
        xmlns:M ="http://example.org/metadata">
       <select>
         <WXS:filter>
           <prop><M:metadata/></prop>
           <WXS:xpath>/M:author[1]|/M:title</WXS:xpath>
         </WXS:filter>
         <prop><getcontentlength/></prop>
       </select>
       <from>
         <scope>
           <href>http://host.example.com/</href>
           <depth>1<depth>
         </scope>
       </from>
       <where>
         <WXS:filter>
           <prop><M:metadata/></prop>
           <WXS:xpath>starts-with(/M:title,'S')</WXS:xpath>
         </WXS:filter>
       </where>
       <orderby>
         <order>
           <WXS:filter>
             <prop><M:metadata/></prop>



Godoy & Minni            Expires August 28, 2008               [Page 39]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


             <WXS:xpath>/M:author</WXS:xpath>
           </WXS:filter>
           <descending>
         </order>
       </orderby>
     </WXS:xml-search>
   </searchrequest>

   Response:

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

   <multistatus xmlns="DAV:"
      xmlns:WXS="urn:ietf:params:xml:ns:webdav-xml-search"
      xmlns:M ="http://example.org/metadata" >
     <response>
       <href>http://host.example.com/foo.pdf</href>
       <propstat>
         <prop>
           <getcontentlength>65536</getcontentlength>
           <M:metadata>
             <M:author>John Doe</M:author>
             <M:title>Sample title</M:title>
           </M:metadata>
         </prop>
         <status>HTTP/1.1 200 OK<status>
       </propstat>
     </response>
     <response>
       <href>http://host.example.com/bar.txt</href>
       <propstat>
         <prop>
           <getcontentlength>1024</getcontentlength>
           <M:metadata>
             <M:title>Sample Anonymous Resource</M:title>
           </M:metadata>
         </prop>
         <status>HTTP/1.1 200 OK<status>
       </propstat>
     </response>
   </multistatus>

Appendix B.  Reported Issues

B.1.  Editorial Issues




Godoy & Minni            Expires August 28, 2008               [Page 40]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   Issue #E1, reported by Michael Kay on 2008-01-21.
   http://lists.w3.org/Archives/Public/www-xpath-comments/2008JanMar/
   0001.html, item (a).
   http://lists.w3.org/Archives/Public/public-qt-comments/2008Jan/
   0096.html, item (a).
   Reference to XPath 2.0 Proposed Recommendation of 2006-11-21 should
   be modified to refer Recommendation of 2007-01-23 2007.  Suggest
   avoid referring to a specifically dated version, so that readers are
   referred to the latest edition at any given time, which may
   incorporate errata.
   Resolution: Refer XPath 2.0 Recommendation of 2007-01-23 (in turn, it
   already suggests readers to check the latest version and errata).
   Revisit this issue later with the RFC editor.

   Issue #E2, reported by Michael Kay on 2008-01-21.
   http://lists.w3.org/Archives/Public/www-xpath-comments/2008JanMar/
   0001.html, item (c).
   http://lists.w3.org/Archives/Public/public-qt-comments/2008Jan/
   0096.html, item (c).
   Since the namespace prefix "xs" is often used to refer to the XML
   Schema namespace, it might be clearer to readers if a prefix other
   than "XS" is used (perhaps "WXS"?).
   Resolution: replace XS prefix with WXS.

B.2.  Technical Issues

   Issue #T1, reported by Michael Kay on 2008-01-21.
   http://lists.w3.org/Archives/Public/www-xpath-comments/2008JanMar/
   0001.html, item (e).
   http://lists.w3.org/Archives/Public/public-qt-comments/2008Jan/
   0096.html, item (e).
   Suggest requiring the same subset of axes as XQuery chose.
   Resolution: include descendant, descendant-or-self and parent as
   REQUIRED axes (thus aligning with XQuery required axis).  The
   namespace axis is deprecated in XQuery, such deprecation is not
   inherited by xmlsearch but the namespace axis is made OPTIONAL.

   Issue #T2, reported by Michael Kay on 2008-01-21.
   http://lists.w3.org/Archives/Public/www-xpath-comments/2008JanMar/
   0001.html, item (f).
   The minimum set of functions that an implementation must supply is
   defined as being empty (no functions).  There are some functions such
   as not() and count() that would be absolutely indispensable.
   Resolution: Include fn:not(item,item,...), fn:count(item,item,...),
   fn:exists(item,item,...), fn:empty(item,item,...), fn:root(node). fn:
   root(node) is supported because of the expansion for "/" and "//".
   The default function namespace is set to "fn".  The QSD is extended
   for describing other functions that MAY be optionally supported.



Godoy & Minni            Expires August 28, 2008               [Page 41]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


Appendix C.  Change log (To be removed by RFC Editor before publication)

C.1.  changes in draft-godoy-webdav-xmlsearch-01

   - Include appendix B (reported issues) and C (change log).

   - Removed typo about "DAV:xsl-search-schema", which does not exist.

   - New issues in this version: #E1, #E2, #T1, #T2.

   - Issues addressed in this version: #E1, #E2, #T1, #T2

   - Some Security Considerations.

   - Minor editorial changes.

C.2.  changes in draft-godoy-webdav-xmlsearch-02

   - Minor editorial changes.

   - Updated reference to draft-reschke-webdav-search-15.

   - Added allow-pcdata attribute in WXS:opdesc-rule, and modified
   section about Literal Operands, per issues addressed in
   draft-reschke-webdav-search-15 (discussion in http://lists.w3.org/
   Archives/Public/www-webdav-dasl/2008JanMar/0022.html).

   - Simplified the extension mechanism, because it was too complex to
   be practical.  Renamed precondition WXS:unexpected-content as WXS:
   unexpected-operator.

Index

   A
      Attribute
         allow-pcdata (WXS:opdesc-rule)  25
         atleast (WXS:repetition)  25
         atmost (WXS:repetition)  25
         attrname (WXS:unexpected-content element)  33
         cardinality (WXS:function-param)  30
         cardinality (WXS:function-result)  30
         id (WXS:function-set)  30
         id (WXS:xpath)  15
         idref (WXS:function-set)  30
         idref (WXS:warning)  10
         idref (WXS:xpath-error)  11
         name (WXS:axis)  24
         name (WXS:function)  30



Godoy & Minni            Expires August 28, 2008               [Page 42]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


         name (WXS:operator)  25
         namespace (WXS:operator)  25
         repeatable (WXS:function-param)  30
         type (WXS:function-param)  30
         type (WXS:function-result)  30

   D
      Dynamic Context  5
      Dynamic Error  5
      Dynamic Evaluation Phase (DEP)  5

   E
      Element
         DAV:and  15
         DAV:multistatus  11
         DAV:not  15
         DAV:or  15
         DAV:order  15
         DAV:propdesc  24
         DAV:response  11
         DAV:search-scope-valid  23
         DAV:select  15
         DAV:where  15
         WXS:acceptable-role  23
         WXS:alternative  25
         WXS:axis  24
         WXS:filter  15
         WXS:function  30
         WXS:function-param  30
         WXS:function-result  30
         WXS:function-set  30
         WXS:is-well-formed  15
         WXS:known-literal-type  23
         WXS:opdesc-rule  25
         WXS:operand-nested-op  25
         WXS:operand-XPath  25
         WXS:operator  25
         WXS:property-must-be-well-formed-xml  22
         WXS:repetition  25
         WXS:searchable  24
         WXS:selectable  24
         WXS:sortable  24
         WXS:unexpected-content  33
         WXS:warning  10
         WXS:xml-search  15
         WXS:xml-search-schema  24
         WXS:XPath  15
         WXS:XPath-error  23



Godoy & Minni            Expires August 28, 2008               [Page 43]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


         WXS:xpath-error  11
      Example
         Bad Request, DAV:select  18
         DASL Response Header  13
         DAV:supported-query-grammar-set  14
         Description of DAV:like Operator  30
         Extended operator description for DAV:typed-literal operand  30
         Implied operator description  28
         QSD request  14
         QSD response  14
         WXS:function-set  32
         WXS:opdesc-rule  26-27
         WXS:XPath-error (in DEP)  12
         WXS:XPath-error (in SAP)  11
         xml-search request  39
         xml-search response  40

   I
      Implementation-defined  5
      Implementation-dependent  5

   R
      Role  5

   S
      Static Analysis Phase (SAP)  5
      Static Context  5
      Static Error  6

   T
      Type Error  6

Authors' Addresses

   Roberto Javier Godoy
   UNL - Facultad de Ingenieria y Ciencias Hidricas
   Ciudad Universitaria, Ruta Nac. 168
   S3001XAI  Paraje "El Pozo"
   Argentina

   EMail: rjgodoy@fich.unl.edu.ar
   URI:   http://purl.oclc.org/NET/rjgodoy


   Hugo Minni
   UNL - Facultad de Ingenieria y Ciencias Hidricas
   Ciudad Universitaria, Ruta Nac. 168
   S3001XAI  Paraje "El Pozo"



Godoy & Minni            Expires August 28, 2008               [Page 44]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


   Argentina

   EMail: hminni@fich.unl.edu.ar
















































Godoy & Minni            Expires August 28, 2008               [Page 45]

Internet-Draft  WebDAV Search Grammar for XML Properties   February 2008


Full Copyright Statement

   Copyright (C) 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.

Intellectual Property

   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
   ietf-ipr@ietf.org.

Acknowledgement

   Funding for the RFC Editor function is provided by the IETF
   Administrative Support Activity (IASA).







Godoy & Minni            Expires August 28, 2008               [Page 46]