Additions:
====URIs====
If the uri contains {random} it will be replaced by a random number.
If the uri contains {seq} it will be replaced by the by an incrementing sequence number.
This allows you to completely ignore the local filename and put batches of files with unique names.
For example
ml:put -uri "/contacts/contact{seq}.xml" *.xml
will generate uris like
/contacts/contact1.xml
/contacts/contact2.xml
This is particularly useful if the input came from a tool like [[CommandXsplit xsplit]]
where the filenames are not particulary useful but you dont want to do anything fancy like [[CommandXmove xmove]]
If the uri contains {random} it will be replaced by a random number.
If the uri contains {seq} it will be replaced by the by an incrementing sequence number.
This allows you to completely ignore the local filename and put batches of files with unique names.
For example
ml:put -uri "/contacts/contact{seq}.xml" *.xml
will generate uris like
/contacts/contact1.xml
/contacts/contact2.xml
This is particularly useful if the input came from a tool like [[CommandXsplit xsplit]]
where the filenames are not particulary useful but you dont want to do anything fancy like [[CommandXmove xmove]]
Additions:
===Port Streaming===
If -stream port option is given then documements are read directly from the named pipe ( see [[CommandM=Xmkpipe xmkpipe]] ). Since the documents have no name, a base URI and uri template need to be supplied.
A URI template is a string containing {seq} or {random} which evaluates to a sequential or random number.
For example -uri test{seq}.xml will produce incremental unique URI's.
Example using xsplit to split a large XML file into smaller documents and put to marklogic without use of temporary files
import module ml=marklogic
xmkpipe -xml pipe
ml:put -baseuri /test/ -uri "doc{seq}.xml" -maxthreads 4 -maxfiles 100 -stream pipe &
xsplit -stream pipe file.xml
xmkpipe -close pipe
wait
If -stream port option is given then documements are read directly from the named pipe ( see [[CommandM=Xmkpipe xmkpipe]] ). Since the documents have no name, a base URI and uri template need to be supplied.
A URI template is a string containing {seq} or {random} which evaluates to a sequential or random number.
For example -uri test{seq}.xml will produce incremental unique URI's.
Example using xsplit to split a large XML file into smaller documents and put to marklogic without use of temporary files
import module ml=marklogic
xmkpipe -xml pipe
ml:put -baseuri /test/ -uri "doc{seq}.xml" -maxthreads 4 -maxfiles 100 -stream pipe &
xsplit -stream pipe file.xml
xmkpipe -close pipe
wait
Additions:
||-stream port||Reads documents from the named port.||
Additions:
||-delete||Deletes file after successfully putting to marklogic.||
Additions:
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.
Additions:
||-f,-filenames file||Use a file (or stdin in "-") to specify the list of files to put||
===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.
===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.
Additions:
||-md5||Store an xmd5 property with the document||
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.
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.
Additions:
The put command uses the XCC [[http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/Session.html#insertContent Session.insertContent]] API.
Deletions:
Additions:
||-buffer size||Set the transfer buffer size||
||-language lang||Set the language||
||-namespace namespace||Set the document namespace||
||-resolve,+resolve||Resolve (do not Resolve) Entities before storing the document||
||-quality quality||Set the document quality||
||-locale locale||Set the locale||
For detailed explanation of all the options, see the [[http://developer.marklogic.com/pubs/4.1/books/xcc.pdf MarkLogic XCC Developers Guide]] and the [[http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/package-summary.html XCC Package Summary]].
The put command uses the XCC [[http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/Session.html#insertContent(com.marklogic.xcc.Content[]) Session.insertContent]] API.
||-language lang||Set the language||
||-namespace namespace||Set the document namespace||
||-resolve,+resolve||Resolve (do not Resolve) Entities before storing the document||
||-quality quality||Set the document quality||
||-locale locale||Set the locale||
For detailed explanation of all the options, see the [[http://developer.marklogic.com/pubs/4.1/books/xcc.pdf MarkLogic XCC Developers Guide]] and the [[http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/package-summary.html XCC Package Summary]].
The put command uses the XCC [[http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/Session.html#insertContent(com.marklogic.xcc.Content[]) Session.insertContent]] API.
Additions:
- u|update Update
- r|read Read
- i|insert Insert
- x|execute Execute
- r|read Read
- i|insert Insert
- x|execute Execute
Deletions:
*r|read Read
*i|insert Insert
*x|execute Execute
Additions:
====Permissions====
Permissions can be specified with the -permission (or -perm) option. Permissions take the form of
*capability:role*
Capibility may be one of
*u|update Update
*r|read Read
*i|insert Insert
*x|execute Execute
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
Permissions can be specified with the -permission (or -perm) option. Permissions take the form of
*capability:role*
Capibility may be one of
*u|update Update
*r|read Read
*i|insert Insert
*x|execute Execute
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
Additions:
||-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|default||Specify the repair mode||
||-perm,-permission perm [-perm perm ...]||Apply the permission(s) to the document(s)||
||-repair none|full|default||Specify the repair mode||
Additions:
||-collection name [-collection name2 ...]||Put document(s) in the named collection(s)||
Inserts a document into 2 collections
ml:put -uri test.xml -collection foo -collection bar test.xml
Inserts a document into 2 collections
ml:put -uri test.xml -collection foo -collection bar test.xml
Additions:
||-maxthreads n||Use at most n threads, default=1||
Additions:
||-x,-xml||Stores the document as "xml" content type||
||-d,-mkdirs||Create directories as needed. Only creates direct parent directories of documents||
||-d,-mkdirs||Create directories as needed. Only creates direct parent directories of documents||
Deletions:
Additions:
||-t,-text||Stores the document as "text" content type||
||-b,-binary||Stores the document as "binary" content type||
||-x,-xml|Stores the document as "xml" content type||
If neither -x, -t or -b is specified then the content type is determined by the server.
||-b,-binary||Stores the document as "binary" content type||
||-x,-xml|Stores the document as "xml" content type||
If neither -x, -t or -b is specified then the content type is determined by the server.
Deletions:
||-b,-binary||Put files in binary mode||
||-x,-xml||Put files in xml mode||
Additions:
||-c,-connect uri||Use the connection string instead of $MLCONNECT||
Deletions:
-c uri||Use the connection string instead of $MLCONNECT||
Additions:
put [options] [file | expression ] ...
||-t,-text||Put files in text mode||
||-b,-binary||Put files in binary mode||
||-x,-xml||Put files in xml mode||
||-t,-text||Put files in text mode||
||-b,-binary||Put files in binary mode||
||-x,-xml||Put files in xml mode||
Deletions:
Additions:
||-r,-recurse||Recursively put directories. If any argument is a directory then it is recursed||
||-m,-maxfiles num||Send files in batch at must num files in one transaction||
||-m,-maxfiles num||Send files in batch at must num files in one transaction||
Deletions:
-recurse||Recursively put directories. If any argument is a directory then it is recursed||
||-m num
-maxfiles num||Send files in batch at must num files in one transaction||
Additions:
-recurse||Recursively put directories. If any argument is a directory then it is recursed||
Deletions:
Additions:
ml:put test.xml
ml:put -uri myfile.xml test.xml
ml:put -uri test.xml <[ <foo/> ]>
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
ml:put -uri myfile.xml test.xml
ml:put -uri test.xml <[ <foo/> ]>
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
Deletions:
$ ml:put -uri myfile.xml test.xml
$ ml:put -uri test.xml <[ <foo/> ]>
$ xquery -q 'myquery.xquery' -i input.xml | ml:put -uri test.xml
Additions:
||-r
-recurse||Recursively put directories. If any arguemnt is a directory then it is recursed||
-recurse||Recursively put directories. If any arguemnt is a directory then it is recursed||
Additions:
====Options====
||-connect uri
-c uri||Use the connection string instead of $MLCONNECT||
||-uri uri||Use the specified uri as the uri of the destination document,
Otherwise uses the base uri of the file or expression.||
||-baseuri base-uri||Use the specifed base uri instead of the base URI from the file or expression||
||-m num
-maxfiles num||Send files in batch at must num files in one transaction||
||expression | file||The file (or expression , variable, port or url) to put to the Mark Logic server.||
||-connect uri
-c uri||Use the connection string instead of $MLCONNECT||
||-uri uri||Use the specified uri as the uri of the destination document,
Otherwise uses the base uri of the file or expression.||
||-baseuri base-uri||Use the specifed base uri instead of the base URI from the file or expression||
||-m num
-maxfiles num||Send files in batch at must num files in one transaction||
||expression | file||The file (or expression , variable, port or url) to put to the Mark Logic server.||
Deletions:
-c uri Use the connection string instead of $MLCONNECT
-uri uri Use the specified uri as the uri of the destination document,
Otherwise uses the base uri of the file or expression.
expression
file The file (or expression , variable, port or url) to put to the Mark Logic server.
Additions:
If file is omitted then stdin is used.
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
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