001/*
002 * Copyright 2024 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.dwc.terms;
017
018import java.io.Serializable;
019import java.net.URI;
020
021/**
022 * All OBIS terms with namespace http://rs.iobis.org/obis/terms/.
023 */
024public enum ObisTerm implements Term, AlternativeNames, Serializable {
025  ExtendedMeasurementOrFact,
026
027  measurementTypeID,
028  measurementUnitID,
029  measurementValueID;
030
031  private static final String PREFIX = "obis";
032  private static final String NS = "http://rs.iobis.org/obis/terms/";
033  private static final URI NS_URI = URI.create(NS);
034  public final String[] alternatives;
035
036  @Override
037  public String toString() {
038    return prefixedName();
039  }
040
041  @Override
042  public String simpleName() {
043    return name();
044  }
045
046  @Override
047  public String[] alternativeNames() {
048    return alternatives;
049  }
050
051  /**
052   * @return true if the OBIS term is defining a class instead of a property, e.g. ExtendedMeasurementOrFact.
053   */
054  @Override
055  public boolean isClass() {
056    return Character.isUpperCase(simpleName().charAt(0));
057  }
058
059  @Override
060  public String prefix() {
061    return PREFIX;
062  }
063
064  @Override
065  public URI namespace() {
066    return NS_URI;
067  }
068
069  ObisTerm(String... alternatives) {
070    this.alternatives = alternatives;
071  }
072}