Fixes for eu inherited listing

Fixes cases of incorrectly calculated eu listing, where species where showing up as not listed even though they should have inherited a higher taxon's listing. In all those cases the species were listed in their own right under the previous eu_regulation, which is why the new listing for a hightr taxon would not be applied. Within CITES in such situations there would be an inclusion record to say that the species is now listed with the family; within EU an entirely new approach was needed, which would isolate listing changes from different legislative periods.

The changes are quite significant and result in an extremely elongated Sapi.rebuild process. So far the ability to perform partial recalculations has not been addressed.

1. take all EU Annex regulations and find non-overlapping intervals in which regulations are effective; e.g. if we have reg1 effective 1997-2000, reg2 effective 1998-2000 and reg3 effective 1999-2000, thish should result in the following intervals with effectuve regulations:
1997-1998 reg1
1998-1999 reg1, reg2
1999-2000 reg1, reg2, reg3
2. for every interval, take all the listing changes which belong to effective regulations and run the cascading calculation exactly like for CITES, resulting in one table / interval
3. union the interval tables + use DISTINCT to remove duplicates

The rebuild_listing_changes_mview function has been split into 3 per-designation functions; this is part of the process of partitioning the rebuild scripts so that they can be re-run partially in the future. What followed is a large number of changes in the specs.

While doing that it was a convenient time to add excluded_taxon_concepts_ids, listed_geo_entities_ids and excluded_geo_entities_ids to the listing changes mviews. We can use those columns to optimise the search by geo entity query in Species+, by reducing the number of joins.

Also, a function to calculate the valid_species_name_annex_year mview (for future use in trade) was implemented. We might need to optimise this bit for both CITES and EU, because this is quite a resource intensive computation and the resulting mview has almost 2 million rows.

I could write forever about the intricacies of eu legislation cascading, but have no hope that anyone got this far so I'll be finishing now :P

    rake db:migrate
    rake import:eu_annex_regulations_end_dates
    Sapi.rebuild

An example to check with is Diospyros aculeata.