"Running an xml process file with the API"
emolano
New Altair Community Member
Hi there,
I have an xml process file. It runs fine with the rapidminer GUI. Is it possible to run it from a java application using the API?
I know one could be rewrite the process using the API
something like inputOperator = OperatorService.createOperator("DatabaseExampleSource");
// set parameters
inputOperator.setParameter("database_system", "MySQL"); ...
but I just want to run my existing xml process file within an eclipse project.
Thanks. Help is appreciated.
I have an xml process file. It runs fine with the rapidminer GUI. Is it possible to run it from a java application using the API?
I know one could be rewrite the process using the API
something like inputOperator = OperatorService.createOperator("DatabaseExampleSource");
// set parameters
inputOperator.setParameter("database_system", "MySQL"); ...
but I just want to run my existing xml process file within an eclipse project.
Thanks. Help is appreciated.
Tagged:
0
Answers
-
Hello emolano
I assume you have read chapter 7 of the tutorial.pdf.
The requested can be perform like this:
hope this was helpful
File processFile = new File("d:/test.xml");
if (!processFile.exists()){throw new Exception("File '" + processFile.getAbsolutePath()+ "' does not exist!");}
Process process = RapidMiner.readProcessFile(processFile);
IOContainer input = new IOContainer();
IOContainer output = process.run(input);
regards,
Steffen0 -
Thanks. It woks fine.
Here my code with the init part:
import java.io.File;
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.operator.*;
public class executeXMLModel {
public static void main(String[] argv) throws Exception {
String modelFile="C:/Documents and Settings/emolano/My Documents/rm_workspace/mining/platform/xmlModel.xml";
// set properties to point to plugin directory
String pluginDirString = new File("C:\\Program_Files\\Rapid-I\\RapidMiner\\lib\\plugins").getAbsolutePath();
System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);
// set properties - rapid miner home
String path="C:\\Program Files\\Rapid-I\\RapidMiner\\";
System.setProperty("rapidminer.home",path );
// initialization
RapidMiner.init(false, true, true, true);
File processFile = new File(modelFile);
if (!processFile.exists()){throw new Exception("File '" + processFile.getAbsolutePath()+ "' does not exist!");}
Process process = RapidMiner.readProcessFile(processFile);
IOContainer input = new IOContainer();
IOContainer output = process.run(input);
}
}
0