"[SOLVED] Read Database operator(handler) in Java"
Quick
New Altair Community Member
Hello,
I'm trying to write Java program using RapidMiner API. In my program, operaters
are created, arranged, and connected as follows:
Here, I want to use "Read Database" operator(handler) to read datasets from
database. I found DatabaseHandler class in com.rapidminer.tools.jdbc and guess
that it defines "Generate Data". But it is not operator but handler so
OperatorService can't create it.
Does anyone know how to create (and configure) "Read Database" operator?
Any help would be appreciated.
Regards,
I'm trying to write Java program using RapidMiner API. In my program, operaters
are created, arranged, and connected as follows:
As you know, The "Generate Data" operator is defined by ExampleSetGenerator class.
Operator generateData = OperatorService.createOperator(ExampleSetGenerator.class);
process.getRootOperator().getSubprocess(0).addOperator(generateData);
generateData.getOutputPorts().getPortByName("output").connectTo(process.getRootOperator().getInputPorts().getPortByName("result 1"));
Here, I want to use "Read Database" operator(handler) to read datasets from
database. I found DatabaseHandler class in com.rapidminer.tools.jdbc and guess
that it defines "Generate Data". But it is not operator but handler so
OperatorService can't create it.
Does anyone know how to create (and configure) "Read Database" operator?
Any help would be appreciated.
Regards,
0
Answers
-
Hi,
I'll start with what I usually say:
1) Please be aware that if you're using RM api that your program has to be licensed under the AGPL.
2) Do you really need to create the process(es) manually? Usually it is a more efficient (and much less error prone) way to create the process(es) beforehand via the RM gui and then just use them (see here.
3) If that is not an option, I'd recommend you have a look at the "OperatorsCore.xml" file which contains the links between operators and their classes.
Regards,
Marco0 -
Thank you, Marco.
I checked URLs you posted and followed these posts. Now my program works.
The only one point I stacked is that the repository path for the argument of RepositoryLocation() is not
absolute path of process file but the location in RapidMiner.
(wrong): RepositoryLocation loc = new RepositoryLocation("C:\Users\Quick\Documents\RapidMiner\test.xml")
(correct): RepositoryLocation loc = new RepositoryLocation("//NewLocalRepository/test")
Thank you again!
0 -
@Quick as per your last post about location of process you said "repository path for the argument of RepositoryLocation() is not
absolute path of process file but the location in RapidMiner." can you eloborate where in rapidMiner because i tried copying my repository and my process to various directory in rapidMiner folder but nothing worked.0