RapidMiner

Learner II Widad_ES_SOUFI
Learner II

How can I call an operator from the rapidprom extension

Dear all,

 

I use the rapidprom extension of the rapidminer software to discover and analyze my logs. Now, I am trying to automate the process in which I import an xes log using the ImportLogOperator, and then create the corresponding petri net model using the InductiveVisualMinerOperator. In the main class of my program, I create an ImportXLogOperator instance:

"ImportXLogOperator importXesFile = new ImportXLogOperator(OperatorDescription description);"

The OperatorDescription class needs these attributes: (final String fullyQualifiedGroupKey, final String key, final Class<? extends Operator> clazz, final ClassLoader classLoader, final String iconName, final Plugin provider).

its my understanding that the attribute: "final Class<? extends Operator> clazz = mportXLogOperator.class.getClasses()" and "final ClassLoader classLoader=ImportXLogOperator.class.getClassLoader()".

Do you have any idea how to find the other attributes?

 

Thank you,

Kind regards.

1 REPLY
Highlighted
RM Staff
RM Staff

Re: How can I call an operator from the rapidprom extension

Hi,

 

have you considered using the OperatorService (com.rapidminer.tools) to dynamically create Operators?

 

// create a new delay operator
// you can find the class of an operator in the process xml
Operator dynamicDelay = OperatorService.createOperator("delay");
// change the default value of the delay amount to 5s
dynamicDelay.setParameter("delay_amount", "5000")
// finally execute the operator
dynamicDelay.doWork();

You can also do it within Execute Script:

<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000-SNAPSHOT">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="7.4.000-SNAPSHOT" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="execute_script" compatibility="7.4.000-SNAPSHOT" expanded="true" height="68" name="Execute Script" width="90" x="313" y="136">
        <parameter key="script" value="import com.rapidminer.tools.OperatorService;&#10;&#10;// create a new delay operator&#10;// you can find the class of an operator in the process xml&#10;Operator dynamicDelay = OperatorService.createOperator(&quot;delay&quot;);&#10;// change the default value of the delay amount to 5s&#10;dynamicDelay.setParameter(&quot;delay_amount&quot;, &quot;5000&quot;)&#10;// finally execute the operator&#10;dynamicDelay.doWork();"/>
      </operator>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
    </process>
  </operator>
</process>

 

Cheers,

Marcel

Polls
How can RapidMiner increase participation in our new competitions?
Twitter Feed