Options

How to use "Set Role" and other Operators from a Java Application?

Marc_OsterbergMarc_Osterberg Member Posts: 1 Newbie
Hello, I've integrated RapidMiner Studio Core into a Java Application as a dependency to run RapidMiner Processes previously exported from RapidMiner Studio. But everytime I try to run a process containing f.e. the Set Role Operator, I get the attached Error.



Apparently the "Set Role" Operator is part of the blending extension and not part of RM Studio Core. Is it possible to execute Processes in Java containing such Operators from internal extensions given the appropriate License? Are there any methods I need to use to initialize a License or (internal-) extensions?
The process I'm trying to execute looks like this:
<?xml version="1.0" encoding="UTF-8"?><process version="10.2.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="10.2.000" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="blending:set_role" compatibility="10.2.000" expanded="true" height="82" name="Set Role" width="90" x="380" y="34">
        <list key="set_roles">
          <parameter key="Correct" value="label"/>
          <parameter key="ID" value="id"/>
        </list>
      </operator>
      <connect from_port="input 1" to_op="Set Role" to_port="example set input"/>
      <connect from_op="Set Role" from_port="example set output" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="source_input 2" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

And the RapidMiner part of the Java Application looks like this:


<span>RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.EMBEDDED_WITHOUT_UI);<br></span><span>RapidMiner.init();<br></span><span>File procFile = null;<br></span><span>try{<br></span><span>    procFile = new File("C:\\Projects\\TestProject\\src\\main\\resources\\Set Roles.rmp");<br></span><span>}<br></span><span>catch(NullPointerException e) {<br></span><span>    //<br></span><span>}<br></span><br><span>Process process = null;<br></span><span>try {<br></span><span>    process = new Process(procFile, Process.NO_ENCRYPTION, null);<br></span><span>}<br></span><span>catch (IOException | XMLException e){<br></span><span>    //<br></span><span>}<br></span><br><span>//inputObject is an IOObject and generated elsewhere<br></span><span>IOContainer inputContainer = new IOContainer ( new IOObject[] {inputObject});<br></span><br><span>IOContainer outputContainer = null;<br></span><span>try{<br></span><span>    outputContainer = process.run(inputContainer);<br></span><span>}<br></span><span>catch (OperatorException e) {<br></span><span>    //<br></span><span>}</span>



Thank you for your help!

Sign In or Register to comment.