Is it possible to delete a single class or property from an imported vocabulary ?
If I correct a vocabulary and import it again, old wrong properties remain.
Also, if I remove a vocabulary and then import the correct one, the items lose their current properties that belong to the removed vocabulary.
Can I do something in the current implementation?
It is not possible to delete an individual member of a vocabulary. This is intentional because, as you mention, existing values assigned to a property will be deleted along with the property. You’ll have to crosswalk the property values to the correct vocabulary before deleting the incorrect one. As far as I know there’s no way to do this other than by hand or by a separate script made for your specific task.
Recently I wanted to remove unused classes and properties because I wanted to use the NestedDataTypes module, but got an out of memory (see issue) because I had loaded the large schema org vocabulary (625 classes, 898 properties).
Examining the database table I found Omeka-S keeps track of the classes and properties used. With this knowledge I constructed the following query to delete unused classes and properties from my imported schema org vocabulary (in my case vocabulary_id 5):
DELETE FROM `resource_class` WHERE `vocabulary_id` = 5 AND id NOT IN
(SELECT DISTINCT (resource_class_id) FROM resource where resource_class_id>0);
DELETE FROM `property` WHERE `vocabulary_id` = 5 AND id NOT IN
(SELECT DISTINCT(property_id) FROM `value` WHERE property_id>0);
I did make a backup of the complete Omeka-S database first, because my assumptions could be wrong. But I found these 2 SQL statements worked in my case.
Thanks … I wil act directly on the database.
This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.