source: exist/trunk/xquery/molesObjectType.xq @ 3118

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/xquery/molesObjectType.xq@3158
Revision 3118, 794 bytes checked in by lawrence, 12 years ago (diff)

Splitting out the (authoratative?) python xqueries into named
files within the new egg for exist (and other ndg utilities)

Line 
1(: For TargetCollection, RepositoryID, LocalID return the moles object type keyed as
2     0 - unknown, 1 - activity, 2 - DPT, 3 - ObsStn, 4 - DataEntity :)
3declare default element namespace 'http://ndg.nerc.ac.uk/moles';
4declare variable $targetCollection as xs:string {'TargetCollection'};
5for $Obj in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID']
6return <objectType>{if (exists($Obj/dgDataEntity)) then 4
7                   else (if (exists($Obj/dgObservationStation)) then 3
8                   else (if (exists($Obj/dgDataProductionTool)) then 2
9                   else (if (exists($Obj/dgActivity)) then 1 else (0))))}
10       </objectType>
Note: See TracBrowser for help on using the repository browser.