|
|
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")
|
|
|
|
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. Otherwise, the function
replaces the content in the existing file as an update operation.
|
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. 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.
|
|
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()). 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.
<lang>
- A value of
en specifies that the document is
in english.
<forests>
- Specifies the ID of the forest in which this document is inserted.
Each forest ID is in a 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.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-document-load and
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.
|
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, the unprotected-uri privilege
(only if the URI is not protected), the any-uri privilege, or an
appropriate URI privilege is also needed.
|
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:
Aquire 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))
=> ()
|
|
|