Have an impact on changes in copy/change/return index?
HelloI use the latest version of Berkeley DB XML (2.4.16).
I use it to store relevant xml of .docx files archives... you can consider them as models in a document-generation application.
The transformation of copy/change/return is used in several places.
I also added the clues which can improve the queries that I am trying to make.
I am interested in finding if index impact when using the transformations of copy/modify/back (it does not seem they help on the tests I've done).
Here is the XQuery script that I use (I also wrote an xpath evaluation function that deals with simple XPath expressions that may contain attributes or the index... but it doesn't have an impact on the overall execution time):
declare variable $productView as node() external;
declare variable $templateName as xs:string external;
declare variable $expressionValues as node() external;
declare variable $docxMetadata as node() := doc('dbxml:/docxTemplates/templates.dbxml/metadata.xml')/templates;
declare variable $customIdentifier as xs:string := fn:data($docxMetadata/template[name = $templateName]/dsStoreItemId) cast as xs:string;
declare function local:getCustomXmlBlocksNode($template as xs:string)
{
doc(fn:concat('dbxml:/docxTemplates/templates.dbxml/', $template, '_blocks.xml'))/*
};
declare function local:if-absent( $arg as item()* ,
$value as item()* ) as item()* {
if (exists($arg))
then $arg
else $value
};
declare function local:replace-multi($arg as xs:string?, $changeFrom as xs:string*, $changeTo as xs:string*) as xs:string?
{
if (count($changeFrom)>0)
then local:replace-multi
(
replace($arg, $changeFrom[1], local:if-absent($changeTo[1],'')),
$changeFrom[position() > 1],
$changeTo[position() > 1]
)
else $arg
};
declare function local:copy-attributes($copyTo as element(), $copyFrom as element()) as element()
{
element { node-name($copyTo)}
{ $copyTo/@*[not(node-name(.) = $copyFrom/@*/node-name(.))],
$copyFrom/@*,
$copyTo/node() }
};
declare function local:add-attributes
( $elements as element()* ,
$attrNames as xs:QName* ,
$attrValues as xs:anyAtomicType* ) as element()? {
for $element in $elements
return element { node-name($element)}
{ for $attrName at $seq in $attrNames
return if ($element/@*[node-name(.) = $attrName])
then ()
else attribute {$attrName}
{$attrValues[$seq]},
$element/@*,
$element/node() }
};
declare function local:getEvaluation($expr as xs:string) as xs:string
{
fn:string($expressionValues/expressions/expression[name eq $expr]/value)
};
declare function local:renderSelectionParts($selPartName as xs:string*) as element()*
{
for $name in $selPartName
return local:renderDocumentPart($name)
};
declare function local:evalPath($path as xs:string, $xml as node()*) as node()*
{
local:evalPathImpl(tokenize($path, "/"), $xml)
};
declare function local:evalPathImpl($steps as xs:string*, $xml as node()*) as node()*
{
if(empty($steps)) then $xml
else if($steps[1] = "") then local:evalPathImpl(subsequence($steps, 2), $xml/root())
else if(starts-with($steps[1], "@")) then local:evalPathImpl(subsequence($steps, 2), $xml/@*[name() = substring($steps[1], 2)])
else if(ends-with($steps[1], "]")) then local:evalPathImpl(subsequence($steps, 2), $xml/*[name() = substring-before($steps[1], "[")][fn:string(position()) = substring-before(substring-after($steps[1], "["), "]" )])
else local:evalPathImpl(subsequence($steps, 2), $xml/*[name() = $steps[1]])
};
declare function local:renderRepeater($docPartName as xs:string, $blockNode as node(), $content as node(), $indexNames as xs:string*, $indexValues as xs:string*) as node()*
{
let $count := fn:count(local:evalPath(local:replace-multi(fn:string($blockNode/iw:ProductViewXPath), $indexNames, $indexValues), $productView))
for $index in 1 to $count
return local:renderRepeaterI($docPartName, $blockNode/iw:CCId, $content, ($indexNames, $blockNode/iw:KIdx/text()), ($indexValues, fn:string($index)))
};
declare function local:renderRepeaterI($docPartName as xs:string, $parentCCId as xs:string, $content as node(), $indexNames as xs:string*, $indexValues as xs:string*) as node()*
{
copy $c := $content
modify (
for $ccBlock in local:getCustomXmlBlocksNode($docPartName)/iw:Block[fn:string(iw:ParentContentControlId) eq $parentCCId]
let $cc := $c//w:sdt[w:sdtPr/w:id/@w:val eq $ccBlock/iw:CCId]
return
(
if($ccBlock/iw:Type eq 'CalculatedControl') then
insert node local:getDataBindingNode(local:replace-multi(fn:string($ccBlock/iw:ProductViewXPath), $indexNames, $indexValues)) into $cc/w:sdtPr
else if($ccBlock/iw:Type eq 'RepeaterDocPart') then
replace node $cc/w:sdtContent with element w:sdtContent { local:renderRepeater($docPartName, $ccBlock, $cc/w:sdtContent, $indexNames, $indexValues) }
else if($ccBlock/iw:Type eq 'RepeaterTable') then
replace node $cc/w:sdtContent/w:tbl/w:tr[last()] with local:renderRepeater($docPartName, $ccBlock, element content {$cc/w:sdtContent/w:tbl/w:tr[last()]}, $indexNames, $indexValues )
else ()
)
)
return $c/*
};
declare function local:getDataBindingNode($xpath as xs:string) as node()
{
local:add-attributes( element w:dataBinding{},
( xs:QName('w:prefixMappings'), xs:QName('w:xpath'), xs:QName('w:storeItemID') ),
( "xmlns:iwpvp='http://interwoven.com/WordML07/ProductViewPlaceholders'", $xpath, $customIdentifier )
)
};
declare function local:renderDocumentPart($docPartName as xs:string)
{
copy $c := doc(fn:concat('dbxml:/docxTemplates/templates.dbxml/', $docPartName, '.xml'))/w:document/w:body
modify (
for $sectPr in $c/w:sectPr
return delete nodes $sectPr,
for $ccBlock in local:getCustomXmlBlocksNode($docPartName)/iw:Block[fn:string-length(iw:ParentContentControlId)=0]
let $cc := $c//w:sdt[w:sdtPr/w:id/@w:val eq $ccBlock/iw:CCId]
return
(
if($ccBlock/iw:Type eq 'Expression') then
replace node $cc/w:sdtContent/w:p with local:copy-attributes( element w:p {element w:r { element w:t { local:getEvaluation($ccBlock/iw:BindValue) } } }, $cc/w:sdtContent/w:p )
else if($ccBlock/iw:Type eq 'Switch') then
replace node $cc/w:sdtContent/* with local:renderDocumentPart(fn:string($ccBlock/iw:Items/iw:Item[local:getEvaluation(fn:string(iw:Info)) eq local:getEvaluation(fn:string($ccBlock/iw:BindValue))]/iw:DocPart))
else if($ccBlock/iw:Type eq 'Selection') then
replace node $cc/w:sdtContent/* with local:renderSelectionParts(fn:string($ccBlock/iw:Items/iw:Item[iw:Selected eq 'True']/iw:DocPart))
else if($ccBlock/iw:Type eq 'RepeaterDocPart') then
replace node $cc/w:sdtContent with element w:sdtContent { local:renderRepeater($docPartName, $ccBlock, $cc/w:sdtContent, (" "), ("")) }
else if($ccBlock/iw:Type eq 'RepeaterTable') then
(
let $tr := $cc/w:sdtContent/w:tbl/w:tr[last()]
return replace node $tr with local:renderRepeater($docPartName, $ccBlock, element content {$tr}, (" "), (""))
)
else if($ccBlock/iw:Type eq 'DocumentPart') then
replace node $cc/w:sdtContent/* with local:renderDocumentPart($ccBlock/iw:BindValue cast as xs:string)
else ()
)
)
return $c/*
};
declare function local:renderDocument()
{
copy $c := doc(fn:concat('dbxml:/docxTemplates/templates.dbxml/', $templateName, '.xml'))/w:document
modify
(
for $ccBlock in local:getCustomXmlBlocksNode($templateName)/iw:Block[fn:string-length(iw:ParentContentControlId)=0]
let $cc := $c//w:sdt[w:sdtPr/w:id/@w:val eq $ccBlock/iw:CCId]
return
(
if($ccBlock/iw:Type eq 'Expression') then
replace node $cc/w:sdtContent/w:p with local:copy-attributes( element w:p {element w:r { element w:t { local:getEvaluation($ccBlock/iw:BindValue) } } }, $cc/w:sdtContent/w:p )
else if($ccBlock/iw:Type eq 'Switch') then
replace node $cc/w:sdtContent/* with local:renderDocumentPart(fn:string($ccBlock/iw:Items/iw:Item[local:getEvaluation(fn:string(iw:Info)) eq local:getEvaluation(fn:string($ccBlock/iw:BindValue))]/iw:DocPart))
else if($ccBlock/iw:Type eq 'Selection') then
replace node $cc/w:sdtContent/* with local:renderSelectionParts(fn:string($ccBlock/iw:Items/iw:Item[iw:Selected eq 'True']/iw:DocPart))
else if($ccBlock/iw:Type eq 'RepeaterDocPart') then
replace node $cc/w:sdtContent with element w:sdtContent { local:renderRepeater($templateName, $ccBlock, $cc/w:sdtContent, (" "), ("")) }
else if($ccBlock/iw:Type eq 'RepeaterTable') then
(
let $tr := $cc/w:sdtContent/w:tbl/w:tr[last()]
return replace node $tr with local:renderRepeater($templateName, $ccBlock, element content {$tr}, (" "), (""))
)
else if($ccBlock/iw:Type eq 'DocumentPart') then
replace node $cc/w:sdtContent/* with local:renderDocumentPart($ccBlock/iw:BindValue cast as xs:string)
else ()
)
)
return $c
};
element mainDocumentContent
{
copy $c := local:renderDocument()
modify
(
for $cc in $c//w:sdt
where fn:starts-with($cc/w:sdtPr/w:tag/@w:val, 'iw')
return delete nodes $cc/w:sdtPr/w:placeholder/*,
for $pictureCC in $c//w:sdt
where $pictureCC/w:sdtPr/w:tag/@w:val eq 'iwPictureBlock'
return delete nodes $pictureCC/w:sdtContent//a:blip/@r:embed,
for $simpleCC in $c//w:sdt
where fn:exists( fn:index-of( ('iwValueBlock', 'iwDateBlock', 'iwPictureBlock'), $simpleCC/w:sdtPr/w:tag/@w:val ) )
return replace value of node $simpleCC/w:sdtPr/w:dataBinding/@w:storeItemID with $customIdentifier,
let $sdtNodes := $c//w:sdt
for $i in 1 to fn:count($sdtNodes)
return replace value of node $sdtNodes[$i]/w:sdtPr/w:id/@w:val with $i
)
return $c
},
element customXmlPvpUri
{
fn:string($docxMetadata/template[name = $templateName]/customXmlPvpUri)
}
,
element templatePath
{
fn:string($docxMetadata/template[name = $templateName]/path)
}
Published by: donde on November 3, 2008 07:59
Hello
Index will not help the copied data. The indexes are limited to a particular container. Queries on this container will search for the appropriate indexes to optimize the query expression. Copied content is placed in a temporary storage that actually has a lot as a container, but is created without index so that queries that operate on this temporary copied content can be optimized using indexes.
It's an interesting idea to think about the indexing of content, but there are all kinds of questions, I can think of that might occur. In any case, it's something to think about.
If there is any way for you to cache and reuse the partially processed templates in a real (indexed) container'd win you indexes a bit more. Such a container could be in memory, so it serves as a pure cache. Should still transactions if you have concurrent access but it would disappear when the application is restarted. Just a thought.
Kind regards
George
Tags: Database
Similar Questions
-
Hi my problem is that I have that I've changed an exe file open with program steam
the thing that starts when you press a program or what ever. like when I press on the internet Explorer it opens steam. Hi my problem is that I have that I've changed an exe file open with program to steam and now all my things on windows 7 opens steam and I donth know how back open by default program of you I can start the program normally. And I tried to go to control panel and change the default programs, but it won't change anything. Please help me
Hello
Try a system restore: http://support.microsoft.com/kb/936212
Good luck $
-
original title: screen problems
I must have hit something and changed the look of my screenWhen I open a tab page is real real long or it can be so short that I can'tSee anything someone can you please tell me how to get my screen to thehow he was going crazy in New York!Do a restore of the system in Mode safe for a time
before the problem started, may be worth a try.See the following articles:
(306084) how to restore Windows XP to a
previous state
http://support.Microsoft.com/?kbid=306084How to restore a Windows XP system to a previous state using system restore
http://bertk.MVPs.org/(315222) a Description of the Safe Mode
Boot into Windows XP options
http://support.Microsoft.com/?kbid=315222How to start safe mode in Windows XP
http://bertk.MVPs.org/html/SafeMode.htmlGood luck...
-
I just noticed that I have a unable to change time zone or time.
Windows 7 Edition home premium. I just noticed that I have a unable to change time zone or time. He said my time zone is recognized word, but there is no choice. If I try to change the time numbers can be changes, but the "OK" button remains grayed out. The clock time does stay interent. Several months ago, I know it was working. I tried to start in safe mode, but no change, I ran? scannow which found nothing wrong. I tried Windows difficulty who finds nothing wrong. Any ideas?
Thanks in advance
original title: cannot change time zone or time
Hello
Please follow the below link to change the time server to synchronize the time of Windows.
Limited support to configure the time service Windows for high accuracy environments
http://support.Microsoft.com/kb/939322
I hope this helps.
-
I have a controller wired xbox 360, not one of these pieces of plug. I put the USB controller and installed the device. However, it does not work. Xbox 360 Assecories status when I click on it says I have it has been changed or moved, and will not work. I have not touched. When I search for a download for Windows 8 all get them are downloads for Windows 7 and below. It's a bit frustrating to not be able to use it. I would be very happy to help.
Original title: windows 8 wired 360 controller
I found the problem. I had the appropriate controller and installed the device correctly. This is the program that runs the unit that had either corrupt or missing files. I uninstalled the program and then installed from the Microsoft Download page. Now he works currently. Thanks for the support.
-
Nothing has changed on the device as so far, I am aware, but lately when I click on group under Default Device Admin map, I get this error and I can't make changes:
This failure has occurred: {0}. your changes have not been saved. Click OK to return to the list page.
Version of the ACS:
Cisco ACS VERSION INFORMATION
-----------------------------
Version: 5.8.0.32
The identifier for the internal version: B.442
This error does not appear to be related to
CSCud78248 Failure of system ACS 5.4 administrative access control
as I have no identity configured for the RADIUS server. I use this unit for RADIUS authentication. Any help is very appreciated!
What browser and version are you using?
If it of firefox and automatically has ugraded to the latest version of FF 46; There is a patch being released today and which will focus on similar issues seen when using the FF 46 version
Will be 5.8 patch3. a rollup that includes all the fixes in previous patches (1 and 2) posted release ACS 5.8
-
How to renew my subscription, I have no option to change my payment details
How to renew my subscription, I have no option to change my payment details
Manage your membership and your payment. Creative cloud
-
I can layer two documents in Indesign so I have only to make changes to one and it affects them both?
You can't superimpose two documents, but you can use the link and place feature in InDesign (Edit > place and link). This would allow you to have a single document which contained the main text, and then place this text in another document. When you change the text in the master file, any file that is using text related to this master file will indicate that it must be updated and it can bring in the modified text. Another option would be to export the text as a story in InCopy (.icml). Choose Edition > InCopy > export > selection, then the place that history in two InDesign documents. You can use the assignments Panel then check text for editing, but it would achieve a similar result. The first options would be the simpler of the two.
-
You just bought the Nikon D750. Do I have to download to change/see the RAW files in Photoshop CS5 and Adobe Bridge? Is coverter DNG the only way right now? Thank you all.
Please see for yourself what version of ACR supports the camera and what version of ACR, your version of Photoshop is compatible with.
-
I want to buy CC but can´t in my country (Uruguay), have problems if I change my country?
Hello
Cloud creative teams is available from dealers in Uruguay.
Thank you
Bev
-
InDesign CC fails on the update - issue lasted about 6 weeks - have removed app, without change.
The process of update for InDesign is broken.
Need for this problem.
Can you please try and uninstall it for uninstall to utilities/Adobe installers/uninstall Adobe InDesign CC.
And then sign back in Adobe Creative Cloud and redownload InDesign.
If you are still experiencing a problem, please let me know.
Kind regards
Abhishek
-
I have uninstall Photoshop to change the language, but I do not see the application to install.
Help please
Hope this link helps:
This would allow you to information about how to download and install several language versions of one of the applications included in creative cloud.
Kind regards
Ashutosh
-
Why an amplification of the RAM does not change the index performnance of windows vista?
Why an amplification of the RAM does not change the index performnance of windows Vista?
Hello
I m not very well, but maybe you have more than 3 GB of RAM and Vista 32 bit.
Usually the 32 bit OS is capable to manage and send only 3.2 GB.
The more than 3.2 GB RAM will not operating system used and therefore would not increase the index
In addition the laptop will be not really faster after upgrading RAM. You will notice better performance using applications at the same time, but this does not affect the index of Vista.
But this is only my personal hypothesis.Welcome them
-
I have yet to receive the hard copy of my certificate of Microsoft's digital learning
Not received a certificate
I have yet to receive the hard copy of my certificate of microsoft's digital learning.
Hi priyaoct,
You will need to check the digital learning site that you used to get contact information for information on the certificate.
-
Hello. I explained the following error in InDesign. When you open a file that is stored on a server, I get an error message because the file is already open, or don't have sufficient permissions. If I copy to the desktop and open it, I have no problem. Can someone help me? Thank you.
Is there a file .idlk remaining on the server which is not removed properly?
Maybe you are looking for
-
To update iPhone 5 c 6 I have a question...
OK, so I am now eligible to proceed my iPhone 5 c to last 6, but I had just a quick question before I go out in reality to swap my iPhone current 5 c for a new... I have a few apps installed on my current iPhone 5 c which cannot be updated because it
-
Qosmio X 770-BSODS and Crash Dump driver failed to load
Hello I have a Qosmio X 770 and his blue screening occasioanly but I can't find out why as the crash dump driver fails to load at startup. I gave google and tried to recreate the page, Delete file, it restart, rebuild again, affecting also devote dum
-
my macbook gives me an electric shock while I load it
my macbook gives me an electric shock while I load it even when I use the plug 3 charger to Earth.
-
Satellite L670 - update driver for ATI 5650
Hiya, After a few months I just around the audit, if there is no driver update for my model: Satellite L670 with ATI 5650. Apperently Toshiba must approve the pilots to become available to us. Because ATI already has new drivers available, but we are
-
Find a power supply for my HP PC
I have the HP m9340f with a 350W power supply, I'm interested to upgrade to a 500w power supply, namely this one http://www.newegg.com/Product/Product.aspx?Item=N82E16817438012. No one knows if this computer can process the 500w PSU.