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.vocabulary; 017 018import java.util.ArrayList; 019import java.util.List; 020 021/** 022 * Known namespaces for tags. 023 */ 024public enum TagNamespace { 025 026 /** 027 * The public namespace. 028 */ 029 PUBLIC(null), 030 031 /** 032 * Used by the Crawler and related projects. 033 */ 034 GBIF_CRAWLER("crawler.gbif.org"), 035 036 /** 037 * The GBIF DwC-Archive Validator namespace. 038 */ 039 GBIF_VALIDATOR("validator.gbif.org"), 040 041 /** 042 * The GBIF Harvesting and Indexing Toolkit (HIT) namespace. 043 */ 044 GBIF_HARVESTING("hit.gbif.org"), 045 046 /** 047 * The GBIF Registry Metasynchronizer namespace. 048 */ 049 GBIF_METASYNC("metasync.gbif.org"), 050 051 /** 052 * The GBIF Orphans namespace. 053 */ 054 GBIF_ORPHANS("orphans.gbif.org"), 055 056 /** 057 * The GBIF Default Term values namespace. 058 */ 059 GBIF_DEFAULT_TERM("default-term.gbif.org"), 060 061 /** 062 * The Encyclopedia of Life (EOL) namespace. 063 */ 064 EOL("eol.org"), 065 066 /** 067 * The Catalogue of Life (COL) namespace. 068 */ 069 COL("catalogueoflife.org"), 070 071 /** 072 * The Atlas of Living Australia namespace. 073 */ 074 ALA("ala.org.au"); 075 076 private final String namespace; 077 078 TagNamespace(String namespace) { 079 this.namespace = namespace; 080 } 081 082 /** 083 * @return the unique full namespace uri in lower case. 084 */ 085 public String getNamespace() { 086 return namespace; 087 } 088 089 /** 090 * Gets the list of {@link TagName} which belongs to the namespace. 091 */ 092 public List<TagName> getPredicates() { 093 List<TagName> tagNames = new ArrayList<>(); 094 for (TagName tagName : TagName.values()) { 095 if (tagName.getNamespace() == this) { 096 tagNames.add(tagName); 097 } 098 } 099 return tagNames; 100 } 101 102}