Changeset 4981


Ignore:
Timestamp:
16/02/09 12:41:56 (11 years ago)
Author:
cbyrom
Message:

Fix a couple of small formatting problems in atomutilities + create
test suite to properly test this + add a fix to the dif.xq and improve
the efficiency of the atom2DIF xquery.

Location:
ndgCommon/trunk/ndg/common
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/lib/atomutilities.py

    r4934 r4981  
    1010from ndg.common.src.lib.utilities import findElementIndex 
    1111import ndg.common.src.clients.xmldb.eXist.dbconstants as dc 
     12 
     13NEED_TO_RESOLVE_STRING = 'NEED TO RESOLVE' 
    1214 
    1315def addStandardKeywords(doc): 
     
    2426 
    2527    if index < 0: 
    26         errorMessage = "Could not find '%s' element in doc to insert organisation data after - skipping doc" %elementName 
     28        errorMessage = "Could not find '%s' element in doc to insert standard keyword data after - skipping doc" %elementName 
    2729        logging.error(errorMessage) 
    2830        raise ValueError(errorMessage) 
     
    6668                except: 
    6769                    # NB, this will currently fail since the vocab data is incomplete 
    68                     topicElement.text = uri + " (NEED TO RESOLVE)" 
     70                    topicElement.text = uri + " (%s)" %NEED_TO_RESOLVE_STRING 
    6971                 
    7072    logging.info("Parameters expanded") 
     
    123125    logging.info("Getting organisation data for repository, '%s'" %repositoryID) 
    124126    if repositoryID != 'badc.nerc.ac.uk' and repositoryID != 'neodc.nerc.ac.uk': 
    125         raise ValueError("Unrecognised repository ID, '$s'" %repositoryID) 
     127        raise ValueError("Unrecognised repository ID, '%s'" %repositoryID) 
    126128     
    127129    # NB, using the query() method (via the useChunked keyword) here results 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/atom2DIF.xq

    r4968 r4981  
    3838declare variable $deploymentDataDir as xs:string := 'deployment_data'; 
    3939 
    40 for $DE in collection(string-join(($targetCollection, $dataEntitiesDir, $repositoryIdentifier), '/'))/atom:entry[matches(atom:id, $localIdentifier)] 
     40declare variable $atomCollection as xs:string := concat('TargetCollection', $dataEntitiesDir, '/', 'RepositoryID');  
     41 
     42for $DE in collection($atomCollection)/atom:entry[matches(atom:id, $localIdentifier)] 
    4143return 
    4244element DIF { 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/dif.xq

    r4968 r4981  
    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 := ':RepositoryID:DIF:LocalID'; 
     4declare variable $localIdentifier as xs:string := 'RepositoryID:DIF:LocalID'; 
    55for $DE in collection($targetCollection)/DIF[Entry_ID=$localIdentifier] return $DE 
Note: See TracChangeset for help on using the changeset viewer.