"Select Attributes" operator parameters modifications

AurelienAurelien Member Posts: 2 Contributor I
Dear All,

I want to modify the value of a parameter from my Java code. It seems I am missing something obvious because the modification is not applied.
In my case I want to modify the value of the "Attributes" parameter of the "Select Attributes" operator.

What is the good way for modifying the value of a parameter?

Thanks in advance for your help,


import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import com.rapidminer.RapidMiner;
import com.rapidminer.example.Attribute;
import com.rapidminer.example.Attributes;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleReader;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorCreationException;
import com.rapidminer.operator.Value;
import com.rapidminer.operator.ValueDouble;
import com.rapidminer.operator.learner.igss.Result;
import com.rapidminer.tools.OperatorService;
import com.rapidminer.tools.XMLException;
import com.rapidminer.Process;

public class DescriptorModification {

// Change the subset of attributes for an existing process
public DescriptorModification(){
Process rmProcess;


try {
// Load an existing process
// The process contains a "Select Attributes" operator wichich select the subset "Att1|Att2"
rmProcess = new Process( new File( "MyProcess.rmp") );

// Change the subset of Attributes
Operator selectAttributesOperator = rmProcess.getOperator( "Select Attributes" );
selectAttributesOperator.setParameter("Attributes", "Att1|Att2|Att3|Att4");

// Check if the "Select Attributes" operator parameters were changed
// Yes, the display is: "Att1|Att2|Att3|Att4"
selectAttributesOperator= rmProcess.getOperator( "Select Attributes" );
System.out.println( selectAttributesOperator.getParameter("Attributes") );

// Check if the XML corresponding to the process is changed
// No, it is still the former attributes: "Att1|Att2"
System.out.print( rmProcess );

} catch (Exception e) {


public static void main(String[] args) {

DescriptorModification garm = new DescriptorModification();




  • Options
    AurelienAurelien Member Posts: 2 Contributor I
    Ok it was a stupid question, the good way to modify a parameter for an operator is:
    rmProcess.getOperator( "Select Attributes" ).setParameter("attributes", "Att1|Att2|Att3|Att4");
    I simply used "Attributes" instead of "attributes"...
  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    let me add, that it's the recommended way of using the parameter name constants that every operator declares. These public and static constants are mostly called <class of operator>.PARAMETER_<PARAMETER_NAME> . If we change the names, we will change this constants and your code will still work.

Sign In or Register to comment.