Could not find object matching slug "Bears and Man

66 views
Skip to first unread message

Perry Santos

unread,
Mar 19, 2024, 3:40:13 PMMar 19
to AtoM Users
Hi guys

We are having a strange issue.
We try to import a new csv file in a new slug (named beares and man) we are getting the error of <Could not find object matching slug "Bears and Man">. The full error is found bellow.

[info] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": Job started.
[info] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": Parameters: {"index":true,"doCsvTransform":false,"skip-unmatched":false,"skip-matched":false,"parentId":null,"objectType":"informationObject","importType":"csv","update":"import-as-new","repositorySlug":"","collectionSlug":null,"file":{"name":"Bears and Man-dosgen-excel-T1-BaM-CSV.csv","type":"text\/csv","tmp_name":"\/usr\/share\/nginx\/atom\/uploads\/tmp\/TMP3312cd05.csv","error":0,"size":7079},"name":"arFileImportJob","id":"1473"}
[info] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": Importing CSV file: Bears and Man-dosgen-excel-T1-BaM-CSV.csv.
[info] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": Indexing imported records.
[info] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": Update type: import-as-new
[err] [2024-03-19 11:40:26] Job 1473 "arFileImportJob": php '/usr/share/nginx/atom/symfony' 'csv:import' --index     --quiet --user-id="452" --source-name='Bears and Man-dosgen-excel-T1-BaM-CSV.csv'  '/usr/share/nginx/atom/uploads/tmp/TMP3312cd05.csv';   Could not find object matching slug "Bears and Man"
[info] [2024-03-19 11:40:27] Job 1473 "arFileImportJob": Job finished.


But if we import the same file on an existing slug, it imports without any issue.

I have tryed restarting atom-worker and mysql and I reindex the db. No success and I also restarted the server itself and we are still having the issue.

Has anyone experience this issue and is there an easy solution.

Thank you very much

Perry

Dan Gillean

unread,
Mar 20, 2024, 9:39:08 AMMar 20
to ica-ato...@googlegroups.com
Hi Perry, 

If I understand correctly, you are trying to create a new record with a specific slug, by defining what you want the new slug to be in your CSV, using the qubitParentSlug column, and it's not working - is that right?

If so: 

Unfortunately, the qubitParentSlug column cannot be used like that. It is only used to link an incoming description to an existing parent record via the slug  - i.e., your second case: 

But if we import the same file on an existing slug, it imports without any issue.

There is no way to perfectly define in advance via the CSV what slug you want a record to have - partially because slugs MUST be unique in AtoM, so how should AtoM handle an incoming CSV row that has a duplicate slug, or a slug with illegal characters? I'm sure different users will want different outcomes when issues are encountered, which quickly leads to some feature bloat if we try to address them all. 

Instead, AtoM allows you via the settings to determine how slugs will be automatically generated, and then gives you the option to manually edit a slug AFTER it has been generated based on your settings. But: let's start with the CSV columns first. 

Hierarchical relationships in CSV imports

There are two ways to define hierarchical parent-child relationships in an AtoM description CSV template: the parentId column, and the quibitParentSlug column. They are used for different purposes. 

parentId
  • the parentId column is used when you want to make a description row the child of another NEW record contained in the same CSV - for example, if you are creating a new series in row 3 of your CSV, and then in rows 4 and 5 you want to add two new file-level descriptions that will be imported as children to the new series. In that case, you would add the legacyId value of the series in row 3 to the parentId column of your files in rows 4 and 5. So long as the parent is created FIRST in the csv (AtoM imports the CSV in the order of the rows, so parent records should be in a row "above" any children), this is used to manage parent-child relations when both parent and child are found in the CSV
  • Docs: https://www.accesstomemory.org/docs/latest/user-manual/import-export/csv-import/#legacyid-and-parentid
  • Example: 



qubitParentSlug
  • the qubitParentSlug column is only used when you are importing new records that you want to add as children to an existing description in AtoM. So in this case for example, perhaps I have already created my Series-level record via the user interface, and now I want to import a CSV of file-level descriptions a children of that existing Series. To do so, I will copy the slug (i.e. the permalink - the unique part of the URL when on the view page of the parent record) of my target Series parent, and I will add that to the qubitParentSlug column for every row I want to import as a child of that Series. Because slugs are unique in AtoM, as the import progresses AtoM will use the slug as a lookup and attach those rows to the series description instead of importing them as new top-level records. 
  • Docs: https://www.accesstomemory.org/docs/latest/user-manual/import-export/csv-import/#qubitparentslug
  • Example: 


