database: refactor import script.
database: add support for relations import.
views: improve groups and relations views.