<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Olivia –<o:p></o:p></p>
<p class="MsoNormal">Not a database query, but in case it helps: I have had some success by searching in Manage Top Container using the restriction enumeration values.  For example, if you have used the local restriction “InProcessSpecColl”, you can search
 that as a keyword.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Mileage will vary depending on the detail you need, especially given the pitfalls of keyword searches. But, this can work in a pinch if you are only trying to search within 1 repository at a time, and only need a list of the Boxes, Resources/Accessions,
 or other high level detail.  A Download CSV option is also available to export some of the result details, depending on which aspace version you’re on.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Nancy<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> archivesspace_users_group-bounces@lyralists.lyrasis.org <archivesspace_users_group-bounces@lyralists.lyrasis.org>
<b>On Behalf Of </b>Andrew Morrison<br>
<b>Sent:</b> Tuesday, April 19, 2022 12:13 PM<br>
<b>To:</b> archivesspace_users_group@lyralists.lyrasis.org<br>
<b>Subject:</b> Re: [Archivesspace_Users_Group] Query to retrieve boxes with restricted AOs + local access restrict type<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:12.0pt;background:#FFEB9C">
<b><span style="font-size:9.0pt;color:#9C6500">External Email - Exercise Caution</span></b><o:p></o:p></p>
<div>
<p>If you need to ascend the hierarchy of archival objects within collections, from the ones that link to containers, to the ones with the access restrictions, then you are probably going to need to write a stored procedure.<o:p></o:p></p>
<p>Andrew.<o:p></o:p></p>
<p><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 19/04/2022 15:38, Olivia S Solis wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Hello all, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">SELECT DISTINCT
<a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Frr.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=nk%2BmdUeMDDPoIfICYeEmZEkbHWLiA2tgx0a7yUJRh%2Fg%3D&reserved=0">
rr.id</a>, rr.title, t.indicator, r.top_container_id, t.barcode, l.title</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">FROM instance as i</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN sub_container as s</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fi.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=q4SLEjyA4n0SCKgcMDhy42NK3E7IeLGKBRZkIaZyOrw%3D&reserved=0">
i.id</a> = s.instance_id</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN archival_object as a</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fa.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=8%2FV0Kz8QtFEFIug45llUUkgEFKd1AUKsKogafHq2d6E%3D&reserved=0">
a.id</a> = i.archival_object_id</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container_link_rlshp as r</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=QZEkrnzpqaut58MXw6ZBHgMZMb5Ak1TMpYOfFryibUA%3D&reserved=0">
s.id</a> = r.sub_container_id</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container as t</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ft.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=GarT1h395FHJJmXcVKT%2FMx93ZQQh7H4wqJ2%2FBBexFPU%3D&reserved=0">
t.id</a> = r.top_container_id</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">LEFT JOIN resource as rr</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Frr.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=nk%2BmdUeMDDPoIfICYeEmZEkbHWLiA2tgx0a7yUJRh%2Fg%3D&reserved=0">
rr.id</a> = a.root_record_id</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN top_container_housed_at_rlshp as tcha</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON tcha.top_container_id =
<a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Ft.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=GarT1h395FHJJmXcVKT%2FMx93ZQQh7H4wqJ2%2FBBexFPU%3D&reserved=0">
t.id</a></span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">JOIN location as l</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">ON <a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fl.id%2F&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=rpkYl05VCFAGQgAAyu5AK3LJC%2FDZEERzS%2FvDOvslBaE%3D&reserved=0">
l.id</a> = tcha.location_id </span><o:p></o:p></p>
<p style="margin:0in"><span style="font-family:"Courier New";color:black">WHERE l.building LIKE "SRH2"</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New";color:black">SELECT id, resource_id, archival_object_id, notes FROM note WHERE notes LIKE '%local_access_restriction_type":["%';</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Any help would be appreciated. Thank you!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-Olivia<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Olivia Solis, MSIS (she/her)</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Metadata Coordinator</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Dolph Briscoe Center for American History</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">The University of Texas at Austin</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">2300 Red River St. Stop D1100</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">Austin TX, 78712-1426</span><span style="font-size:9.5pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;color:black">(512) 232-8013</span><span style="font-size:9.5pt;color:#888888"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Archivesspace_Users_Group mailing list<o:p></o:p></pre>
<pre><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org">Archivesspace_Users_Group@lyralists.lyrasis.org</a><o:p></o:p></pre>
<pre><a href="https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flyralists.lyrasis.org%2Fmailman%2Flistinfo%2Farchivesspace_users_group&data=05%7C01%7CKennedyN%40si.edu%7Ced206f4baa1647de2d6508da221f80c6%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637859817714793226%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=EBhTj9hEHqJYVQog%2BgQKMjeKC86X0Ju93jIjPS0RX8I%3D&reserved=0">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><o:p></o:p></pre>
</blockquote>
</div>
</div>
</body>
</html>