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