[Archivesspace_Users_Group] Transfer/export to another repository on another server ?

Nathan Stevens ns96 at nyu.edu
Mon Sep 22 14:27:49 EDT 2014


I believe the next ASpace version should be out in a couple of weeks.

As for getting the entire Resource record and it's children, here is the
response sent to another user by the ASpace developer who wanted to do
something similar.

*I don't think there is a way to do this currently for a resource in on
REST call. I think the concern would be this could return a very large JSON
response ( and load on the DB) , since resources can have a large number of
children. *


 *The current practice is to get the tree ( which returns URIs, titles, and
some of the basic MD) and load the children as needed...*


 *I just threw something together that might work for you here =>
https://gist.github.com/cfitz/e29389c3f3830f589700
<https://gist.github.com/cfitz/e29389c3f3830f589700>*


 *It's in ruby and it requires the rest-client gem
<https://github.com/rest-client/rest-client>.  ( $ gem install
rest-client ... not to be confused with the annoyingly named "restclient"
gem)*


 This will get a resource, then iterate through the children and merge in
the their records and spit out the resource JSON files into a directory.

Hopefully it gives you the general idea...

Let me know if you have any questions...


On Mon, Sep 22, 2014 at 12:39 PM, Steven Majewski <sdm7g at virginia.edu>
wrote:

>
> On Sep 22, 2014, at 10:20 AM, Nathan Stevens <ns96 at nyu.edu> wrote:
>
> Copying resource records from one ASpace instance to an other, using JSON
>  could be problematic.  Those JSON resource records may have links to
> related records (Subjects, Agents, Accessions, Locations, Digital Objects)
> which won't be valid on the other ASpace instance.  Is this situation, you
> would either get an error, or the record would transfer, but it would be
> link to the wrong set related records.
>
>
>
> That’s what I was afraid of. :-(
>
> The solution for this problem is very challenging, and I think the safest
> way to do this for now is by using EAD import/export once the importers are
> improved in the next ASpace release.
>
>
>
> My understanding, so far:
>
> GET/POST repositories/:repo/resources/:id     returns or takes
> a JSONModel(:resource)
>
> POST /repositories/:repo_id/batch_imports   takes a JSON array of, in the
> example I’ve dumped,
>        jsonmodel_type:resource   and  several
>   jsonmodel_type:archival_object
> and possibly other types as well.
> These nodes are linked by temporary URIs like, for example:
>
>    "uri" :
> "/repositories/import/archival_objects/import_9155986b-6520-45cc-ba43-d06e29d925e4",
>    "resource" : {
>       "ref" :
> "/repositories/import/resources/import_d04f091f-9611-4128-bb9c-91d7c4843db1"
>    },
>
> I assume those URI’s  have to match up like id/idref’s and that the batch
> import creates those temporary URIs
> and then converts them to the permanent ids.
>
> It would be nice if there were a matching API call to output the entire
> resource tree in that format.
>
> I saw that there was a:  GET /repositories/:repo_id/resources/:id/tree  in
> the API, which I hoped would do that.
> It appears to return the tree of archival_objects attached to the
> resource, but in a different format: it appears
> to be a single resource tree with embedded child nodes.  ( I don’t yet
> know if those child nodes are complete,
> or if they just represent the structure and require additional API GET
> calls to retrieve the children. )
>
>
> So, it would appear that I need either an external program to convert the
> output of a GET…/tree into the
> input of a POST…/batch_imports, or else add the missing API methods to the
> backend.
>
> Although the fact that those API methods are missing makes me think there
> are even more complications
> that aren’t yet obvious to me.
>
>
> — Steve Majewski / UVA Alderman Library
>
>
> [  P.S. Is the an ETA for the next AS release ?  ]
>
>
>
> On Fri, Sep 12, 2014 at 4:24 PM, Steven Majewski <sdm7g at virginia.edu>
> wrote:
>
>>
>> I know I can transfer a resource from one repository to another on the
>> same server.
>> I there a way to easily move a resource from one ArchivesSpace server
>> instance to another ?
>>
>> I know I can export to EAD and reload that again, but we’ve been having
>> enough problems with
>> EAD import and export that I’ld rather not do it this way.
>>
>> I tried what I thought was the obvious API method:
>>
>>
>> ./curl_as_osx admin [pwd] -O
>> http://archives-test.lib.virginia.edu:8089/repositories/9/resources/3964
>>
>> ./curl_as_osx admin [pwd] -d @3964
>> http://localhost:8089/repositories/2/batch_imports
>>
>> But I get this error:
>>
>> [
>> {"status":[{"id":1,"label":"Reading JSON
>> records","type":"started"},{"id":1,"label":"Reading
>> JSON records","type":"done"},{"id":2,"label":"Validating records and
>> checking links","type":"started"}]},
>> {"saved":[],"errors":["Server error: Can not deserialize instance of
>> java.util.LinkedHashMap out of VALUE_STRING token\n at [Source:
>> java.io.FileReader at 51d866d9; line: 1, column: 1]"]}
>>
>> ]
>>
>>
>> Is that something that should theoretically work ? Or am I trying to feed
>> it the wrong JSON schema ?
>>
>> I only want to move selected records, so a database dump is not a simple
>> way to do it either.
>>
>> Are there any other migration tools to help with this problem ?
>>
>>
>>
>>
>> — Steve Majewski / UVA Alderman Library
>>
>>
>>
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> Archivesspace_Users_Group at lyralists.lyrasis.org
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>>
>>
>
>
> --
> Nathan Stevens
> Programmer/Analyst
> Digital Library Technology Services
> New York University
>
> 1212-998-2653
> ns96 at nyu.edu
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>


-- 
Nathan Stevens
Programmer/Analyst
Digital Library Technology Services
New York University

1212-998-2653
ns96 at nyu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20140922/4df00487/attachment.html>


More information about the Archivesspace_Users_Group mailing list