001/* 002 * Copyright 2020 Global Biodiversity Information Facility (GBIF) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.gbif.api.model.metrics.cube; 017 018import org.gbif.api.vocabulary.BasisOfRecord; 019import org.gbif.api.vocabulary.Country; 020import org.gbif.api.vocabulary.EndpointType; 021import org.gbif.api.vocabulary.OccurrenceIssue; 022import org.gbif.api.vocabulary.TypeStatus; 023 024import java.util.Arrays; 025import java.util.Collections; 026import java.util.List; 027import java.util.UUID; 028 029/** 030 * The occurrence cube dimension definitions and the way in which they are rolled up into counts. 031 */ 032@SuppressWarnings("unused") 033public class OccurrenceCube { 034 035 public static final Dimension<UUID> DATASET_KEY = new Dimension<>("datasetKey", UUID.class); 036 public static final Dimension<Integer> TAXON_KEY = new Dimension<>("taxonKey", Integer.class); 037 public static final Dimension<BasisOfRecord> BASIS_OF_RECORD = new Dimension<>("basisOfRecord", 038 BasisOfRecord.class); 039 // georeferenced is different from hasCoordinate and includes a no geospatial issue check! 040 public static final Dimension<Boolean> IS_GEOREFERENCED = new Dimension<>("isGeoreferenced", 041 Boolean.class); 042 public static final Dimension<Country> COUNTRY = new Dimension<>("country", Country.class); 043 public static final Dimension<Country> PUBLISHING_COUNTRY = new Dimension<>("publishingCountry", 044 Country.class); 045 public static final Dimension<Integer> YEAR = new Dimension<>("year", Integer.class); 046 public static final Dimension<EndpointType> PROTOCOL = new Dimension<>("protocol", 047 EndpointType.class); 048 public static final Dimension<TypeStatus> TYPE_STATUS = new Dimension<>("typeStatus", 049 TypeStatus.class); 050 public static final Dimension<OccurrenceIssue> ISSUE = new Dimension<>("issue", 051 OccurrenceIssue.class); 052 053 public static final List<Dimension<?>> DIMENSIONS = Collections.unmodifiableList( 054 Arrays.asList( 055 COUNTRY, IS_GEOREFERENCED, BASIS_OF_RECORD, PUBLISHING_COUNTRY, DATASET_KEY, TAXON_KEY, 056 PROTOCOL, YEAR, TYPE_STATUS, ISSUE 057 )); 058 059 // PLEASE KEEP THIS LIST MAINTAINED ALPHABETICALLY so we can spot duplicates and groupings 060 // sort rows as well as dimensions within each row 061 public static final List<Rollup> ROLLUPS = Collections.unmodifiableList( 062 Arrays.asList( 063 new Rollup(BASIS_OF_RECORD), 064 new Rollup(BASIS_OF_RECORD, COUNTRY), 065 new Rollup(BASIS_OF_RECORD, COUNTRY, IS_GEOREFERENCED), 066 new Rollup(BASIS_OF_RECORD, COUNTRY, IS_GEOREFERENCED, TAXON_KEY), 067 new Rollup(BASIS_OF_RECORD, COUNTRY, TAXON_KEY), 068 new Rollup(BASIS_OF_RECORD, DATASET_KEY), 069 new Rollup(BASIS_OF_RECORD, DATASET_KEY, IS_GEOREFERENCED), 070 new Rollup(BASIS_OF_RECORD, DATASET_KEY, IS_GEOREFERENCED, TAXON_KEY), 071 new Rollup(BASIS_OF_RECORD, DATASET_KEY, TAXON_KEY), 072 new Rollup(BASIS_OF_RECORD, IS_GEOREFERENCED, TAXON_KEY), 073 new Rollup(BASIS_OF_RECORD, IS_GEOREFERENCED, PUBLISHING_COUNTRY), 074 new Rollup(BASIS_OF_RECORD, IS_GEOREFERENCED, PUBLISHING_COUNTRY, TAXON_KEY), 075 new Rollup(BASIS_OF_RECORD, PUBLISHING_COUNTRY), 076 new Rollup(BASIS_OF_RECORD, PUBLISHING_COUNTRY, TAXON_KEY), 077 new Rollup(BASIS_OF_RECORD, TAXON_KEY), 078 new Rollup(COUNTRY), 079 new Rollup(COUNTRY, DATASET_KEY, IS_GEOREFERENCED), 080 new Rollup(COUNTRY, IS_GEOREFERENCED), 081 new Rollup(COUNTRY, IS_GEOREFERENCED, PUBLISHING_COUNTRY), 082 new Rollup(COUNTRY, IS_GEOREFERENCED, TAXON_KEY), 083 new Rollup(COUNTRY, PUBLISHING_COUNTRY), 084 new Rollup(COUNTRY, TAXON_KEY), 085 new Rollup(COUNTRY, TYPE_STATUS), 086 new Rollup(DATASET_KEY), 087 new Rollup(DATASET_KEY, IS_GEOREFERENCED), 088 new Rollup(DATASET_KEY, IS_GEOREFERENCED, TAXON_KEY), 089 new Rollup(DATASET_KEY, ISSUE), 090 new Rollup(DATASET_KEY, TAXON_KEY), 091 new Rollup(DATASET_KEY, TYPE_STATUS), 092 new Rollup(IS_GEOREFERENCED), 093 new Rollup(IS_GEOREFERENCED, PUBLISHING_COUNTRY), 094 new Rollup(IS_GEOREFERENCED, PUBLISHING_COUNTRY, TAXON_KEY), 095 new Rollup(IS_GEOREFERENCED, TAXON_KEY), 096 new Rollup(ISSUE), 097 new Rollup(PUBLISHING_COUNTRY), 098 new Rollup(PUBLISHING_COUNTRY, TAXON_KEY), 099 new Rollup(PUBLISHING_COUNTRY, TYPE_STATUS), 100 new Rollup(TAXON_KEY), 101 new Rollup(TAXON_KEY, TYPE_STATUS), 102 new Rollup(TYPE_STATUS), 103 new Rollup(PROTOCOL), 104 new Rollup(YEAR) 105 )); 106 107 // Not intended for instantiation 108 private OccurrenceCube() { 109 } 110}