"XML process location"

nav
nav New Altair Community Member
edited November 5 in Community Q&A
Hello to all,
I am integrating a rapidminer process in my own java program. It is pretty symbol I load and run the process from the java code (to be fast, without assembly the process in Java) and then I use the rapidminer API to access to the output of the process and to do some further computation on it with Java. Since I need to all these stuff for a great number of data file I decide to manage the XML file of the process (with the JAVA standard API) modifying the value of the data retrieve operator with the correct data file at each iteration. I would like to know if it it possible to get the process XML file path from the Process (that I load from the repositor) object or something that could be done with the Java API without have to gather it direct manually. Thanks to all also if you have advice for what I need to do.
Tagged:

Answers

  • Skirzynski
    Skirzynski New Altair Community Member
    Hey,

    you can use a macro in your process where you specify the file you want to access in the current run. You can use this macro in the reading operator like "/home/nav/%{filename}" where 'filename' ist the name of the macro. This macro you can set in the context of the process before the run. Example:

    for( String file : new String[] {"file1.csv", "file2.csv"}) {
    process.getContext().addMacro(new Pair<String, String>("filename", file));
    process.run();
    }
    Another approach would be to run everthing in a single process. You can use the 'Loop parameter'-operator where you iterate over a set of filenames which will be used by the inner "data retrieve"-operator.

    Best regards
      Marcin
  • nav
    nav New Altair Community Member
    Thank you very much. Your first solution is exactly what I needed.