Delete child descriptions of a known description without removing the parent

30 views
Skip to first unread message

ism...@gmail.com

unread,
Sep 7, 2020, 6:57:24 AM9/7/20
to AtoM Users
Good morning, it happens to me that sometimes we make mistakes when importing a CSV with child descriptions of a description of a fund that already exists. If I use the delete function of informationobject, both the current description and all its children are deleted, but I would like to keep the parent to re-import. Is it possible with AtoM? if not, how could you develop an erasure method for this purpose? I would also like to know which tables are affected when you remove a description. A greeting.

Dan Gillean

unread,
Sep 7, 2020, 4:43:54 PM9/7/20
to ICA-AtoM Users
Hi Isabel, 

In both the user interface and the Delete description command-line task, if you start from a child record, it will only delete the target you provide (and any of its children - but not a parent). So for example, in the user interface if you had a Fonds with 2 series (A and B) below it, each of which had items in the series, and you wanted to delete series A, then navigate to the view page of Series A and use the delete button there. Any items in Series A would also be deleted, but Series B (and its items) and the Fonds-level record would be left intact. 

We don't currently have a command-line task whose purpose is to delete just the descendants of a particular target record, but it would be possible to develop one. In fact, I suspect you could work out how to do this with SQL without too much effort. I will come back to this. 

In terms of tables that are affected when you delete a description - it depends on what's in the record, of course, but I'll try to give you a general picture. Note that we periodically add Entity Relationship Diagrams to our wiki for reference: 
See also: 

First, at the database level, pretty much every major entity type in AtoM has a relation to the object table - this is where initial object IDs are generated and stored when records are created. In the SQL command prompt, try:
  • describe object;
AtoM was developed to be fully translatable, so while main entity details (such as ID) are linked to the object table and stored in the primary entity table (for example, the information_object table for descriptions), any form field that is translatable will generally be found in the related i18n (short for internationalization) table - so a description's title, its scope and content, etc will be stored in the information_object_i18n table.
  • describe information_object;
  • describe information_object_i18n;
The primary information_object table also uses foreign key IDs to store relations to other entities - for example, there is a parent_id column there that will give you the objectID of the parent record. 

AtoM's information object tables were designed around the ICA's ISAD(G) standard, but some of the templates we support include additional descriptive fields that have no equivalent in ISAD(G). A good example of this is the RAD template - it has many fields originally drawn from the AACR2 library cataloguing standard which were never included in ISAD(G) when it was created. Typically, we use the property tables to store these as key/value pairs:
  • describe property;
  • describe property_i18n;
  • SELECT DISTINCT NAME FROM property;
There are also the note and note_i18n tables - these hold General notes, as well as some of the custom note types available in the different templates - such as Archivist's notes in the ISAD(G) template. 
  • describe note;
  • describe note_i18n;
Also, this query will return the note ID, note field label, and a count of how many populated notes we have for each type in a given culture:

There may of course also be foreign key relations to linked entities stored in other tables, such as terms used as access points, authority records used as creators or name access points, linked archival institution records, etc. 

If I wanted to try to craft a SQL query to delete the descendants of a record but not the parent, I would START BY BACKING UP ALL MY DATA before doing anything else! ;)

Then, I would probably start by getting the object ID of the parent record with this query, using the slug as the input: 
From there, I would probably try to construct a join across the object and information_object tables that used the ID of the parent in the parent_id column of the information object (i.e. trying to select the children) to prepare my delete statement.

As to how to properly construct the deletion query - that part I'm not sure about! Ideally, I think you should be deleting from the object table, so it will cascade to other tables, but I'm not 100% sure about that. Perhaps looking through the example queries in our docs, and the code itself, will give you some ideas. 

If you wanted to create a command-line task, you could start by looking at the existing delete-description task, here:
I hope that helps! 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory
he / him


On Mon, Sep 7, 2020 at 6:57 AM ism...@gmail.com <ism...@gmail.com> wrote:
Good morning, it happens to me that sometimes we make mistakes when importing a CSV with child descriptions of a description of a fund that already exists. If I use the delete function of informationobject, both the current description and all its children are deleted, but I would like to keep the parent to re-import. Is it possible with AtoM? if not, how could you develop an erasure method for this purpose? I would also like to know which tables are affected when you remove a description. A greeting.

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/c900abf7-8d8d-4e69-9684-b0c569a7028fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages