|
|
xdmp:directory-create(
|
|
$uri as xs:string,
|
|
[$permissions as element(sec:permission)*],
|
|
[$collections as xs:string*],
|
|
[$quality as xs:int]
|
| ) as empty() |
|
 |
Summary:
Creates a directory. If security is enabled,
the document permissions and collections are set to the given parameters,
if supplied. Otherwise, the current user's default permissions and/or
collections are applied. If the beginning of the the document URI is
protected, the user must have access to that URI privilege. If the
directory URI does not end with a '/' one is added. If the directory already
exists, then nothing is done.
|
Parameters:
$uri
:
The URI of the directory to be inserted.
|
$permissions
(optional):
Security permission elements corresponding to the permissions
for the document.
|
$collections
(optional):
The collections to which the new directory belongs.
|
$quality
(optional):
The quality of this document. A positive value increases
the relevance score of the document in text search functions.
The converse is true for a negative value. The default value is 0.
|
|
Example:
xdmp:directory-create("http://marklogic.com/a/",
(xdmp:permission("development", "update"),
xdmp:permission("qa", "read")),
"http://marklogic.com/directories")
=> Creates a directory named "http://marklogic.com/a/",
which has the parent directory "http://marklogic.com/".
The directory is created with the specified permissions,
and is added to the "http://marklogic.com/directories"
collection.
|
Example:
xdmp:directory-create("/dir/myDirectory/")
=> Creates a directory named "/dir/myDirectory/",
which has the parent directory "/dir/", which
in turn has parent directory "/". If
directory creation is set to automatic in
the database configuration, this example creates
all three directories ("/", "/dir/", and
"/dir/myDirectory/").
|
|
|
|
xdmp:document-insert(
|
|
$uri as xs:string,
|
|
$root as node(),
|
|
[$permissions as element(sec:permission)*],
|
|
[$collections as xs:string*],
|
|
[$quality as xs:int],
|
|
[$forest-ids as xs:unsignedLong*]
|
| ) as empty() |
|
 |
