I have a text classification process in RapidMiner. It reads the test data from specified excel ssheet and does the classification. I have also a small Java application whic
I see two ways to do that.
The first one would be to change programatically the XML definition of your process. Rapidminer processes are specified by an XML file with .rmp extension. In the file you will find the definition of the operator you wish to change. This is an excerpt from a simple process specifiing the Read Excel operator:
I highlighted the part where the path to the excel file is. You can overwrite that in your application. Just be careful not to break the XML file.
The other way is to modify the operator after you load the process in your java application. You can get a reference to your operator by Process#getOperator(String name) or Process#getAllOperators(). I guess it should be of one of these classes:
com.rapidminer.operator.io.ExcelExampleSource
com.rapidminer.operator.nio.ExcelExampleSource
When you find the correct operator you modify the path by Operator#setParameter(String key, String Value).
This code works for me with RapidMiner 5.3: (the process is just a Read Excel operator and a Write CSV operator)
package sorapid;
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.io.ExcelExampleSource;
import com.rapidminer.tools.XMLException;
import java.io.File;
import java.io.IOException;
public class SOrapid {
public static void main(String[] args) {
try {
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
RapidMiner.init();
Process process = new Process(new File("c:\\Users\\Matlab\\.RapidMiner5\\repositories\\Local Repository\\processes\\test.rmp"));
Operator op = process.getOperator("Read Excel");
op.setParameter(ExcelExampleSource.PARAMETER_EXCEL_FILE, "d:\\excel.xls");
process.run();
} catch (IOException | XMLException | OperatorException ex) {
ex.printStackTrace();
}
}
}