public static final String BASE_IRI = "baseIri"; public static final String INDENT = "indent"; public static final String INLINE_BLANK_NODES = "inlineBlankNodes"; public static final String LEADING_COMMENTS = "leadingComments"; public static final String OVERRIDE_STRING_LANGUAGE = "overrideStringLanguage"; public static final String SHORT_URI_PREF = "shortUriPref"; public static final String STRING_DATA_TYPE_OPTION = "stringDataTypeOption"; public static final String TRAILING_COMMENTS = "trailingComments"; public static final String USE_DTD_SUBSET = "useDtdSubset"; public enum ShortIriPreferences {

  PREFIX("prefix"),
  BASE_IRI("base-iri");

  private static final ShortIriPreferences defaultEnum = PREFIX;

  private final String optionValue;

  ShortIriPreferences(String optionValue) {
    this.optionValue = optionValue;
  }

  public String getOptionValue() {
    return optionValue;
  }

  public static ShortIriPreferences getByOptionValue(String optionValue) {
    if (optionValue == null) {
      return null;
    }
    for (ShortIriPreferences sup : ShortIriPreferences.values()) {
      if (optionValue.equals(sup.optionValue)) {
        return sup;
      }
    }
    return null;
  }

  public static String summarise() {
    List<String> result = new ArrayList<>();
    for (ShortIriPreferences sup : ShortIriPreferences.values()) {
      String value = sup.optionValue;
      if (defaultEnum.equals(sup)) {
        value += " [default]";
      }
      result.add(value);
    }
    return String.join(", ", result);
  }
} public enum StringDataTypeOptions {
  EXPLICIT("explicit"),
  IMPLICIT("implicit");

  public static final StringDataTypeOptions DEFAULT_STRING_DATA_TYPE = IMPLICIT;

  private String optionValue;

  StringDataTypeOptions(String optionValue) {
    this.optionValue = optionValue;
  }

  public String getOptionValue() {
    return optionValue;
  }

  public static StringDataTypeOptions getByOptionValue(String optionValue) {
    if (optionValue == null) {
      return null;
    }
    for (StringDataTypeOptions dataTypeOption : StringDataTypeOptions.values()) {
      if (optionValue.equals(dataTypeOption.optionValue)) {
        return dataTypeOption;
      }
    }
    return null;
  }

  public static String summarise() {
    List<String> result = new ArrayList<>();
    for (StringDataTypeOptions dataTypeOption : StringDataTypeOptions.values()) {
      String value = dataTypeOption.optionValue;
      if (DEFAULT_STRING_DATA_TYPE.equals(dataTypeOption)) {
        value += " [default]";
      }
      result.add(value);
    }
    return String.join(", ", result);
  }
} public enum TargetFormats {
  JSON_LD("json-ld", "(JSON-LD)", RDFFormat.JSONLD),
  RDF_XML("rdf-xml", "(RDF/XML)", RDFFormat.RDFXML),
  TURTLE("turtle", "(Turtle)", RDFFormat.TURTLE);

  public static final TargetFormats DEFAULT_FORMAT = TURTLE;

  private final String optionValue;
  private final String optionComment;
  private final RDFFormat rdfFormat;

  TargetFormats(String optionValue, String optionComment, RDFFormat rdfFormat) {
    this.optionValue = optionValue;
    this.optionComment = optionComment;
    this.rdfFormat = rdfFormat;
  }

  public String getOptionValue() {
    return optionValue;
  }

  public String getOptionComment() {
    return optionComment;
  }

  public RDFFormat getRDFFormat() {
    return rdfFormat;
  }

  public static TargetFormats getByOptionValue(String optionValue) {
    if (optionValue == null) {
      return null;
    }
    for (TargetFormats tfmt : values()) {
      if (optionValue.equals(tfmt.optionValue)) {
        return tfmt;
      }
    }
    return null;
  }

  public static String summarise() {
    ArrayList<String> result = new ArrayList<>();
    for (TargetFormats tfmt : values()) {
      String value = tfmt.optionValue;
      if (tfmt.optionComment != null) {
        value += " " + tfmt.optionComment;
      }
      if (DEFAULT_FORMAT.equals(tfmt)) {
        value += " [default]";
      }
      result.add(value);
    }
    return String.join(", ", result);
  }
}
import static org.edmcouncil.rdf_toolkit.util.Constants.BASE_IRI;
import static org.edmcouncil.rdf_toolkit.util.Constants.INDENT;
import static org.edmcouncil.rdf_toolkit.util.Constants.INLINE_BLANK_NODES;
import static org.edmcouncil.rdf_toolkit.util.Constants.LEADING_COMMENTS;
import static org.edmcouncil.rdf_toolkit.util.Constants.OVERRIDE_STRING_LANGUAGE;
import static org.edmcouncil.rdf_toolkit.util.Constants.SHORT_URI_PREF;
import static org.edmcouncil.rdf_toolkit.util.Constants.STRING_DATA_TYPE_OPTION;
import static org.edmcouncil.rdf_toolkit.util.Constants.TRAILING_COMMENTS;
import static org.edmcouncil.rdf_toolkit.util.Constants.USE_DTD_SUBSET;
import org.apache.commons.cli.CommandLine;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.edmcouncil.rdf_toolkit.util.ShortIriPreferences;
import org.edmcouncil.rdf_toolkit.util.StringDataTypeOptions;
import org.edmcouncil.rdf_toolkit.io.format.TargetFormats;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Enterprise Data Management Council
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package org.edmcouncil.rdf_toolkit.runner;


public class RdfToolkitOptions {

  private final String[] args;
  private String output;
  private RunningMode runningMode;
  private CommandLine commandLine;
  private String iriPattern;
  private String iriReplacement;
  private TargetFormats targetFormat;
  private OutputStream targetOutputStream;
  private String baseIriString;
  private IRI baseIri;
  private File sourceFile;
  private InputStream sourceInputStream;
  private boolean inferBaseIri;
  private boolean inlineBlankNodes;
  private boolean useDtdSubset;
  private StringDataTypeOptions stringDataTypeOption;
  private String indent;
  private ShortIriPreferences shortUriPref;
  private RDFFormat rdf4jSourceFormat;
  private String[] leadingComments;
  private String[] trailingComments;
  private String overrideStringLanguage;

  public RdfToolkitOptions(String[] args) {
    this.args = args;
  }

  public String[] getArgs() {
    return args;
  }

  public String getOutput() {
    return output;
  }

  public void setOutput(String output) {
    this.output = output;
  }

  public Map<String, Object> getOptions() {
    Map<String, Object> options = new HashMap<>();
    options.put(BASE_IRI, getBaseIri());