"[SOLVED] Read Database operator(handler) in Java"

QuickQuick Member Posts: 2 Contributor I
edited June 2019 in Help
Hello,

I'm trying to write Java program using RapidMiner API.  In my program, operaters
are created, arranged, and connected as follows:

Operator generateData = OperatorService.createOperator(ExampleSetGenerator.class);
process.getRootOperator().getSubprocess(0).addOperator(generateData);
generateData.getOutputPorts().getPortByName("output").connectTo(process.getRootOperator().getInputPorts().getPortByName("result 1"));
As you know, The "Generate Data" operator is defined by ExampleSetGenerator class.

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,
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    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,
    Marco
  • QuickQuick Member Posts: 2 Contributor I
    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!
  • arunpushkararunpushkar Member Posts: 8 Contributor II
    @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.
Sign In or Register to comment.