Deleting subject taxonomy

72 views
Skip to first unread message

Hebridean Archives

unread,
Jun 7, 2012, 11:15:37 AM6/7/12
to ICA-AtoM Users
Hi

I uploaded the UKAT SKOS file into the subject taxonomy and it seems
to have installed twice (if you go into manage > taxonomies > subjects
all terms are there twice anyway.) This is causing problems when we
subject index as AtoM wants to quit the edit mode each time you add a
term.

Is there an easy way to delete an entire taxonomy without having to
delete every term indivudlaly? i realise this would mean probably
having to re-subject index most of the records, but we've only added
about 70 so far so this isn't the end of the world and all part of the
learning curve!

David

Jesús García Crespo

unread,
Jun 7, 2012, 2:22:27 PM6/7/12
to ica-ato...@googlegroups.com
Hi,

I believe there is not such option. However, if you can get some help from a developer you may want to try something like:

foreach (QubitTaxonomy::getTaxonomyTerms(QubitTaxonomy::SUBJECT_ID) as $item)
{
  $item->delete();
}

But not without doing a backup first, just in case.

Regards,


--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To post to this group, send email to ica-ato...@googlegroups.com.
To unsubscribe from this group, send email to ica-atom-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ica-atom-users?hl=en.

--
Jesús García Crespo,
Software Engineer, Artefactual Systems Inc.
http://www.artefactual.com | +1.604.527.2056

David Juhasz

unread,
Jun 7, 2012, 2:25:07 PM6/7/12
to ica-ato...@googlegroups.com, qubit-dev
Hi David,

Unfortunately there's no way to batch delete terms through the ICA-AtoM web interface.  

If you have access to the MySQL database, either through the command line tool (http://dev.mysql.com/doc/refman/5.5/en/mysql.html) or a web interface like phpMyAdmin (http://www.phpmyadmin.net/home_page/index.php) you can delete the terms using a SQL delete.

Always make a backup before directly modifying the MySQL database and be sure to understand what the commands below mean before you use them.


Terms are stored in three tables (due to our inheritance and internationalization data model):

1) object
2) term
3) term_i18n

You can delete *all* subject terms from all three tables via the following SQL command:

DELETE FROM object WHERE id IN (SELECT id FROM term WHERE taxonomy_id = 35);



You can delete all subject terms created after a certain date/time (i.e. 2012-06-06 10:05:00) with this SQL command:

DELETE FROM object WHERE id IN (SELECT id FROM term WHERE taxonomy_id = 35) AND created_at > '2012-06-06 10:05:00';


Please be aware that timezone set on your server is not necessarily the same as your local time zone.


Cheers,
David Juhasz

-- 
David Juhasz
Director, Technical Services

Artefactual Systems Inc.
www.artefactual.com
Reply all
Reply to author
Forward
0 new messages