Changeset 3151 for exist/trunk


Ignore:
Timestamp:
14/12/07 15:55:09 (12 years ago)
Author:
lawrence
Message:

Fixing the xqueries to support the "right" browse query
in the ndgUtils egg.

Location:
exist/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/test_xqueries.py

    r3147 r3151  
    9090        #ok, now let's try a moles2dif xquery 
    9191        xquery=self.xq.actual('moles2dif',targetCollection,n.repository,n.localID) 
     92        xquery=xquery.replace('BrowseServer',self.c.get('NDG_B_SERVICE',n.repository)) 
    9293        id,s=self.xmldb2.executeQuery(xquery) 
    9394        print '%s hit in %s ms'%(s['hits'],s['queryTime'])  
  • exist/trunk/xquery/dif2moles.xq

    r3128 r3151  
    291291element dgValidTerm {string($structuredKeywords)}, 
    292292element dgValidTermID { 
    293 if ($structuredKeywords='MDIP' or $structuredKeywords='NERC' or $structuredKeywords='NERC_DDC') then 
     293if ($structuredKeywords='MDIP' or $structuredKeywords='NERC' or $structuredKeywords='NERC_DDC' or $structuredKeywords='DPPP') then 
    294294element ParentListID {concat($voclib:ndg_data_provider_vocab, '/current')} 
    295295else 
  • exist/trunk/xquery/moles2dif.xq

    r3100 r3151  
     1(: This is the xquery to produce a dif document from a full moles database. It is sometimes used for miniMoles, but it's 
     2main aim should be to produce DIF documents from MOLES for NDG participants. 
     3Key parameters to be changed when used in anger are 
     4 TargetCollection, Repository ID, LocalID, BrowseServer :) 
     5 
    16import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    27import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     
    1015declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    1116declare variable $localIdentifier as xs:string {'LocalID'}; 
     17declare variable $browseServer as xs:string {'BrowseServer'}; 
    1218(: Keep 
    1319declare variable $targetCollection as xs:string {'/db/ndg_B_metadata'}; 
    1420declare variable $repositoryIdentifier as xs:string {'badc.nerc.ac.uk'}; 
    1521declare variable $localIdentifier as xs:string {'dataent_CIRA'}; 
     22declare variable $browseServer as xs:string {'ndgbeta.badc.rl.ac.uk'}; 
    1623:) 
    1724for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     
    247254        element Summary {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 
    248255        element Related_URL  { 
    249             element URL_Content_Type {'NDG_B_SERVICE'}, 
    250             element URL {data($DE/moles:dgMetadataID/moles:repositoryIdentifier)}, 
    251             element Description {'The NDG service for browsing metadata.'} 
     256            element URL_Content_Type {'VIEW_EXTENDED_METADATA'}, 
     257            element URL {concat($browseServer,'/view/',data($DE/moles:dgMetadataID/moles:repositoryIdentifier),'__NDG-B1__', 
     258            data($DE/moles:dgMetadataID/moles:localIdentifier))}, 
     259            element Description {'A NERC DataGrid MOLES record is available at this URL.'} 
    252260            }, 
    253261        for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 
     262            (: BNL need to make sure we have a function for doing related URLs :) 
    254263            return 
    255264                if ($DG/moles:dataModelID/moles:schemeIdentifier='NDG-A0') then  
    256                     (element Related_URL { 
    257                             element URL_Content_Type {'NDG_A_SERVICE'}, 
    258                             if (exists($DG/instance/URI)) then 
    259                                 element URL {escape-uri($DG/instance/URI, true())} 
    260                             else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 
    261                                 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 
    262                             else ($DG/moles:dataModelID/moles:repositoryIdentifier), 
    263                             element Description {'The NDG service delivering data via NDG A metadata.'} 
    264                         }, 
    265                    element Related_URL { 
    266                             element URL_Content_Type {'GET DATA > CSML'}, 
    267                             if (exists($DG/instance)) then 
    268                                 element URL {escape-uri($DG/instance/URI, true())} 
    269                             else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 
    270                                 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 
    271                             else (), 
    272                             element Description {'The NDG service delivering data via NDG A metadata. Additional tag to be more in line with latest version of GCMD valids'} 
    273                         }) 
    274                 else if ($DG/moles:dataModelID/moles:schemeIdentifier='CDML-0') then  
    275                         (element Related_URL {  
    276                                    element URL_Content_Type {'NDG_A_SERVICE'}, 
    277                             if (exists($DG/instance)) then 
    278                                 element URL {escape-uri($DG/instance/URI, true())} 
    279                             else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 
    280                                 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 
    281                             else (), 
    282                             element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 
    283                             }, 
    284                         element Related_URL { 
    285                             element URL_Content_Type {'GET DATA > DX'}, 
    286                             if (exists($DG/instance)) then 
    287                                 element URL {escape-uri($DG/instance/URI, true())} 
    288                             else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 
    289                                 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 
    290                             else (), 
    291                             element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 
    292                             }) 
     265                    () 
    293266                else if ($DG/moles:dataModelID/moles:schemeIdentifier='URI') then  
    294267                    element Related_URL { 
  • exist/trunk/xquery/molesList.xq

    r3118 r3151  
    1 (: This moles listing query returns all the moles documents and their identifiers within a specific TargetCollection :)  
     1(: This moles listing query returns all the moles documents and their identifiers within a specific TargetCollection and a particular type (default is dgDataEntity) :)  
    22declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    33for $DE in collection('TargetCollection')/dgMetadata/dgMetadataRecord[exists(dgDataEntity)] 
Note: See TracChangeset for help on using the changeset viewer.