Thank you for the info Geert 

----- Original Message ----- 
From: "Geert Josten" <[email protected]> 
To: "General Mark Logic Developer Discussion" <[email protected]> 
Sent: Tuesday, October 6, 2009 1:00:50 PM GMT -05:00 US/Canada Eastern 
Subject: RE: [MarkLogic Dev General] Can someone outline the steps through load 
of importing through Admin Console 

Hi Mike, 

Then don't use the Admin interface to load data. ;-) 

Personally I really like doing everything from within predefined xquery 
modules, including initialization of the databases etc. For loading document, 
you could use something like the following: 

let $datapath := 
concat(translate(xdmp:modules-root(), '\', '/'), "/data/") 

let $datauri := 
"/myproject/data/" 

let $files := 
xdmp:filesystem-directory($datapath)/self::dir:directory/dir:entry[dir:type = 
"file"]/dir:filename 

let $import := 
for $file in $files 

let $filepath := 
concat($datapath, $file) 

let $fileuri := 
concat($datauri, $file) 

return ( 
xdmp:document-load($filepath, 
<options xmlns="xdmp:document-load"> 
<uri>{$fileuri}</uri> 
<format>xml</format> 
</options> 
), 
<li>{$fileuri}..</li> 
) 

return 

<html> 
<body> 
<ul>{$import}</ul> 
<p>{count($import)} files imported succesfully.</p> 
</body> 
</html> 

You can replace xdmp:modules-root() by a fixed path if you like. You can put 
this code in a .xqy file, or run it directly from CQ. The documents get 
inserted into the current database. 

Alternatively, look at http://developer.marklogic.com/code/ for pre-made tools 
that can help you. There are CQSH, RecordLoader and XQSync. You can also take a 
look at XMLSH, that can be found here: http://www.xmlsh.org/ModuleMarkLogic 

Kind regards, 
Geert 

> 


Drs. G.P.H. Josten 
Consultant 


http://www.daidalos.nl/ 
Daidalos BV 
Source of Innovation 
Hoekeindsehof 1-4 
2665 JZ Bleiswijk 
Tel.: +31 (0) 10 850 1200 
Fax: +31 (0) 10 850 1199 
http://www.daidalos.nl/ 
KvK 27164984 
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend. 


> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> [email protected] 
> Sent: dinsdag 6 oktober 2009 18:07 
> To: [email protected] 
> Subject: [MarkLogic Dev General] Can someone outline the 
> steps through load of importing through Admin Console 
> 
> Hi: 
> I'm trying to load some xml documents for the first time 
> through the Admin Console in MarkLogic 
> It asks for a full path and filter to my documents 
> 
> My question is how do I set it up and load my documents, so 
> that when I access the documents through cq or 
> programitically I can use a namespace 
> or relative path instead of a fully qualified path in cq. 
> 
> I'd hate to hardcode the c: drive like below 
> doc("/C/tempCA/q4.xml")//question 
> 
> -- Thanks, Mike 
> 
> 

_______________________________________________ 
General mailing list 
[email protected] 
http://xqzone.com/mailman/listinfo/general 
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to