How do we set primary image in object representation import mapping?

I tried to find information on how to specify that a given image would be the primary image. In our case, we can have up to 5 images for an object. One of those should be the primary image. I tried to guess and changed my refinery parameters to:

{
  "objectRepresentationType": "front",
  "relationshipType": "depicts",
  "mediaPrefix": "medias/oeuvres/",
  "attributes": {
    "access": 1,
    "media": "^84",
    "idno": "^84",
    "credit_line": "^78",
    "caption": "^79",
    "is_primary": "1"
  }
}

But this does not work.

When I was doing my tests a long time ago, I thought the last image in a mapping would be the primary image. This is what seemed to happen back then with my sample but now when I load all the 4500 images for my objects, I see this is not the case. I have a record for which the primary is not at all what we want. I brought it in my sample set, and I don't get the correct primary image.

If there was a way to specify that directly in the mapper, it would be nice, but I am in the dark.

Comments

  • I've added a new “isPrimary” option to the objectRepresentation splitter to allow us to control which one gets the primary flag if desired. The mapping you had in the original post needs to be slightly changed to work. It goes like this:

    {
      "objectRepresentationType": "front",
      "isPrimary": "1",
      "relationshipType": "depicts",
      "mediaPrefix": "medias/oeuvres/",
      "attributes": {
        "access": 1,
        "media": "^84",
        "idno": "^84",
        "credit_line": "^78",
        "caption": "^79"
      }
    }
    

    For now (December 2021), the code for this change is in the develop branch.

Sign In or Register to comment.