Hi Danny,
This is the query I have stored in file system module "http://htcinc.com/contegra/document/management" declare namespace docmngmt="http://htcinc.com/contegra/document/management" define function load-document($document_uri as xs:string, $document_id as xs:string, $metadata as node() ) { let $document_name := fn:concat("/contegra/documents/",$document_id,"/currentversion.xml") return xdmp:document-insert($document_name,<wrapper>{$metadata}<original-conten t> {xdmp:document-get($document_uri)}</original-content></wrapper>) } I am invoking the same query using either XCC or CQ. Using CQ I invoke it as follows and tried to upload a 200 MB file import module "http://htcinc.com/contegra/document/management" at "Document-Management.xqy" declare namespace docmngmt="http://htcinc.com/contegra/document/management" docmngmt: load-document("C:\xml\splits\Company_200_1.xml","CBZ200",<metadata><prop >200MB</prop><author>test</author></metadata>) Previously I used get the error that Time limit exceeded now after the changes you suggested I receive the following error 500 Internal Server Error XDMP-MEMORY: xdmp:document-get("C:\xml\splits\Company_200_1.xml") -- Memory exhausted in /Document-Management.xqy, on line 23, in docmngmt:load-document("C:\xml\splits\Company_200_1.xml", "CBZ200", <metadata><prop>200MB</prop><author>test</author></metadata>) [0.9-ml] $document_uri = "C:\xml\splits\Company_200_1.xml" $document_id = "CBZ200" $metadata = <metadata><prop>200MB</prop><author>test</author></metadata> $document_name = "/contegra/documents/CB2500/currentversion.xml" on line 3, in xdmp:eval("import module "http://htcinc.com/contegra/document/manageme...", (), <options xmlns="xdmp:eval"><database>6456614594508073642</database><modules>0</mo dules><def...</options>) [0.9-ml] in /cq/eval.xqy, on line 95 [1.0-ml] Thanks, Pradeep Maddireddy -----Original Message----- From: Danny Sokolsky [mailto:[email protected]] Sent: Tuesday, January 20, 2009 11:58 AM To: Pradeep Maddireddy; General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Pradeep, I can't tell from your description if you are running this through cq (which runs on an HTTP Server) or if you are running this from a Java program over an XDBC Server. You must change the time limit on the App Server (HTTP or XDBC) in which the query is running. So if you are running this through cq, change the default time limit on the HTTP Server, if running from an XCC program, change the value on the XDBC Server in which the program is running. Try doubling the values for the "default time limit" and the "max time limit" on the appropriate App Server configuration (from the Admin Interface). If you send the entire query you are trying to run it might help to figure out what is going on. -Danny -----Original Message----- From: Pradeep Maddireddy [mailto:[email protected]] Sent: Tuesday, January 20, 2009 7:58 AM To: Danny Sokolsky; General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Danny, I tried executing xdmp:set-request-time-limit but the maximum it allowed is 600.When I used a time greater than 600 I received the following error XDMP-TIMELIMIT: xdmp:set-request-time-limit(900) -- Request time limit exceeds the maximum allowed. I am executing this commands using cq and for the corresponding XDBC connection I have set the max time limit and default time limit to 3600. Then I tried loading a document of 100 MB and still got this error. XDMP-EXTIME: xdmp:eval("import module "http://htcinc.com/contegra/document/manageme...", (), <options xmlns="xdmp:eval"><database>6456614594508073642</database><modules>0</mo dules><def...</options>) -- Time limit exceeded in xdmp:eval("import module "http://htcinc.com/contegra/document/manageme...", (), <options xmlns="xdmp:eval"><database>6456614594508073642</database><modules>0</mo dules><def...</options>) [0.9-ml] in /cq/eval.xqy, on line 95 [1.0-ml] Thanks, Pradeep Maddireddy -----Original Message----- From: Danny Sokolsky [mailto:[email protected]] Sent: Thursday, January 15, 2009 5:17 PM To: Pradeep Maddireddy; General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY This means that the time limit on your App Server has been met. In other words, this query is taking longer to process than your App Server allows. You can try using xdmp:set-request-time-limit to raise the time limit for the query (up to the max time limit configured for the App Server) or change the default time limit (and possible the max time limit) for the HTTP Server on which this request is running. Or you can change your query so it does less work (for example, break it up into several queries). -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Pradeep Maddireddy Sent: Thursday, January 15, 2009 1:41 PM To: Danny Sokolsky Cc: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Danny, This is the error I receive 500 Internal Server Error XDMP-EXTIME: Time limit exceeded in xdmp:eval("import module "http://htcinc.com/contegra/document/manageme...", (), <options xmlns="xdmp:eval"><database>6456614594508073642</database><modules>0</mo dules><roo...</options>) in /cq/eval.xqy, on line 119 Thanks Pradeep Maddireddy -----Original Message----- From: Danny Sokolsky [mailto:[email protected]] Sent: Thursday, January 15, 2009 4:22 PM To: Pradeep Maddireddy Cc: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Pradeep, What is the exact error message you are getting with a large file? -Danny -----Original Message----- From: Pradeep Maddireddy [mailto:[email protected]] Sent: Thursday, January 15, 2009 12:22 PM To: Danny Sokolsky Cc: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Danny, Thank you very much. xdmp:document-get solved my problem. When the document size is large ( 100Mb or greater) this QUERY fails. What is the best method to load large documents. Thanks Pradeep Maddireddy -----Original Message----- From: Danny Sokolsky [mailto:[email protected]] Sent: Thursday, January 15, 2009 1:47 PM To: Pradeep Maddireddy; General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Commit in XQUERY Hi Pradeep, There is no need to use both xdmp:document-load and xdmp:document-insert in the same statement, just choose one of them. For example, you can construct the document using XQuery (including your metadata), then use xdmp:document-insert to store your abc.xml document in the database as follows: xquery version "1.0-ml"; let $document_name := "abc.xml" let $metadata := <metadata> <metadata-content>goes here</metadata-content> </metadata> let $orig-content := <some-content>goes here</some-content> return xdmp:document-insert($document_name, <wrapper>{ $metadata , <original-content>{$orig-content}</original-content>} </wrapper> ) Or, if you are trying to load a document from your filesystem that has a path of /space/abc.xml, you can do something like this (using xdmp:document-get to get the file with the content from the filesystem): xquery version "1.0-ml"; let $document_name := "/space/abc.xml" let $metadata := <metadata> <metadata-content>goes here</metadata-content> </metadata> let $orig-content := xdmp:document-get($document_name) return xdmp:document-insert($document_name, <wrapper>{ $metadata , <original-content>{$orig-content}</original-content>} </wrapper> ) That would insert a document into the database with the URI /space/abc.xml. Then a doc("/space/abc.xml") returns the following: <wrapper> <metadata><metadata-content>goes here</metadata-content></metadata> <original-content> <some-content>goes here</some-content> </original-content> </wrapper> -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Pradeep Maddireddy Sent: Wednesday, January 14, 2009 8:16 AM To: [email protected] Subject: [MarkLogic Dev General] Commit in XQUERY Hi..! We are planning to store the metadata and orginal xml content in the following format, so that a search can be performed on both original content and metadata at one shot. <wrapper> <metadata> <metdata content> </metadata> <original-content> <!-- original content goes here --> </original-content> </wrapper> The XQUERY function I have created (given below) receives document URI and meta data (as a node) define function load-document($document_uri as xs:string, $metadata as node() { let $document_name := "abc.xml" return xdmp:document-load($document_uri,<options xmlns="xdmp:document-load"><uri>{$document_name}</uri></options>), xdmp:document-insert($document_name,<wrapper>{$metadata}<original-conten t>{fn:doc($document_name)/node()}</original-content></wrapper>) } In the first function xdmp:document-load I am creating the document from the URI received and in the second function xdmp:document-insert I am trying to retrieve original content as a node (using fn:doc($document_name)/node() ) and then attach metadata to it and then load it into marklogic, but as the data will not be committed untill the control exits the module, even after the first function document-load gets executed when I try to retrieve the original content as a node I receive nothing. Is there any function like commit which could solve the problem or else is there any work around for this other than having two different functions and invoking them one after another from front end. Thanks in advance. Regards, Pradeep Maddireddy _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
