001/* 002 * Copyright 2021 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.net.URI; 019 020/** 021 * All Dublin Core terms with namespace http://purl.org/dc/elements/1.1/. All terms exist as DcTerm under a different 022 * namespace, but DcElement values are allowed to be free text, whereas DcTerm values must be a member of a specific 023 * class and therefore given by URI. 024 */ 025public enum DcElement implements Term, AlternativeNames { 026 contributor, 027 coverage, 028 creator, 029 date, 030 description, 031 format, 032 identifier, 033 language, 034 publisher, 035 relation, 036 rights, 037 source, 038 subject, 039 title, 040 type; 041 042 private static final String PREFIX = "dc"; 043 private static final String NS = "http://purl.org/dc/elements/1.1/"; 044 private static final URI NS_URI = URI.create(NS); 045 046 public final String[] alternatives; 047 048 @Override 049 public String toString() { 050 return prefixedName(); 051 } 052 053 @Override 054 public String simpleName() { 055 return name(); 056 } 057 058 @Override 059 public String[] alternativeNames() { 060 return alternatives; 061 } 062 063 @Override 064 public boolean isClass() { 065 return false; 066 } 067 068 @Override 069 public String prefix() { 070 return PREFIX; 071 } 072 073 @Override 074 public URI namespace() { 075 return NS_URI; 076 } 077 078 DcElement(String... alternatives) { 079 this.alternatives = alternatives; 080 } 081}