This page was generated
August  8,  2011
2:24  AM
XQuery Built-In and Modules Function Reference

Module: Library Services - cts:query Constructor Functions

Functions to return cts:query constructors.
Function Summary
dls:as-of-query This function returns a query that matches the most recent numbered version of documents that were created before the specified date and time.
dls:author-query This function returns a query that matches documents authored by the specified user.
dls:document-include-query This function returns a query that matches any managed document that has an XInclude link that exactly matches the specified URI.
dls:document-version-query This function returns a query that matches the specified version of the managed documents.
dls:document-versions-query This function returns a query that matches any version of the specified URI.
dls:documents-query This function returns a query that matches the latest versions of the managed documents in the database.
Function Detail
dls:as-of-query(
$when as xs:dateTime
)  as   cts:properties-query
Summary:

This function returns a query that matches the most recent numbered version of documents that were created before the specified date and time.

Parameters:
$when : The date and time before which the documents were created.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:as-of-query(xs:dateTime(fn:current-dateTime())))
  
  (: Returns the versions of the managed documents that were created before the
     specified date and time. :)
    

dls:author-query(
$author as xs:unsignedLong
)  as   cts:properties-query
Summary:

This function returns a query that matches documents authored by the specified user.

Parameters:
$author : The id of the user who authored the documents.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:author-query(xdmp:user("Jim")))

  (: Returns all of the documents authored by 'Jim'. :)
    

dls:document-include-query(
$uri as xs:string
)  as   cts:query
Summary:

This function returns a query that matches any managed document that has an XInclude link that exactly matches the specified URI.

Parameters:
$uri : The URI of the linked-to document.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:document-include-query("/foo.xml"))

  (: Returns the contents of the documents that contain an XInclude to the
     '/foo.xml' document. :)
   

dls:document-version-query(
$version as xs:unsignedLong
)  as   cts:properties-query
Summary:

This function returns a query that matches the specified version of the managed documents.

Parameters:
$version : The version of the managed documents.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:document-version-query(3))

  (: Returns Version 3 of all of the managed documents in the database. :)
    

dls:document-versions-query(
$uri as xs:string
)  as   cts:properties-query
Summary:

This function returns a query that matches any version of the specified URI. If the URI contains either of the wildcard characters '?' or '*', then the search is wildcarded. Specifying '*' matches any numbered version of any managed document.

Parameters:
$uri : The URI of the document.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:document-versions-query("/foo/bar/baz.xml"))

  (: Returns the contents of all versions of the 'baz.xml' document. :)
     

dls:documents-query(  ) as  cts:properties-query
Summary:

This function returns a query that matches the latest versions of the managed documents in the database.

Required Privilege:

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example:
  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  cts:search(fn:doc(), dls:documents-query()) 
 
  (: Returns the latest versions of the managed documents in the database. :)