-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a mess of files -- not untangling this mess immediately.
- Loading branch information
Showing
8 changed files
with
16,466 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
declare namespace oai = "http://www.openarchives.org/OAI/2.0/"; | ||
|
||
(: Retrieves metadata records for an entire OAI-PMH collection :) | ||
(: Adds records to BaseX database:) | ||
|
||
declare function local:request($base-url as xs:string, $verb as xs:string, $set-spec as xs:string) as document-node()* | ||
{ | ||
let $request := $base-url || $verb || $set-spec | ||
let $response := fn:doc($request) | ||
let $token := $response//oai:resumptionToken/text() | ||
return | ||
if (fn:empty($token)) then | ||
$response | ||
else | ||
($response, | ||
local:resume($base-url, $token)) | ||
}; | ||
|
||
declare function local:resume($base-url as xs:string, $token as xs:string) as document-node()* | ||
{ | ||
let $verb := "?verb=ListRecords&resumptionToken=" | ||
let $request := $base-url || $verb || $token | ||
let $response := fn:doc($request) | ||
let $new-token := $response//oai:resumptionToken/text() | ||
return | ||
if (fn:empty($new-token)) then | ||
$response | ||
else | ||
($response, | ||
local:resume($base-url, $new-token)) | ||
}; | ||
|
||
(: for $set in db:open('repox-sets')/set/spec/text()[fn:starts-with(., 'utk_')] :) | ||
(: fn:doc('http://digi.countrymusichalloffame.org/oai/oai.php?verb=ListRecords&metadataPrefix=oai_qdc') :) | ||
let $base-url := "http://digi.countrymusichalloffame.org/oai/oai.php" | ||
let $verb := "?verb=ListRecords&metadataPrefix=oai_qdc" | ||
let $set-spec := "&set=musicaudio" | ||
let $response := local:request($base-url, $verb, $set-spec) | ||
for $record in $response//oai:record | ||
let $id := $record/oai:header/oai:identifier/text() | ||
return( | ||
db:add('country_music_qdc', $record, $id, map { 'addcache': true() }), | ||
db:optimize('country_music_qdc', true()) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(: some helpful queries :) | ||
|
||
for $name in db:open('repox-sets')/set/spec/text() return db:open($name)/*:record[//@*='deleted']/*:header/*:identifier/text(), | ||
|
||
for $name in db:open('repox-sets')/set/spec/text() return db:open($name)/*:record[*:header/*:identifier[fn:contains(.,'p265301coll005/7')]], | ||
|
||
for $name in db:open('repox-sets')/set/spec/text() return db:open($name)/*:record[*:header/*:identifier[fn:contains(.,'p18877coll16/24')]], | ||
|
||
for $record in db:open('utc_p16877coll16')/record[not(header/identifier[contains(., 'p18877coll16/24')])] return (1 to 3), | ||
|
||
let $target := '/tmp/utk_p16877coll16' | ||
for $record in db:open('utc_p16877coll16')/record[not(header/identifier[contains(., 'p16877coll16/24')])] | ||
let $path := $target || db:path($record) | ||
return ( | ||
file:create-dir(file:parent($path)), | ||
file:write($path, $record) | ||
), | ||
|
||
for $name in db:open('repox-sets')/set/spec/text() return db:open($name)/record/header/identifier/text(), | ||
|
||
//record[descendant::*:format[matches(., '17 inch metal-based acetate disc')] and descendant::*:format[matches(., '33 1/3 rpm; 78 rpm')]] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let $target := '/tmp/utc_p16877coll16_2/' | ||
for $record in db:open('utc_p16877coll16')/record[not(header/identifier[contains(., 'p16877coll16/24')])] | ||
let $path := $target || db:path($record) || '.xml' | ||
return | ||
db:export('utc_p16877coll16', $path, map { 'method': 'xml', 'encoding': 'UTF-8', 'indent': 'yes', 'omit-xml-declaration': 'no' }) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import module namespace functx = 'http://www.functx.com'; | ||
|
||
let $target := '/tmp/utc_p16877coll16/' | ||
for $record in db:open('utc_p16877coll16')/record[not(header/identifier[contains(., 'p16877coll16/24')])] | ||
let $file-full := functx:substring-after-last(db:path($record), ':') | ||
let $file := if (fn:contains($file-full, '/')) | ||
then (fn:replace($file-full, '/', '_')) | ||
else $file-full | ||
let $path := $target || $file || '.xml'(: db:path($record) :) | ||
return ( | ||
(: file:create-dir(file:parent($path)), | ||
file:write($path, $record) :) | ||
file:create-dir(file:parent($path)), | ||
file:write($path, $record) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import module namespace functx = 'http://www.functx.com'; | ||
|
||
let $target := '/mnt/gwork/repox-data/' | ||
let $coll := 'country_music' | ||
|
||
for $record in db:open($coll)/record[descendant::*:format[contains(., '6.5 inch metal-based acetate disc') | ||
or contains(., '10 inch metal-based acetate disc') | ||
or contains(., '8 inch metal-based acetate disc')]] | ||
|
||
let $file-full := functx:substring-after-last(db:path($record), ':') | ||
let $file := if (fn:contains($file-full, '/')) | ||
then (fn:replace($file-full, '/', '_')) | ||
else $file-full | ||
let $path := $target || $coll || '/' || $file || '.xml'(: db:path($record) :) | ||
return ( | ||
file:create-dir(file:parent($path)), | ||
file:write($path, $record) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import module namespace functx = 'http://www.functx.com'; | ||
|
||
let $target := '/mnt/gwork/repox-data/' | ||
let $coll := 'country_music' | ||
|
||
for $record in db:open($coll)/record[descendant::*:format[fn:contains(., '6.5 inch metal-based acetate disc') | ||
or fn:contains(., '10 inch metal-based acetate disc') | ||
or fn:contains(., '8 inch metal-based acetate disc')]] | ||
|
||
let $file-full := functx:substring-after-last(db:path($record), ':') | ||
let $file := if (fn:contains($file-full, '/')) | ||
then (fn:replace($file-full, '/', '_')) | ||
else $file-full | ||
let $path := $target || $coll || '/' || $file || '.xml' | ||
return ( | ||
file:create-dir(file:parent($path)), | ||
file:write($path, $record) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import module namespace functx = 'http://www.functx.com'; | ||
|
||
let $target := '/mnt/gwork/repox-data/' | ||
let $coll := 'crossroadsfreedom' | ||
|
||
for $record in db:open($coll)/record[descendant::*:format[contains(., '6.5 inch metal-based acetate disc') | ||
or contains(., '10 inch metal-based acetate disc') | ||
or contains(., '8 inch metal-based acetate disc')]] | ||
|
||
let $file-full := functx:substring-after-last(db:path($record), ':') | ||
let $file := if (fn:contains($file-full, '/')) | ||
then (fn:replace($file-full, '/', '_')) | ||
else $file-full | ||
let $path := $target || $coll || '/' || $file || '.xml'(: db:path($record) :) | ||
return ( | ||
file:create-dir(file:parent($path)), | ||
file:write($path, $record) | ||
) |