Revision [1846]

This is an old revision of MarkLogicPut made by DavidLee on 2012-06-12 14:43:11.

 

Mark Logic Command: put

Puts a document onto a Mark Logic server.

Synopsis

put [options] [file | expression ] ...

Description

Puts a file (or expression) from the local system onto a Mark Logic server.


Options

-c,-connect uriUse the connection string instead of $MLCONNECT
-uri uriUse the specified uri as the uri of the destination document,
Otherwise uses the base uri of the file or expression.
-baseuri base-uriUse the specifed base uri instead of the base URI from the file or expression
-r,-recurseRecursively put directories. If any argument is a directory then it is recursed
-m,-maxfiles numSend files in batch at must num files in one transaction
-t,-textStores the document as "text" content type
-b,-binaryStores the document as "binary" content type
-x,-xmlStores the document as "xml" content type
-d,-mkdirsCreate directories as needed. Only creates direct parent directories of documents
-maxthreads nUse at most n threads, default=1
-collection name [-collection name2 ...]Put document(s) in the named collection(s)
-forest id [-forest id2 ...]Put document(s) in the forest(s) specified by ID
-perm,-permission perm [-perm perm ...]Apply the permission(s) to the document(s)
-repair none|full|defaultSpecify the repair mode
-buffer sizeSet the transfer buffer size
-language langSet the language
-md5Store an xmd5 property with the document
-namespace namespaceSet the document namespace
-resolve,+resolveResolve (do not Resolve) Entities before storing the document
-quality qualitySet the document quality
-locale localeSet the locale
-f,-filenames fileUse a file (or stdin in "-") to specify the list of files to put
-deleteDeletes file after successfully putting to marklogic.
-stream portReads documents from the named port.
expression | fileThe file (or expression , variable, port or url) to put to the Mark Logic server.


If file is omitted then stdin is used.
If neither -x, -t or -b is specified then the content type is determined by the server.


Examples

Assuming the prefix "ml" is imported as the marklogic module.

Put the file "test.xml" using its full path as the uri
ml:put test.xml 


Puts the file "test.xml" using the uri "myfile.xml"
ml:put -uri myfile.xml test.xml


Puts the dynamic document <foo/> to the ML server using the uri "test.xml"

ml:put -uri test.xml <[ <foo/> ]> 


Puts the result of an xquery (via stdin) to the Mark Logic server using the uri "test.xml"
xquery -q 'myquery.xquery' -i input.xml | ml:put -uri test.xml


Copies an entire directory tree "modules" to the /modules/ directory on the ML server, using at most 100 files per batch
ml:put -baseuri / -r -m 100 modules


Inserts a document into 2 collections
ml:put -uri test.xml -collection foo -collection bar test.xml


Permissions

Permissions can be specified with the -permission (or -perm) option. Permissions take the form of
*capability:role*

Capibility may be one of
Role is the role name

Example, add a document with read and update capability to the "user" role
ml:put -uri test.xml -perm read:user -perm u:user test.xml


If the -md5 option is set then a property is stored with the document of the form
<xmd5 md5="md5checksum" length="length" />

This can be used to implement an efficient "sync" command which only updates the destination if it has changed.


Notes

Like most xmlsh commands, anywhere an input file is expected, a file, uri, expression, port, or variable expression may be used instead.

For detailed explanation of all the options, see the MarkLogic XCC Developers Guide and the XCC Package Summary.

The put command uses the XCC Session.insertContent API.


Streaming


Careful use of the -filenames option can allow streaming multithreaded puts. The filenames are read and put (possibly batched by the -m and -maxthreads options) as they are read. If this comes from a pipe (like stdin) the list of files can be generated dynamically by a streaming process such as xsplit. This allows large xml files or sets of files to be streamed to a MarkLogic server as they are generated.

Note that if -mkdirs is specifed with -filenames then the list of files must be read in its entirety so that directories can be precreated before any files are put. This negates the ability to stream the puts as the filenames are read.



MarkLogic Extension Module
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki