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 "1.0-ml"; | |
| (: 12/11/10 Query to create controlaccess elements for EAD. Take the value of persname element and create a new node, the controlaccess element for each of the 227 EAD documents. Insert the new controlacess nodes after the first did element using the xdmp: node-insert-after function :) | |
| (: NOTE: For unprefixed names (our EAD documents have unprefixed names) I needed to declare default element namespace, otherwise new elements will go into no namespace. This is what happpened when I first tested the controlaccess elements. :) | |
| declare default element namespace "urn:isbn:1-931666-22-9"; | |
| let $doc := xdmp:directory("/EAD/") |
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 "1.0-ml"; | |
| (: 7/13/11 Working on browse book title list for Digital Library of AK :) | |
| declare namespace METS = "http://www.loc.gov/METS/"; | |
| declare namespace dc = "http://purl.org/dc/elements/1.1/"; | |
| declare namespace html = "http://www.w3.org/1999/xhtml"; | |
| let $collection := fn:collection() | |
| let $first-section := $collection/METS:mets/METS:dmdSec[1] |
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 "1.0-ml"; | |
| (: 6/4/12 This query retrieves multi-volume duplicate titles for the his directory :) | |
| declare namespace ia = "http://my.server/my.directory"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| fn:distinct-values | |
| ( |
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 "1.0-ml"; | |
| (: 5/31/12 This query adds identifiers to <volumeInfo> elements :) | |
| declare namespace ia = "http://my.server/my.directory"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| let $docs := xdmp:directory("/ia-xml/f/", "infinity") | |
| let $titles := $docs/ia:doc/ia:metadata/ia:title |
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 "1.0-ml"; | |
| (: 6/4/12 This query constructs a <volumeInfo> element using part of the IA ID for the <volume> value. :) | |
| declare namespace ia = "http://my.server/my.directory"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| let $docs := xdmp:directory("/ia-xml/l/lv/", "infinity") | |
| for $doc in $docs |
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 "1.0-ml"; | |
| let $query := 'cts:uris()' | |
| let $options := | |
| <options xmlns="xdmp:eval"> | |
| <database>{ xdmp:database("my.database") }</database> | |
| </options> | |
| let $theocomURIs := xdmp:eval($query, (), $options) | |
| let $dcwebURIs := cts:uris("/theocom/ia-xml/")[70001 to 80000] | |
| for $dcwebURI in $dcwebURIs |
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 "1.0-ml"; | |
| (: 11/16/12 This query removes the final period from names :) | |
| declare namespace ia = "http://my.local.namespace.name"; | |
| let $docs := xdmp:directory("/ia-xml/i/", "infinity") | |
| let $meta := $docs/ia:doc/ia:metadata | |
| for $name in $meta/ia:name | |
| let $newNameNode := if (fn:matches($name, "[a-zA-Z]\.\s*$")) then (: keeps final period for names with initials, titles, etc. :) |
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 "1.0-ml"; | |
| (: 11/7/12 This query retrieves and replaces sort titles with punctuation at the beginning of the title :) | |
| declare namespace ia = "http://my.namespace.uri"; | |
| let $docs := xdmp:directory("/ia-xml/o/", "infinity") | |
| let $sortTitles := $docs/ia:doc/ia:metadata/ia:sortTitle | |
| for $sortTitle in $sortTitles | |
| let $newSortTitle := fn:replace($sortTitle, "^\p{P}+\s*", "") |
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 "1.0-ml"; | |
| (: 9/5/12 Query to add documents to the Benson collection :) | |
| declare namespace ia = "http://my.local.namespace"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| for $doc in xdmp:directory("/ia-xml/", "infinity") | |
| let $marcRecord := $doc/ia:doc/ia:metadata/ia:marc/m:record | |
| let $collectionTitles := $marcRecord/m:datafield[@tag = "730"] |
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 "1.0-ml"; | |
| (: 3/27/13 Query the filesystem to add finalized PDFs to a MarkLogic database using the <dc:identfier> value for the filenames :) | |
| declare namespace tei = "http://www.tei-c.org/ns/1.0"; | |
| declare namespace localtei = "http://my.local.tei.customized.schema/tei"; | |
| declare namespace dc = "http://purl.org/dc/elements/1.1/"; | |
| for $teiDoc in fn:collection() | |
| let $newID := $teiDoc/tei:TEI/tei:teiHeader/localtei:metadata/dc:identifier |