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 Chronometric terms with namespace http://rs.tdwg.org/chrono/terms/.
023 */
024public enum ChronoTerm implements Term, AlternativeNames, Serializable {
025  ChronometricAge,
026
027  chronometricAgeConversionProtocol,
028  chronometricAgeDeterminedBy,
029  chronometricAgeDeterminedDate,
030  chronometricAgeID,
031  chronometricAgeProtocol,
032  chronometricAgeReferences,
033  chronometricAgeRemarks,
034  chronometricAgeUncertaintyInYears,
035  chronometricAgeUncertaintyMethod,
036  earliestChronometricAge,
037  // Misspelling in https://rs.gbif.org/extension/gbif/1.0/dna_derived_data_2022-02-23.xml
038  earliestChronometricAgeReferenceSystem("earlliestChronometricAgeReferenceSystem"),
039  latestChronometricAge,
040  // Misspelling in https://rs.gbif.org/extension/gbif/1.0/dna_derived_data_2022-02-23.xml
041  latestChronometricAgeReferenceSystem("lattestChronometricAgeReferenceSystem"),
042  materialDated,
043  materialDatedID,
044  materialDatedRelationship,
045  uncalibratedChronometricAge,
046  verbatimChronometricAge;
047
048  private static final String PREFIX = "chrono";
049  private static final String NS = "http://rs.tdwg.org/chrono/terms/";
050  private static final URI NS_URI = URI.create(NS);
051  public final String[] alternatives;
052
053  @Override
054  public String toString() {
055    return prefixedName();
056  }
057
058  @Override
059  public String simpleName() {
060    return name();
061  }
062
063  @Override
064  public String[] alternativeNames() {
065    return alternatives;
066  }
067
068  /**
069   * @return true if the chronometric term is defining a class instead of a property, e.g. ChronometricAge.
070   */
071  @Override
072  public boolean isClass() {
073    return Character.isUpperCase(simpleName().charAt(0));
074  }
075
076  @Override
077  public String prefix() {
078    return PREFIX;
079  }
080
081  @Override
082  public URI namespace() {
083    return NS_URI;
084  }
085
086  ChronoTerm(String... alternatives) {
087    this.alternatives = alternatives;
088  }
089}