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;
020import java.util.Arrays;
021
022/**
023 * All GenSC (Genomics Standards Consortium) Minimum Information about any Sequence (MIxS) terms
024 * with namespace https://w3id.org/mixs/ or https://w3id.org/gensc/terms/MIXS:.
025 *
026 * Note URIs here must use the https://w3id.org/mixs/0000001 form, but we keep the simple name for casual use
027 * (the enum names, the simpleName for CSV headers etc).
028 *
029 * See https://genomicsstandardsconsortium.github.io/mixs/
030 *
031 * See https://github.com/GenomicsStandardsConsortium/mixs/blob/main/src/mixs/schema/mixs.yaml
032 */
033public enum MixsTerm implements Term, AlternativeNames, Serializable {
034  samp_size("0000001"),
035  samp_collect_device("0000002"),
036  isol_growth_condt("0000003"),
037  contam_screen_input("0000005"),
038  wga_amp_kit("0000006"),
039  experimental_factor("0000008"),
040  env_broad_scale("0000012"),
041  env_local_scale("0000013"),
042  env_medium("0000014"),
043  rel_to_oxygen("0000015"),
044  samp_mat_process("0000016"),
045  size_frac("0000017"),
046  subspecf_gen_lin("0000020"),
047  ploidy("0000021"),
048  num_replicons("0000022"),
049  extrachrom_elements("0000023"),
050  estimated_size("0000024"),
051  ref_biomaterial("0000025"),
052  source_mat_id("0000026"),
053  pathogenicity("0000027"),
054  biotic_relationship("0000028"),
055  specific_host("0000029"),
056  host_spec_range("0000030"),
057  host_disease_stat("0000031"),
058  trophic_level("0000032"),
059  propagation("0000033"),
060  encoded_traits("0000034"),
061  source_uvig("0000035"),
062  virus_enrich_appr("0000036"),
063  nucl_acid_ext("0000037"),
064  nucl_acid_amp("0000038"),
065  lib_size("0000039"),
066  lib_reads_seqd("0000040"),
067  lib_layout("0000041", "http://gensc.org/ns/mixs/lib_const_meth"),
068  lib_vector("0000042"),
069  lib_screen("0000043"),
070  target_gene("0000044"),
071  target_subfragment("0000045"),
072  pcr_primers("0000046"),
073  mid("0000047"),
074  adapters("0000048"),
075  pcr_cond("0000049"),
076  seq_meth("0000050"),
077  seq_quality_check("0000051"),
078  chimera_check("0000052"),
079  tax_ident("0000053"),
080  sc_lysis_method("0000054"),
081  wga_amp_appr("0000055"),
082  assembly_qual("0000056", "http://gensc.org/ns/mixs/finishing_strategy"),
083  assembly_name("0000057", "http://gensc.org/ns/mixs/assembly"),
084  assembly_software("0000058"),
085  annot("0000059", "http://gensc.org/ns/mixs/annot_source"),
086  number_contig("0000060"),
087  feat_pred("0000061"),
088  ref_db("0000062"),
089  sim_search_meth("0000063"),
090  tax_class("0000064"),
091  _16s_recover("0000065", "16s_recover"),
092  _16s_recover_software("0000066", "16s_recover_software"),
093  trnas("0000067"),
094  trna_ext_software("0000068"),
095  compl_score("0000069"),
096  compl_software("0000070"),
097  compl_appr("0000071"),
098  contam_score("0000072"),
099  contam_screen_param("0000073"),
100  decontam_software("0000074"),
101  sort_tech("0000075"),
102  sc_lysis_approach("0000076"),
103  bin_param("0000077"),
104  bin_software("0000078"),
105  reassembly_bin("0000079"),
106  mag_cov_software("0000080"),
107  vir_ident_software("0000081"),
108  pred_genome_type("0000082"),
109  pred_genome_struc("0000083"),
110  detec_type("0000084"),
111  otu_class_appr("0000085"),
112  otu_seq_comp_appr("0000086"),
113  otu_db("0000087"),
114  host_pred_appr("0000088"),
115  host_pred_est_acc("0000089"),
116  sop("0000090"),
117  associated_resource("0000091"),
118  project_name("0000092"),
119  samp_vol_we_dna_ext("0000111"),
120  sieving("0000322"),
121  pool_dna_extracts("0000325"),
122  samp_name("0001107"),
123  samp_collect_method("0001225");
124
125  private static final String PREFIX = "mixs";
126
127  // This is the current and preferred namespace. The URI given on https://w3id.org/mixs/0000001 (which redirects to
128  // https://genomicsstandardsconsortium.github.io/mixs/0000001/) is itself, https://w3id.org/mixs/0000001.
129  private static final String NS = "https://w3id.org/mixs/";
130
131  // This was the namespace before 2022, and was used for the DNA extension.
132  private static final String OLD_NS = "https://w3id.org/gensc/terms/MIXS:";
133
134  // This was a proposed namespace, or may have been the real namespace. It is used in the GGBN extensions.
135  // https://bioregistry.io/registry/mixs says it was temporary, it's possible it was invented by TDWG people.
136  private static final String VERY_OLD_NS = "http://gensc.org/ns/mixs/";
137
138  private static final URI NS_URI = URI.create(NS);
139  private final String mixsIdentifier;
140  public final String[] alternatives;
141
142  @Override
143  public String toString() {
144    return prefixedName();
145  }
146
147  @Override
148  public String simpleName() {
149    if (this == _16s_recover) {
150      return "16s_recover";
151    }
152    if (this == _16s_recover_software) {
153      return "16s_recover_software";
154    }
155    return name();
156  }
157
158  @Override
159  public String[] alternativeNames() {
160    return alternatives;
161  }
162
163  @Override
164  public String qualifiedName() {
165    return namespace() + mixsIdentifier;
166  }
167
168  @Override
169  public boolean isClass() {
170    return false;
171  }
172
173  @Override
174  public String prefix() {
175    return PREFIX;
176  }
177
178  @Override
179  public URI namespace() {
180    return NS_URI;
181  }
182
183  MixsTerm(String mixsIdentifier, String... alternatives) {
184    this.mixsIdentifier = mixsIdentifier;
185    this.alternatives = Arrays.copyOf(alternatives, alternatives.length + 3);
186    this.alternatives[alternatives.length] = name();
187    this.alternatives[alternatives.length+1] = OLD_NS + mixsIdentifier;
188    this.alternatives[alternatives.length+2] = VERY_OLD_NS + name();
189  }
190}