General usage notes
  • AtoM does not force you to add a legacyId value to every row of your CSV import, but it is good practice to do it anyway, for potential future updates. However, legacyId values are REQUIRED if you intend to use the parentId column, since the values you add in the parentId column are the legacyId values of the target parent description. 
  • You CAN use both qubitParentSlug and parentId in a single CSV import - for example, you can add 1 row that creates a new file using qubitParentSlug to link that file to an existing series in AtoM, and then in the next row, create a new item-level description that uses the parentId column to make the item a child of the new file in the row above it. However, note that you CANNOT use qubitParentSlug and parentId in a single row - i.e. in a single description. If you do add values to both columns in a single row, AtoM will ignore the parentId value and use the slug value instead. 
  • There is another introductory section in the docs that outlines the legacyId column, and explains in part its role in update imports - see: https://www.accesstomemory.org/docs/latest/user-manual/import-export/csv-import/#legacy-id-mapping-dealing-with-hierarchical-data-in-a-csv
  • In addition to the documentation linked above, we also have some slides that outline CSV description import preparation. See: https://www.slideshare.net/accesstomemory/csv-import-in-atom
  • AtoM also has a CSV validator that can be run before an import, which would have reported this issue. See: https://www.accesstomemory.org/docs/latest/user-manual/import-export/csv-validation/
  • It's also possible for an administrator to turn on a setting so that validation is automatically run BEFORE any import via the user interface, and can prevent the import if errors are found. See: https://www.accesstomemory.org/docs/latest/user-manual/import-export/csv-validation/#csv-validator-import-settings
    • Note that there are many valid reasons why a well-formed CSV might generate warnings (for example, if you are purposefully creating a new archival institution record as part of your import, AtoM's validator will warn you about that, even though you're doing it on purpose). These are there to make sure you know the consequences of the import. For this reason, I don't recommend setting it to strict (and failing imports that generate warnings), but rather using the permissive setting (which will halt imports that generate errors, but not warnings). 

Slugs in AtoM

Next, I wanted to quickly mention a few things about slugs, and some of the settings options available to you. First, an overview of how slugs work by default in AtoM is available here: 
So, by default in AtoM, slugs are unique, and will be generated based on the title of the description in a new installation using default settings. However, you can change those settings to use the identifier or reference code instead - see: 
Additionally, as noted in the first link, AtoM will by default automatically sanitize the slug - lowercasing all letters, removing special characters, replacing spaces with dashes, and appending an incrementing number to any non-unique slug value. Meaning by default, an attempt to use Bears and Man as a slug value would be sanitized to: bears-and-man

However, AtoM also has another setting that will make the options for slugs more permissive - see: 
When this setting is enabled: 
  • Case will be preserved when generating slugs
  • Accented UTF-8 characters will be preserved in the slug
  • Special characters that are not reserved (such as , - _ ~ : = * @ ) will also be preserved in generated slugs
Meaning, if your incoming description was titled "Bears and Man" and you had enabled the permissive slug setting, the default slug derived from the title would now be: 
  • Bears-and-Man
Finally, AtoM also has a module that will allow you to customize your slug after the import, if the generated slug is not to your liking (for example, maybe you already have a Bears-and-Man slug from a different description, and don't like the auto-generated Bears-and-Man-1 slug for the new description), you can customize it within the availabe limitations for slugs using the Rename module: 
There is also a command-line task that can be used to rename a slug, either one at a time, or bulk via a simple CSV: 
I hope this helps you properly configure your import for success in the next round! 

Cheers, 

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


--
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/097a033c-cc5b-4ec6-9cad-5b7127df1b8dn%40googlegroups.com.

Perry Santos

unread,
Mar 20, 2024, 10:34:55 AMMar 20
to AtoM Users
Hi Dan

I relase I forgot to mentionned an important info, sorry for that.
We actually made a duplicate of the CSV, one with the value of qubitParentSlug = aphasie (which worked fine) and the second CSV   with the value of qubitParentSlug = Bears and Man (which did not work) As for the first the slug named aphasie already existed thats why it workded, while the second one we create a new slug using the second CVS file  with the value of qubitParentSlug = Bears and Man and thats where the issue is.

****************
# CSV aphasie
legacyId parentId qubitParentSlug
aphasie


# CSV Bears and man
legacyId parentId qubitParentSlug
Bears and man
****************

Hope that helps.

Perry Santos

unread,
Mar 20, 2024, 10:40:32 AMMar 20
to AtoM Users
Snapshot of both csv

atom-.jpg
****************

Dan Gillean

unread,
Mar 20, 2024, 11:29:40 AMMar 20
to ica-ato...@googlegroups.com
Hi Perry, 

Thanks for the additional details, though I suspect the answer to the issue is still in my previous response. 

"Bears and Man" will not be a slug that already exists in AtoM, because even if you already have a description with the title "Bears and Man", AtoM would have sanitized the slug to remove the spaces. So, as you have added it in your CSV, it would not find a match with any existing slug. 

If you are trying to use that column to create a new description with a specified slug, then you are misunderstanding the purpose of the field. 

In all cases, you should be looking at an existing slug value in AtoM, and copying that EXACTLY into your csv where you want a specific row of the CSV to import as a child of an existing record. That's how the field works. Please review the documentation links included in my last post, as I suspect they may help you address this issue going forward!

Cheers, 


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

Perry Santos

unread,
Mar 20, 2024, 11:50:11 AMMar 20
to AtoM Users
Hi Dan

Thanks for the response, indead I never worked with Atom I am just helping some one with an issue at the office.
I have asked him to review your first comment and see if we missed something.

Thanks for the quick reply. I return back if more questions or else.
Greatings

Reply all
Reply to author
Forward
0 new messages