Changeset 4968


Ignore:
Timestamp:
12/02/09 17:39:26 (11 years ago)
Author:
cbyrom
Message:

Remove use of concat function in xqueries - to vastly speed them up

  • by a factor of about 100.
Location:
ndgCommon/trunk/ndg/common/xmldb/xquery
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/xmldb/xquery/atom.xq

    r4938 r4968  
    1 (: Return a specific atom document when TargetCollection and LocalID are overwritten :) 
     1(: Return a specific atom document when TargetCollection, RepositoryID and LocalID are overwritten :) 
    22declare default element namespace 'http://www.w3.org/2005/Atom'; 
    33declare variable $targetCollection as xs:string := 'TargetCollection'; 
    4 declare variable $localIdentifier as xs:string := 'LocalID'; 
    5 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
    6 for $DE in collection($targetCollection)/entry[matches(id, concat($repositoryIdentifier,'__ATOM__',$localIdentifier,'$'))] return $DE 
     4declare variable $localIdentifier as xs:string := 'RepositoryID__ATOM__LocalID$'; 
     5for $DE in collection($targetCollection)/entry[matches(id, $localIdentifier)] return $DE 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/atom2DC.xq

    r4825 r4968  
    77 
    88declare variable $targetCollection as xs:string := 'TargetCollection'; 
    9 declare variable $localIdentifier as xs:string := 'LocalID'; 
    10  
    11 for $DE in collection($targetCollection)/entry[matches(id, concat('__ATOM__',$localIdentifier,'$'))]  
     9declare variable $localIdentifier as xs:string := 'RepositoryID__ATOM__LocalID$'; 
     10for $DE in collection($targetCollection)/entry[matches(id, $localIdentifier)] 
    1211return  
    1312element oai_dc:dc { 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/atom2DIF.xq

    r4825 r4968  
    1414declare variable $dataEntitiesDir as xs:string := '/data_entities'; 
    1515declare variable $repositoryIdentifier as xs:string := 'badc.nerc.ac.uk'; 
    16 declare variable $localIdentifier as xs:string := 'dataent_active'; 
     16declare variable $localIdentifier as xs:string := 'badc.nerc.ac.uk__ATOM__dataent_active'; 
    1717declare variable $dptTerm as xs:string := 'DPTTerm'; 
    1818declare variable $obsTerm as xs:string :=  'OBSTerm'; 
     
    2424declare variable $targetCollection as xs:string := 'TargetCollection'; 
    2525declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
    26 declare variable $localIdentifier as xs:string := 'LocalID'; 
     26declare variable $localIdentifier as xs:string := 'RepositoryID__ATOM__LocalID$'; 
     27 
    2728declare variable $dptTerm as xs:string := 'DPT - NOT YET SET UP/None/DPT'; 
    2829declare variable $obsTerm as xs:string :=  'OBS - NOT YET SET UP/None/OBS'; 
     
    3738declare variable $deploymentDataDir as xs:string := 'deployment_data'; 
    3839 
    39 for $DE in collection(string-join(($targetCollection, $dataEntitiesDir, $repositoryIdentifier), '/'))/atom:entry[matches(atom:id, concat('__ATOM__',$localIdentifier,'$'))] 
     40for $DE in collection(string-join(($targetCollection, $dataEntitiesDir, $repositoryIdentifier), '/'))/atom:entry[matches(atom:id, $localIdentifier)] 
    4041return 
    4142element DIF { 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/atomFullPath.xq

    r4938 r4968  
    33declare default element namespace 'http://www.w3.org/2005/Atom'; 
    44declare variable $targetCollection as xs:string := 'TargetCollection'; 
    5 declare variable $localIdentifier as xs:string := 'LocalID'; 
     5declare variable $localIdentifier as xs:string := 'RepositoryID__ATOM__LocalID$'; 
    66declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
    7 for $DE in collection($targetCollection)/entry[matches(id, concat($repositoryIdentifier,'__ATOM__',$localIdentifier,'$'))]  
     7for $DE in collection($targetCollection)/entry[matches(id, $localIdentifier)]  
    88return  
    99<collectionPath>{util:collection-name($DE)}</collectionPath> 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/dif.xq

    r4938 r4968  
    22declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    33declare variable $targetCollection as xs:string := 'TargetCollection'; 
    4 declare variable $localIdentifier as xs:string := 'LocalID'; 
    5 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
    6 for $DE in collection($targetCollection)/DIF[Entry_ID=concat($repositoryIdentifier,':DIF:',$localIdentifier)] return $DE 
     4declare variable $localIdentifier as xs:string := ':RepositoryID:DIF:LocalID'; 
     5for $DE in collection($targetCollection)/DIF[Entry_ID=$localIdentifier] return $DE 
Note: See TracChangeset for help on using the changeset viewer.