From: [email protected] 
[mailto:[email protected]] On Behalf Of Kapoor, Pragya
Sent: donderdag 14 juli 2016 12:49
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] XDMP-EXTIME errror


Greet,



I am still getting the time limit exceeded error.



Code :


import module namespace mem-op 
="http://maxdewpoint.blogspot.com/memory-operations";
    at  "memory-operations.xqy";
let $doc1 :=fn:doc("/misc/DocListExtra.xml")
let $doc2 :=fn:doc("/misc/DocList.xml")
let $docId :=$doc1/DocumentListExtra/DocumentExtra/DocumentExtraID/text()

let $result :=

for $each in $docId
              let $data := <a><b>{$doc2//Document[./ID/text() eq $each]}</b></a>

              let $value :=for $each in $data//ID/text()
                           let 
$rest:=$doc1/DocumentListExtra/DocumentExtra[./DocumentExtraID/text() eq $each]
                           return $rest

              let $merged :=  mem-op:copy($data//Document) !
                    (
                     mem-op:insert-child($data//Document,$value),
                      mem-op:execute(.)

                    ) return $merged/b


 return  xdmp:save("/data/merged.xml",$result//Document)


Thanks

Pragya

________________________________
From: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 on behalf of Geert Josten 
<[email protected]<mailto:[email protected]>>
Sent: Thursday, July 14, 2016 2:11:03 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] XDMP-EXTIME errror

For others on the list: just click the project name in the left-hand panel, 
that will jump to the github repository. There are also hyperlinks to the 
github user page, project issues page, etc. Other links like language, and 
keywords, jump back to search, and add a facet constraint for what you clicked..

Cheers,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of "Kapoor, Pragya" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, July 14, 2016 at 9:45 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] XDMP-EXTIME errror


Greet,



Thanks for the solution, I found the lib module as well.



Regards

Pragya

________________________________
From: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 on behalf of Kapoor, Pragya 
<[email protected]<mailto:[email protected]>>
Sent: Thursday, July 14, 2016 12:54:41 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] XDMP-EXTIME errror


Thanks Greet.



Could you also let me know, from where could I get this lib module for download?



Thanks

Pragya

________________________________
From: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 on behalf of Geert Josten 
<[email protected]<mailto:[email protected]>>
Sent: Thursday, July 14, 2016 12:33:57 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] XDMP-EXTIME errror

Hi Pragya,

You have both mem-updates, and xdmp:save inside the loop. So first of all, it 
is doing a save for each iteration through the loop. Secondly, doing that many 
mem-updates is a performance killer.

Move xdmp:save after the for-loops by doing something like:

let $_ := for .... return ...
return xdmp:save(...)

And instead of using those mem-update functions, you could consider using this 
lib instead:

http://github-search.demo.marklogic.com/detail/ryanjdew/XQuery-XML-Memory-Operations.json

With that you build up a queue of edits first, and then run through them all at 
once.

Cheers,
Geert

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of "Kapoor, Pragya" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, July 14, 2016 at 8:53 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] XDMP-EXTIME errror


Use Case:



We need to merge two XML files based on common element ID.

DocList.xml with size of 31 MB and other DocListExtra.xml of 8MB



The xquery code is giving Time Limit exceed error.



Code:
import module namespace mem = "http://xqdev.com/in-mem-update";
    at  "/rest-apis/utils/mem.xqy";

let $docList := fn:doc("/misc/DocList.xml")
let $extraList := fn:doc("/misc/DocListExtra.xml")

let $docExtra :=
let $docIDs := $docList//ID/text()
for $doc in $extraList
return
  $doc//DocumentExtra[./DocumentExtraID/text() = $docIDs]

 for $doc in $docList
 for $each in $docExtra
 let $x := $doc//Document[./ID/text() = $each/DocumentExtraID/text()]
  let $dummy := mem:node-insert-child($x,$each//CustomMetadata)
   return xdmp:save("/data/merged.xml",$dummy)


Please suggest.



Thanks

Pragya
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to