🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"Running an xml process file with the API"

User: "emolano"
New Altair Community Member
Updated by Jocelyn
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.

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "steffen"
    New Altair Community Member
    Hello emolano

    I assume you have read chapter 7 of the tutorial.pdf.

    The requested can be perform like this:

    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);
    hope this was helpful

    regards,

    Steffen
    User: "emolano"
    New Altair Community Member
    OP
    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);
           
      }
    }