[Archivesspace_Users_Group] Extent Total

Custer, Mark mark.custer at yale.edu
Tue Feb 26 10:29:29 EST 2019


Danielle,

I’ve had to do something similar recently, so I’ve pared down the query that I used to just grab a few bits of data in the Resource table and then combine that with any extent information associated with those Resource records.  The output is one row per Resource.  If the Resource has multiple extent statements, then those multiple extent statements will be separated in the same cell with a “; “ (that’s the “group_concat” part in the SQL query).  For readability, I’ll include a link to the query that I used here:

https://gist.github.com/fordmadox/ebb36454bcbcca6f0dfff5829c948506

There are lots of other tables that you might want to join, though, so as Alex mentions the queries can become quite complex.

I hope that helps, but let us know either way!

Mark



From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Alexander Duryee
Sent: Tuesday, 26 February, 2019 10:11 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] Extent Total

Danielle,

It's probably possible to do this via SQL queries, but it would require a fairly complex query to effectively rebuild the Resource record.  It would likely be easier to do this via requests against the API, which can return a list of all Resources in a repository; from there, you can query those Resources and extract their Extents.

After logging in via the API, you can use this endpoint to get a list of all Resources in a given repository:
https://[your-ASpace-API-address-here]/repositories/[repository_id]/resources?all_ids=true<https://[your-ASpace-API-address-here]/repositories/%5brepository_id%5d/resources?all_ids=true>
(removing the brackets when substituting in your API address and repo ID)

This will return a list of Resource IDs.  You can pass each one to the Resource endpoint:
https://[your-ASpace-API-address-here]/repositories/[repository_id]/resources/[resource_id<https://[your-ASpace-API-address-here]/repositories/%5brepository_id%5d/resources/%5bresource_id>]
(again, removing brackets)

This will return the full JSON representation of the Resource.  The extent metadata lives in the 'extents' field; from there, you can extract the information that you need (e.g. the extent number, container summary, extent type, etc.).

Hope this helps - if you haven't worked with the API before, I'll be happy to send along tutorials/resources.

Thanks!
--Alex


On Mon, Feb 25, 2019 at 6:05 PM Danielle Butler <dbutler at cals.org<mailto:dbutler at cals.org>> wrote:
I am trying to query our MySQL database to get a list of resource identifiers with corresponding extent numbers. I have been fighting with it for a while and I can get a list of extent numbers with no associated resource information with included extents for accessions. With no apparent way to discern which is which (I don’t want both accessions and resource extent data because the data with be duplicative for processed collections). I can get a list of resources, but without extent info. Does anyone know of a way to get both out of the database?

Thanks,

Danielle Butler, CA | Archivist
Butler Center for Arkansas Studies | Central Arkansas Library System
www.butlercenter.org<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.butlercenter.org%2F&data=02%7C01%7Cmark.custer%40yale.edu%7C393121aea1104e5be47c08d69bfc9b55%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C1%7C636867906595412302&sdata=5p5HX4pwFb2Ycke66gKceSAcAXJfuapkZUJ0w8oWM9Q%3D&reserved=0>
100 Rock Street
Little Rock, AR 72201
501-320-5724

_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group at lyralists.lyrasis.org<mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Flyralists.lyrasis.org%2Fmailman%2Flistinfo%2Farchivesspace_users_group&data=02%7C01%7Cmark.custer%40yale.edu%7C393121aea1104e5be47c08d69bfc9b55%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C1%7C636867906595412302&sdata=e6YILSUwgmeO%2F%2BPUk%2BImcOJhIAD4Bsap5T%2FN4N2JseY%3D&reserved=0>


--
Alexander Duryee
Metadata Archivist
New York Public Library
(917)-229-9590
alexanderduryee at nypl.org<mailto:alexanderduryee at nypl.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20190226/9ecc01d7/attachment.html>


More information about the Archivesspace_Users_Group mailing list