Created
May 12, 2021 21:46
-
-
Save kschlottmann/7ef5dc5c502f1c15eebe1b31b5f603bf to your computer and use it in GitHub Desktop.
This xquery will match all records containing an arbitrary term, from the raw ArchivesSpace MARC output from the OAI feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare namespace marc="http://www.loc.gov/MARC21/slim"; | |
(: This xquery will match all records containing an arbitrary term, from the raw ArchivesSpace MARC output from the OAI feed :) | |
<results> | |
{ | |
for $MarcRecord in /repository/record/metadata/collection/record | |
for $word in ("alien", "Alien", "Aliens", "aliens") | |
where $MarcRecord/datafield/subfield[contains(., $word)] | |
let $rec := $MarcRecord | |
let $repo := $MarcRecord/datafield[@tag="040"]/subfield[@code="a"] | |
let $bib := $MarcRecord/datafield[@tag="099"] | |
let $fieldMatch := $MarcRecord/datafield[subfield[contains(., $word)]] | |
return | |
<result><bib>{data($bib)}</bib><repo>{data($repo)}</repo>{$fieldMatch} </result> | |
} | |
</results> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment