source: exist/trunk/xquery/atom2DC.xq @ 4411

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/xquery/atom2DC.xq@4411
Revision 4411, 1.5 KB checked in by cbyrom, 12 years ago (diff)

Add new xquery for producing dublin core docs from atoms.

Line 
1(: Create a dublin core document from Atom documents in TargetCollection which have LocalID :)
2import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery';
3import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery';
4
5declare default element namespace 'http://www.w3.org/2005/Atom';
6declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';
7declare namespace dc='http://purl.org/dc/elements/1.1/';
8declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/';
9declare namespace moles="http://ndg.nerc.ac.uk/schema/moles2alpha";
10
11declare variable $targetCollection as xs:string := '/db/atoms/published/data_entities/badc.nerc.ac.uk';
12declare variable $localIdentifier as xs:string := 'dataent_URGENT';
13
14for $DE in collection($targetCollection)/entry[matches(id, concat('__ATOM__',$localIdentifier,'$'))]
15return
16element oai_dc:dc {
17    attribute xsi:schemaLocation {'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'},
18    element dc:title {string($DE/title)},
19    element dc:type {'Dataset'},
20    element dc:identifier {string($DE/id)},
21    element dc:description {string($DE/summary)},
22    element dc:date {string($DE/updated)},
23    element dc:creator {string($DE/author/name)},
24    element dc:publisher {string($DE/moles:entity/moles:molesISO/moles:providerID)}
25}
Note: See TracBrowser for help on using the repository browser.