Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * Return well-written format for Bio2RDF REST service * * * {talendTypes} String * * {Category} User Defined * * {param} string("format") * * {example} restFormat("rdf") */ public static String getFormatFromMime(String formatIn) { if (formatIn.toLowerCase().equals("rdf") || formatIn.toLowerCase().equals("rdfxml") || formatIn.toLowerCase().equals("application/rdf+xml")) { return ("rdfxml"); } else if (formatIn.toLowerCase().equals("n3") || formatIn.toLowerCase().equals("text/rdf+n3")) { return ("n3"); } else if (formatIn.toLowerCase().equals("ttl") || formatIn.toLowerCase().equals("turtle") || formatIn.toLowerCase().equals("text/turtle")) { return ("turtle"); } else if (formatIn.toLowerCase().equals("nt") || formatIn.toLowerCase().equals("text/plain") || formatIn.toLowerCase().equals("ntriple") || formatIn.toLowerCase().equals("ntriples")) { return ("ntriple"); } else if (formatIn.toLowerCase().equals("json") || formatIn.toLowerCase().equals("application/rdf+json") || formatIn.toLowerCase().equals("rdfjson")) { return ("rdfjson"); } else if (formatIn.toLowerCase().equals("jsonld") || formatIn.toLowerCase().equals("application/x-json+ld") || formatIn.toLowerCase().equals("application/ld+json") || formatIn.toLowerCase().equals("application/json") || formatIn.toLowerCase().equals("ldjson")) { return ("jsonld"); } else if (formatIn.toLowerCase().equals("trig") || formatIn.toLowerCase().equals("application/x-trig") || formatIn.toLowerCase().equals("application/trig")) { return ("trig"); } else { System.err.println("Incompatible format"); return ("null"); } } }