Commits

gigadot  committed ab61fc0 Merge

Merge with ned24

  • Participants
  • Parent commits d18b3f4, d82558c

Comments (0)

Files changed (2)

File src/main/java/org/xmlcml/cml/converters/antlr/Gaussian03AST2CML.java

             IOUtils.closeQuietly(inputStream);
         }
     }
+    
 }

File src/main/java/org/xmlcml/cml/semcompchem/SemCompChemCli.java

 import org.apache.commons.lang.StringUtils;
 import org.xmlcml.cml.base.CMLBuilder;
 import org.xmlcml.cml.converters.antlr.CrystalEyeMoietyInputBuilder;
+import org.xmlcml.cml.converters.compchem.gaussian.GaussianArchive2CMLConverter;
 import org.xmlcml.cml.converters.freemarker.FreeMarkerWriter;
 import org.xmlcml.cml.element.CMLMolecule;
+import org.xmlcml.cml.semcompchem.rdf.GaussianCML2RDF;
 import org.xmlcml.cml.semcompchem.tools.MoietyCml2GaussianInputTool;
 
 public class SemCompChemCli {
 	private static final String CONVERTER_OPTION = "c";
 	private static final String INPUT_FILE_OPTION = "i";
 	private static final String OUTPUT_FILE_OPTION = "o";
+	private static final String OUTPUT_FORMAT_OPTION = "format";
+	private static final String FILE_URL = "u";
 
 	public static void main(String[] args) {
 		SemCompChemCli cli = new SemCompChemCli();
 		options.addOption(CONVERTER_OPTION, true, "The converter to use. REQUIRED.");
 		options.addOption(INPUT_FILE_OPTION, true, "The input file for the conversion. REQUIRED.");
 		options.addOption(OUTPUT_FILE_OPTION, true, "The output file for the conversion. REQUIRED.");
+		options.addOption(OUTPUT_FORMAT_OPTION, true, "The output file format for a CML to RDF conversion. OPTIONAL.");
+		options.addOption(FILE_URL, true, "The URL for use in an RDF conversion. OPTIONAL.");
 
 		CommandLineParser parser = new BasicParser();
 		CommandLine cl = null;
 		String converter = cl.getOptionValue(CONVERTER_OPTION);
 		String inputFilepath = cl.getOptionValue(INPUT_FILE_OPTION);
 		String outputFilepath = cl.getOptionValue(OUTPUT_FILE_OPTION);
+		String outputFormat = cl.getOptionValue(OUTPUT_FORMAT_OPTION);
+		String fileUrl = cl.getOptionValue(FILE_URL);
 		if (StringUtils.isEmpty(converter) ||
 				StringUtils.isEmpty(inputFilepath) ||
 				StringUtils.isEmpty(outputFilepath)) {
 			MoietyCml2GaussianInputTool moietyTool = new MoietyCml2GaussianInputTool();
 			moietyTool.convert(inputFile, outputFile);
 		}
+		
+		if ("gaussianOut2Cml".equals(converter)) {
+			GaussianArchive2CMLConverter gauTool = new GaussianArchive2CMLConverter();
+			gauTool.convert(inputFile, outputFile);
+		}
+		
+		if ("gaussianCml2Rdf".equals(converter)) {
+			GaussianCML2RDF gauTool = new GaussianCML2RDF();
+			if (outputFormat != null) {
+				gauTool.setOutputFormat(outputFormat);
+			}
+			try {
+				gauTool.convert(inputFile, fileUrl, outputFile);
+			} catch (Exception e) {
+				System.err.println("Problem during the conversion: "+e.getMessage());
+			}
+		}
 	}
 
 }