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 WGS84 Geo Positioning terms with namespace http://www.w3.org/2003/01/geo/wgs84_pos#
023 */
024public enum Wgs84GeoPositioningTerm implements Term, AlternativeNames, Serializable {
025  SpatialThing,
026  Point,
027
028  lat("http://www.w3.org/2003/01/geo/wgs84_pos#latitude"),
029  location,
030  long_("http://www.w3.org/2003/01/geo/wgs84_pos#longitude", "http://www.w3.org/2003/01/geo/wgs84_pos#lon"),
031  alt("http://www.w3.org/2003/01/geo/wgs84_pos#altitude"),
032  lat_long("lat/long");
033
034  private static final String PREFIX = "wgs84geopositioning";
035  private static final String NS = "http://www.w3.org/2003/01/geo/wgs84_pos#";
036  private static final URI NS_URI = URI.create(NS);
037  public final String[] alternatives;
038
039  @Override
040  public String toString() {
041    return prefixedName();
042  }
043
044  @Override
045  public String simpleName() {
046    if (this == long_) {
047      return "long";
048    }
049    return name();
050  }
051
052  @Override
053  public String[] alternativeNames() {
054    return alternatives;
055  }
056
057  /**
058   * @return true if the WGS84 Geo Positioning term is defining a class instead of a property, e.g. SpatialThing.
059   */
060  @Override
061  public boolean isClass() {
062    return Character.isUpperCase(simpleName().charAt(0));
063  }
064
065  @Override
066  public String prefix() {
067    return PREFIX;
068  }
069
070  @Override
071  public URI namespace() {
072    return NS_URI;
073  }
074
075  Wgs84GeoPositioningTerm(String... alternatives) {
076    this.alternatives = alternatives;
077  }
078}