Black Metropolis Research Consortium: Finding Aids

Table of Contents

Note: 2024-06-24. The information in the following has been superseded by https://github.com/uchicago-library/bmrc.

1. Description

The Library hosts the finding aids of the Black Research Metropolis Consortium (BMRC) in its finding aids databse. Because all queries include a collection name, and because the BMRC finding aids have distinct collection names (see below) BMRC, SCRC and UNCAP finding aids are kept separate for front-end querying even though all three share the same back end.

The UNCAP codebase supports the archives and manuscripts finding aids database of the Special Collections Research Center (SCRC), the finding aids of the Black Metropolis Research Consortium (BMRC), and the finding aids of the Uncovering Chicago Archives Project (UNCAP) (which includes some SCRC finding aids). This document pertains to the second. The UNCAP codebase was developed by MarkLogic Professional Services. The XQuery API was extended by Charles Blair. The user interface was written by John Jung for SCRC and adapted by Charles Blair for the BMRC.

2. Location

2.1. Production

URL: http://www.lib.uchicago.edu/bmrc/
Front end: /data/web/bmrc/index.php
Back end: marklogic:/data/MarkLogic/Apps/uncap/
Port: 8011

3. Loading data

Ensure that the filename minus the ".xml" extension is the same as the content of the eadid (required), num and unitid elements (the latter two for consistency).

Code to do this might look like this.

-module(compare).
-author('Charles Blair').
-organization('University of Chicago Library').
-export([start/1]).

-include("/usr/local/lib/erlang/lib/xmerl-1.3.7/include/xmerl.hrl").
-import(xmerl_xs, [xslapply/2, value_of/1, select/2, built_in_rules/2]).

%%%% Compare the contents of the eadid, num and unitid elements in an
%%%% EAD XML file, and the filename minus the ".xml" extension. One
%%%% way to invoke this over a series of files might be like this:
%%%%
%%%% for files in *.xml
%%%% do                
%%%% erlsh compare start $files
%%%% done > DIFFs
%%%%

%%% XSLT processing. 
%% value_of(select(".", E)) == xslapply(fun template/1, E)
template(E = #xmlElement{name='eadid'}) ->
  io:format("~s\t", [lists:flatten(xslapply(fun template/1, E))]);

template(E = #xmlElement{name='num'}) ->
  io:format("~s\t", [lists:flatten(xslapply(fun template/1, E))]);

template(E = #xmlElement{name='unitid'}) ->
  io:format("~s\t", [lists:flatten(xslapply(fun template/1, E))]);

template(E)->
  built_in_rules(fun template/1, E).

start([I]) ->
  {ok, File} = file:read_file(I),
  Text = binary_to_list(File),
  {C, _} = xmerl_scan:string(Text),
  template(C), % print contents of eadid, num, unitid elements
  Base = re:split(I, ".xml", [{return, list}]), % filename minus ".xml" extension
  io:format("~s~n", [Base]). % print filename minus ".xml" extension for comparison

The output file (DIFFs in this example) can then be cut into columns, and the columns compared, in the usual Unix fashion.

We do the following to get rid of namespaces for a back end which does not use namespaces.

mkdir new
for files in *.xml
do
cat $files | sed -e s'|<ead\ .*>|<ead>|'g > new/$files
done 
cd new
ls *.xml > /tmp/foo

For safety's sake:

scp /tmp/foo staff:/tmp
ssh staff
cd /data/web/ead/bmrc
while read line
do
file $line
done < /tmp/foo | grep -v such

If this is clean, then return to where you were and:

scp /tmp/foo marklogic:/data/MarkLogic/Apps/uncap/admin/loader/BMRC2LOAD
scp *.xml staff:/data/web/ead/bmrc
ssh staff
cd /data/web/ead/bmrc
chmod og+r *

Continue in marklogic:/data/MarkLogic/Apps/uncap/admin/loader/ with

./bmrc_load.sh BMRC2LOAD (See note below.)

The script above adds these collection names to the finding aids.

<collection>institution/Black+Metropolis+Research+Consortium</collection>
<collection>project/BMRC</collection>

Note: Make sure BMRC2LOAD has lines like this

BMRC.BRONZEVILLE.BANKS.xml

and not like this

-rw-r--r--  1 chas  eadspcl     8138 Mar 21 14:08 BMRC.BRONZEVILLE.BANKS.xml

4. Retrieving data

Front end: /data/web/bmrc/index.php, browse.php, search.php, topics.php
Back end: marklogic:/data/MarkLogic/Apps/uncap
browse.php: uncap/admin/gimme_bmrc.xqy
search.php: uncap/request.xqy
topics.php: uncap/ead/topics_bmrc.xqy

Date: 2016-04-06 Rev. 2016-09-23

Author: Charles Blair

Created: 2024-06-24 Mon 13:47