Hi,
we’re migrating a very large and complex database to Omeka S. At the moment I’m working out the data model.
As I want to be able to modify vocabularies (including the deletion to classes and properties) and templates while exploring the possibilities, I thought it best to create vocabularies, templates and items by API with a script. That way I can always start again with a clean Omeka S installation when I decide to go back a step and take another way. This way everything is reproducible and I can use a version control system like git to track what I do.
With some effort I found out how to do this for vocabularies (you have to use json files, right?) and templates. This hint was a great help: Upload resource template via API - #6 by jflatnes As explained in that thread I wrote a script that uses the API to look up the internal IDs of the template properties and the resource_class before uploading the template files. This way I can upload template files by API that I have exported from an Omeka S installation.
I’m now trying to do the same for items. The problem is that I have items that use value annotations. What is the best way to import these items into an Omeka S instance? I assume csv files won’t work for this, since they don’t support value annotations, right?
I can use JSON and the API to create items, and I can get the property IDs for each property using the API. However, I’m not sure how to get the correct resource template ID for the import. How can I solve this problem?
When I manually create an item in Omeka S and look at it under http://xyz.de/omeka-s/api/items the items begins like this:
{
"@context": "http://xyz.de/omeka-s/api-context",
"@id": "http://xyz.de/omeka-s/api/items/7",
"@type": [
"o:Item",
"schema:Person"
],
"o:id": 7,
"o:is_public": true,
"o:owner": {
"@id": "http://xyz.de/omeka-s/api/users/1",
"o:id": 1
},
"o:resource_class": {
"@id": "http://xyz.de/omeka-s/api/resource_classes/107",
"o:id": 107
},
"o:resource_template": {
"@id": "http://xyz.de/omeka-s/api/resource_templates/3",
"o:id": 3
},
...
]
The json lacks the resource template name. This is an issue because I don’t want to rely on internal IDs in my files—these IDs can change if I delete and recreate a template or move items between different Omeka S installations. Ideally for maximum flexibility I’d like to be able to upload json data that I’ve got from the API without having to modify it manually.
So I think this comes down to two questions:
- How do I import data with value annotation (without knowing the internal IDs that are specific to an installation)? This is the same as this question: How do I export items with value annotations from on Omeka S instance and upload them to another?
- Is it a bug that the json data of an item does not contain the label of the resource template?
Kind regards,
Martin