[Archivesspace_Users_Group] Query to retrieve boxes with restricted AOs + local access restrict type

Olivia S Solis livsolis at utexas.edu
Tue Apr 19 10:38:59 EDT 2022

Hello all,

I'm spending an inordinately long time trying to form a query to retrieve
all boxes attached to restricted archival objects in ASpace. I'm hoping
someone in the group with more advanced database skills than I have can
help me out.

We want to identify any box in a certain building that has restricted
materials and the kind of local access restriction it has. Since we use
local access restrictions, the AO that is linked to the box may not have
the local access restriction applied through the accessrestrict note, but a
parent AO will. That parent may or may not be its immediate parent AO. We
only care about the collection title in the box, not the AO title.

I've come up with this query, which is already a mouthful, to retrieve all
the boxes + their collections in the building I want (SRH2):

SELECT DISTINCT rr.id, rr.title, t.indicator, r.top_container_id,
t.barcode, l.title

FROM instance as i

JOIN sub_container as s

ON i.id = s.instance_id

JOIN archival_object as a

ON a.id = i.archival_object_id

JOIN top_container_link_rlshp as r

ON s.id = r.sub_container_id

JOIN top_container as t

ON t.id = r.top_container_id

LEFT JOIN resource as rr

ON rr.id = a.root_record_id

JOIN top_container_housed_at_rlshp as tcha

ON tcha.top_container_id = t.id

JOIN location as l

ON l.id = tcha.location_id

WHERE l.building LIKE "SRH2"

On top of this I want the archival objects in the query to reflect only AOs
that have a local access restriction or who have an immediate or distant
parent AO with one. This is the query I have that will ID AOs with a local
access restriction, which I realize I'll have to extract from the JSON that
is in the notes column of the note table:

SELECT id, resource_id, archival_object_id, notes FROM note WHERE notes
LIKE '%local_access_restriction_type":["%';

Any help would be appreciated. Thank you!


Olivia Solis, MSIS (she/her)
Metadata Coordinator
Dolph Briscoe Center for American History
The University of Texas at Austin
2300 Red River St. Stop D1100
Austin TX, 78712-1426
(512) 232-8013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20220419/9da40a9f/attachment.html>

More information about the Archivesspace_Users_Group mailing list