001package org.gbif.dwc.terms;
002
003import java.io.Serializable;
004import java.net.URI;
005
006/**
007 * All Dublin Core terms with namespace http://purl.org/dc/terms/. A small subset of 15 terms exist as DcElement under
008 * a different namespace, but DcTerm values must be a member of a specific class and therefore given by URI, whereas
009 * DcElement values are allowed to be free text.
010 */
011public enum DcTerm implements Term, AlternativeNames, Serializable {
012  abstract_,
013  accessRights,
014  accrualMethod,
015  accrualPeriodicity,
016  accrualPolicy,
017  alternative,
018  audience,
019  available,
020  bibliographicCitation,
021  conformsTo,
022  contributor,
023  coverage,
024  created,
025  creator,
026  date,
027  dateAccepted,
028  dateCopyrighted,
029  dateSubmitted,
030  description,
031  educationLevel,
032  extent,
033  format,
034  hasFormat,
035  hasPart,
036  hasVersion,
037  identifier("ID"),
038  instructionalMethod,
039  isFormatOf,
040  isPartOf,
041  isReferencedBy,
042  isReplacedBy,
043  isRequiredBy,
044  isVersionOf,
045  issued,
046  language,
047  license,
048  mediator,
049  medium,
050  modified,
051  provenance,
052  publisher,
053  references,
054  relation,
055  replaces,
056  requires,
057  rights,
058  rightsHolder,
059  source,
060  spatial,
061  subject,
062  tableOfContents,
063  temporal,
064  title,
065  type,
066  valid,
067  Location;
068
069  private static final String PREFIX = "dcterms";
070  private static final String NS = "http://purl.org/dc/terms/";
071  private static final URI NS_URI = URI.create(NS);
072  public final String[] alternatives;
073
074  @Override
075  public String toString() {
076    return prefixedName();
077  }
078
079  @Override
080  public String simpleName() {
081    if (this == abstract_) {
082      return "abstract";
083    }
084    return name();
085  }
086
087  @Override
088  public String[] alternativeNames() {
089    return alternatives;
090  }
091
092  /**
093   * @return true if the dc term is defining a class instead of a property, e.g. Location
094   */
095  @Override
096  public boolean isClass() {
097    return Character.isUpperCase(simpleName().charAt(0));
098  }
099
100  @Override
101  public String prefix() {
102    return PREFIX;
103  }
104
105  @Override
106  public URI namespace() {
107    return NS_URI;
108  }
109
110  DcTerm(String... alternatives) {
111    this.alternatives = alternatives;
112  }
113
114}