source: exist/branches/proglue_production_rev4605_xquery4884/xquery/molesObjectType.xq @ 4886

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/branches/proglue_production_rev4605_xquery4884/xquery/molesObjectType.xq@4886
Revision 4886, 795 bytes checked in by sdonegan, 10 years ago (diff)

Creating operational branch for ndgUtils as used on proglue

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.