Summary:
Inserts a new document into the database if a document with the
specified URI does not already exist. If a document already exists
at the specified URI, the function replaces the content of the existing
document with the specified content (the $root parameter)
as an update operation. In addition to replacing the content,
xdmp:document-insert replaces any permissions, collections,
and quality with the ones specified (or with the default values for these
parameters, if not explicitly specified). Also, if a properties
document exists at the same URI, that properties document (including any
content it contains) is preserved.
|
Parameters:
$uri
:
The URI of the document to be inserted.
|
$root
:
The root node. The root node can be one of XML format, binary (BLOB)
format, or text (CLOB) format.
|
$permissions
(optional):
Security permission elements corresponding to the permissions
for the document. If not supplied, the current user's default
permissions are applied. The default value used for $permissions
can be obtained by calling xdmp:default-permissions().
|
$collections
(optional):
The collection URIs for collections to which this document
belongs. If not supplied, the document is added to the current
user's default collections. For each collection that is protected, the
user must have permissions to update that collection or have the
any-collection privilege. For each unprotected collection,
the user must have the unprotected-collections privilege.
The default value used for $collections can be obtained by calling
xdmp:default-collections().
|
$quality
(optional):
The quality of this document. A positive value increases
the relevance score of the document in text search functions.
The converse is true for a negative value. The default value is 0.
|
$forest-ids
(optional):
Specifies the ID of the forest in which this document is inserted.
If the document already exists in the database and if $forest-ids is
not specified, it will remain in its existing forest. If no such
forest exists, an error is raised. If multiple forests are
specified, the document is inserted into one of the specifed forests.
|
|
Required Privilege:
If a new document is inserted, the unprotected-uri privilege
(only if the URI is not protected), the any-uri privilege, or an
appropriate URI privilege is also needed.
If adding an unprotected collection to a document, the
unprotected-collections privilege
(http://marklogic.com/xdmp/privileges/unprotected-collections)
is needed; if adding a protected collection, the user must have either
permissions to update the collection or the
any-collection privilege
(http://marklogic.com/xdmp/privileges/any-collection).
|
Example:
xdmp:document-insert(
"/example.xml", <a>aaa</a>,
(xdmp:permission("editor", "read"),
xdmp:permission("editor", "update")),
"http://examples.com")
|
Example:
xdmp:document-insert(
"/example.xml",
<a>aaa</a>,
xdmp:default-permissions(),
xdmp:default-collections(),
10)
|
|
|
|
xdmp:document-load(
|
|
$location as xs:string,
|
|
[$options as node()]
|
| ) as empty() |
|
 |
Summary:
Inserts a new document with the specified URI. If a document already exists
at the URI, the function replaces the content in the existing document as
an update operation.
|
Parameters:
$location
:
The location of the input document. If the scheme of the location is
HTTP (that is, if the string starts with "http://"), then the document is
requested over HTTP. Otherwise, the document is fetched from the local
filesystem. On the filesystem, the path can be fully qualifed or relative.
Relative pathnames are resolved from the directory in which
MarkLogic Server is installed.
|
$options
(optional):
The options node for this load operation. The default value is ().
The node for the xdmp:document-load options must be in the
xdmp:document-load namespace. This parameter can also include
option elements in the xdmp:http namespace for the HTTP
parameters.
The xdmp:document-load options include:
<uri>
- The URI of the document to be loaded. If omitted, then the location
is used for the URI.
<permissions>
- Security permission elements corresponding to the permissions for the
document. If not supplied, the current user's default permissions are
applied. The default value used for $permissions can be obtained by
calling
xdmp:default-permissions().
<collections>
- The collection URIs for collections to which this document belongs.
If not supplied, the document is added to the current user's default
collections (the collections returned from
xdmp:default-collections()). For each collection that is
protected, the user must have permissions to update that collection
or have the any-collection privilege. For each unprotected
collection, the user must have the unprotected-collections
privilege. The
<collections> element consists of one or more
<collection> child elements. For example:
<collections>
<collection>myCollection1</collection>
<collection>myCollection2</collection>
</collections>
<quality>
- The quality of this document. A positive value increases the
relevance score of the document in text search functions. The converse is
true for a negative value. The default value is 0.
<default-namespace>
- The namespace to use if there is no namespace at the root node of
the document. The default value is "".
<repair>
- A value of
full specifies that malformed XML
content be repaired. A value of none specifies that
malformed XML content is rejected. This option has no effect on
binary or text documents.
<format>
- A value of
text specifies to get the document as a text
document, regardless of the URI specified. A value of
binary specifies to get the document as a binary
document, regardless of the URI specified. A value of xml
specifies to get the document as an XML document, regardless of the
URI specified.
<default-language>
- The language to specify in an
xml:lang attribute on the
root element node if the root element node does not already have an
xml:lang attribute. If default-language is
not specified, then nothing is added to the root element node.
<forests>
- Specifies the ID of the forest in which this document is inserted.
Each forest ID is in the <forest> child element and is of
type
xs:unsignedLong. If the document already exists
in the database, it will remain in its existing forest. If no such
forest exists, an error is raised. If multiple forests
are specified, the document is inserted into one of the specifed
forests.
<encoding>
- Specifies the encoding to use when reading the document into MarkLogic
Server. Supported values include
UTF-8 and
ISO-8859-1. All encodings will be translated into UTF-8
from the specified encoding. The string specifed for the
encoding option will be matched to an encoding name according
to the Unicode Charset Alias Matching rules
(http://www.unicode.org/reports/tr22/#Charset_Alias_Matching).
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-document-load
If a new document is inserted, you also need the
unprotected-uri privilege (only if the URI is not protected),
the any-uri privilege, or an appropriate URI privilege.
If adding an unprotected collection to a document, the
unprotected-collections privilege
(http://marklogic.com/xdmp/privileges/unprotected-collections)
is needed; if adding a protected collection, the user must have either
permissions to update the collection or the
any-collection privilege
(http://marklogic.com/xdmp/privileges/any-collection).
|
Example:
xdmp:document-load("c:\myFile.xml",
<options xmlns="xdmp:document-load">
<uri>/documents/myFile.xml</uri>
<repair>none</repair>
<permissions>{xdmp:default-permissions()}</permissions>
</options>)
=> Loads the document with a URI "/documents/myFile.xml"
and does not perform tag repair during the load.
|
Example:
xdmp:document-load("http://myCompany.com/file.xml",
<options xmlns="xdmp:document-load"
xmlns:http="xdmp:http">
<uri>/documents/myFile.xml</uri>
<repair>none</repair>
<permissions>{xdmp:default-permissions()}</permissions>
<format>xml</format>
<http:authentication>
<http:username>user</http:username>
<http:password>pass</http:password>
</http:authentication>
</options>)
=> Loads the document with a URI "/documents/myFile.xml"
from the server http://myCompany.com, sending the
credentials user/pass. Tag repair is not performed
during the load, and the document is loaded as xml.
|
Example:
xdmp:document-load("c:\myFile.xml",
<options xmlns="xdmp:document-load">
<uri>/documents/myFile.xml</uri>
<permissions>{xdmp:default-permissions()}</permissions>
<collections>
<collection>myCollection1</collection>
<collection>myCollection2</collection>
</collections>
<repair>full</repair>
<forests>
<forest>{xdmp:forest("myForest")}</forest>
</forests>
</options> )
=> Loads the document with a URI "/documents/myFile.xml"
performing tag repair during the load, adding the
document to the "myCollection1" and "myCollection2"
collections, and loading the document into the forest
named "myForest".
|
|
|
|
xdmp:load(
|
|
$path as xs:string,
|
|
[$uri as xs:string],
|
|
[$permissions as element(sec:permission)*],
|
|
[$collections as xs:string*],
|
|
[$quality as xs:int],
|
|
[$default-namespace as xs:string],
|
|
[$options as xs:string*],
|
|
[$forest-ids as xs:unsignedLong*]
|
| ) as empty() |
|
 |
Summary:
[DEPRECATED] Inserts a new document from the XML file at $path if a document
with the specified URI does not already exist. Otherwise, the
function replaces the content in the existing document as an update
operation.
|
Parameters:
$path
:
The path to the input file. The path can be fully qualifed or relative.
Relative pathnames are resolved from the directory in which
MarkLogic Server is installed.
|
$uri
(optional):
The URI of the document to be loaded.
If omitted, then the pathname is used.
|
$permissions
(optional):
Security permission elements corresponding to the permissions
for the document. If not supplied, the current user's default
permissions are applied. The default value used for $permissions
can be obtained by calling xdmp:default-permissions(). To specify
no permissions, enter the empty sequence ().
|
$collections
(optional):
The collection URIs for collections to which this document
belongs. If not supplied, the document is added to the current
user's default collections. The default value used for $collections
can be obtained by calling xdmp:default-collections(). To specify
no collections, enter the empty sequence ().
|
$quality
(optional):
The quality of this document. A positive value increases
the relevance score of the document in text search functions.
The converse is true for a negative value. The default value is 0.
|
$default-namespace
(optional):
If $default-namespace is specified and the root node of the
loaded document does not explicitly specify a namespace,
$default-namespace will be applied to the root node.
The default value for $default-namespace is "".
|
$options
(optional):
The options for loading this document.
The default value is ().
Options include:
- "repair-full"
- Specifies that malformed XML content be repaired during loading.
This option has no effect on binary or text documents.
- "repair-none"
- Specifies that malformed XML content be rejected during loading.
This option has no effect on binary or text documents.
- "format-text"
- Specifies to load the document as a text document,
regardless of the URI specified.
- "format-binary"
- Specifies to load the document as a binary document,
regardless of the URI specified.
- "format-xml"
- Specifies to load the document as an XML document,
regardless of the URI specified.
- "lang=en"
- Specifies that the document is in english.
|
$forest-ids
(optional):
Specifies the ID of the forest in which this document is inserted.
If the document already exists in the database, it will remain in
its existing forest. If no such forest exists, an error is
raised. If multiple forests are specified, the document is inserted into
one of the specifed forests.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-load
If a new document is inserted, you also need the
unprotected-uri privilege (only if the URI is not protected),
the any-uri privilege, or an appropriate URI privilege.
|
Usage Notes:
If no format is specified in $options, it is specified by the
document content type specified by the extension of the document URI.
The mimetype extensions and corresponding content types are set in the
Admin console.
If neither "repair-full" nor "repair-none" is present,
malformed XML content will be repaired.
|
Example:
xdmp:load("/home/test/example.xml", "/example.xml",
(xdmp:permission("editor", "read"),
xdmp:permission("editor", "update")),
"http://examples.com",
10,"http://www.marklogic.com/default")
|
Example:
xdmp:load("/home/test/example.xml",
"/example.xml",
xdmp:default-permissions(),
xdmp:default-collections(),
0,
"",
"repair-none")
|
|
|
|
xdmp:lock-acquire(
|
|
$uri as xs:string,
|
|
[$scope as xs:string],
|
|
[$depth as xs:string],
|
|
[$owner as item()],
|
|
[$timeout as xs:unsignedLong?]
|
| ) as empty() |
|
 |
Summary:
Acquire a lock on a document or directory for an extended amount of time.
Locks restrict updates to a document or directory to the user who acquires
the lock.
|
Parameters:
$uri
:
The URI of the document or directory to be locked.
|
$scope
(optional):
The lock scope ("exclusive" or "shared").
|
$depth
(optional):
The lock depth ("0" or "infinity"). "0" locks the URI only, and "infinity"
locks the URI (the document or directory) and all of its children.
|
$owner
(optional):
Alternate description of the lock owner.
|
$timeout
(optional):
Requested lock timeout in seconds (() for infinite).
|
|
Usage Notes:
If you lock a directory specifying a depth of "infinity", the directory
and all of it children (all documents and directories with a URI started with
the locked directory) are locked. You will not be able to add any children
to the directory until the lock is released.
When a user locks a URI, it is locked to other users, but not to the user
who locked it. For example, if the user sam locks the URI
/home/sam.xml by issuing the statement
xdmp:lock-acquire("/home/sam.xml"), the user sam
can still issue update commands to the document at that URI, but other users
(for example, the user josh) will get an exception if they try
to update the document.
|
Example:
xdmp:lock-acquire("/example.xml",
"exclusive",
"0",
<DAV:href>http://example.com/~user</DAV:href>,
xs:unsignedLong(120))
=> ()
|
|
|
|
xdmp:merge(
|
|
[$options as node()]
|
| ) as empty() |
|
 |
Summary:
Starts merging the forests of the database, subject to specified
options.
|
Parameters:
$options
(optional):
The options node for this merge. The default value is ().
The node for the xdmp:merge options must be in the
xdmp:merge namespace.
The xdmp:merge options include:
<merge-max-size>
- The maximum allowable size, in megabytes, of a resultant stand
<merge-timestamp>
- Fragments with a timestamp of this or newer are not garbage collected
during this merge
<single-stand>
- If any forests in the database have a single stand and this parameter
is false, do not merge them.
<forests>
- Specifies the IDs of the forests in which to perform merges.
Each forest ID is in the <forest> child element and is of
type
xs:unsignedLong.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-merge
|
Example:
xdmp:merge(<options xmlns="xdmp:merge">
<merge-max-size>10</merge-max-size>
<timestamp>8273</timestamp>
<single-stand>false</single-stand>
<forests>
<forest>{xdmp:forest("my-forest")}</forest>
<forest>{xdmp:forest("my-other-forest")}</forest>
</forests>
</options>)
=> ()
Performs a merge on my-forest and my-other-forest (assuming
they are in the database). If a stand created by this
merge would be greater than 10 megabytes, the merge will be
limited and not all stands will be merges (as many as can
be merged under 10 MB will be merged). If my-forest or
my-other-forest have only one stand, they will not be
merged. Any fragments with timestamp 8273 or newer will
not be garbage collected.
|
|
|