CSV Import to append relations between Items to Items

Hi!

I am using the module CSV Import to import a lot of different data and it works great. I can import items, media and items sets.

But now I can’t figure out how to add relations between Items.

Example:
I have a painting with all of the info about the painting registered as an Item with a template and a class as physical object, the item has an Identifier like “T78”

But I aslo have the painter registrerad as an Item with all the info about the person with an Identifier as “LAO0067”.

Now I want to import the relation between the Item (the painting) and the person Painter. So that the painter then has all his/her paintings registered as Linked Resources.

I have a list in a CSV file now that looks like this (but +2500 posts):

T77;LAP0078
T77;LAO0078
T78;LAO0067
T78;LAP0406
T79;LAP0164

Append? But I don’t want to append the text “LAO0078” but the relation to the Item post “LAO0078”.

Super thanks for a great forum!

Best!
//Staffan

The “wrench” icon for a row when mapping in CSV Import lets you change the data type of the imported values. One of those options is to import an “Omeka resource”: this is a link to another item or resource in the same Omeka S installation.

Right now with the current CSV Import, the value that needs to be there is the Omeka S internal ID number of the resource you want to link to. So your external identifiers you have in that sheet now, they won’t work, you’d need to go look up what ID number each of those items have and put that in your sheet.

We have an update for CSV Import that adds a feature that makes this easier, but it’s not quite released yet. That update will let you pick what kind of data lookup to use to make the link: the default will still be the Omeka S ID number, but you can choose any property, so if the values in your sheet are Identifiers or Titles or whatever, the importer can look for the existing resource with the matching value for that property and make the connection.

Hi!

aha!, so have a CSV file like;

Internal ID (for the painter, instead of Identifier); Identifier (for the painting)

or

Internal ID (for the painter); Internal ID (for the painting)

And then Advanced settings and Append?

Thanks!
//Staffan

You’re trying to link from the paintings to the painter, right?

To do that you’d have a column that’s either the internal ID or your Identifier for each painting, and then set that up in advanced settings picking the right column and property, so you’re updating each painting item.

Then you’d have a second column which is the ID for the painter of each painting. With the current CSV Import, this needs to be the internal ID. In the mapping screen, you’d map this column to the property you want the link to appear under (like Creator) and then use the “wrench” to set the type to “Omeka S resource (by ID)”.

Think I got it! Thanks!!

Oh, I so need this feature, like this week: I have 70,000 records with 40,000 relations between them to load :slight_smile: I’ll have a look at testing the master version!

John.

The feature I mentioned about picking a property for doing the lookup for relations is now released as part of version 2.6.0 of the CSV Import module.

1 Like

I notised the new version yesterday :slight_smile: so helpful and great. Thanks for the info! Solves a lot of extra work.