The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Accessing a process definition and metadata

BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
Recently I got an interesting request: provide a configuration setting (which is defined in a process context macro) as a web service.
I expected this to work with built-in RapidMiner operators, but neither Loop Repository nor Retrieve nor Open File will open a process from the repository. 
However, with a simple Groovy script (in the built-in Execute Script operator) it's easy to get the process definition as XML, and then process it further with RapidMiner operators.
import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.RepositoryProcessLocation;
 
//Current repository path
parentLoc = operator.getProcess().getRepositoryLocation().parent();
//Other repository entry, relative to the current path
loc = new RepositoryLocation(parentLoc, "Example process");
//Process to read as XML
processCode = new RepositoryProcessLocation(loc).getRawXML();
 
//Add a macro with the process XML
operator.getProcess().getMacroHandler().addMacro("processXML", processCode);
The result is a macro that contains the specified process formatted as XML. You can then use RapidMiner operators to process the data further and extract the things you want. 
You can find more details and a downloadable example process in my blog on datascientist.at.
Sign In or Register to comment.