Options

IOContainer

sergiu781sergiu781 Member Posts: 3 Contributor I
edited November 2018 in Help
Hello, I have a process file (*.rmp) with two steps: 1. read from a database table read_database, 2: the operator data_to_similarity; all the process works fine, but i do not know how to read the results. The process file is run in java
[tt]
        File file = new File(sFile);
        RapidMiner.init();
        com.rapidminer.Process proc = RapidMiner.readProcessFile(file);
        IOContainer io = proc.run(new IOContainer());
        ExampleSet es = io.get(ExampleSet.class);
        Attributes at = es.getExample(0).getAttributes();
        Iterator <Attribute> ia = at.iterator();
        while (ia.hasNext()){
            System.out.println(ia.next().getName());
        }
        [/tt]
and when i run the code above i receive a error message
[tt]com.rapidminer.operator.MissingIOObjectException: The operator needs some input of type com.rapidminer.example.ExampleSet which is not provided.
        at com.rapidminer.operator.IOContainer.getInput(IOContainer.java:192)
        at com.rapidminer.operator.IOContainer.get(IOContainer.java:136)
        at Controllers.user.ProcessList.cProcessList.doGetRunProcess(cProcessList.java:239)
        at Controllers.user.ProcessList.cProcessList.doGet(cProcessList.java:127)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[/tt]
the problem is that i do not know what type of result, the process will return, because the java program can receive from the user a various of  rmp file.
Please help!!

Answers

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    if you don't know if an example set is delivered I would suggest surrounding the code with a try catch block to catch the MIssingIOObjectException and discard it if thrown? Wouldn't this already solve the issue?

    Greetings,
      Sebastian
  • Options
    sergiu781sergiu781 Member Posts: 3 Contributor I
    hello, thank you for replay. I think I was not very clear about my problem.

    I want to parse any type of response.

    The problem is that I must get the result and write to a table on a mysql server, from any type of operator. On my application, the user gives the RMP file with any type of operator. That means that i must parse the result of all types of operators and then write it on a table.  So i do not know what type is the result set. For example, if I have a process that has a read Database and one of Data to Similarity the result will be a Similarity Measure. In rapid mine,r if i will connect the sim output to a write database i receive a message like Expected ExampleSet but received SimilarityMeasureObject, if i will have a Correlation Matrix and i want the Matrix.matrix or the Matrix.weights to be written in the database i will have the message Expected ExampleSet but received NumericalMatrix or Expected ExampleSet but received AttributeWeights. So in java i must know what I have to read as a result and if the process file is constructed by the user I do not have that information. 
    So in fact i need a method to parse the results of any type of operators. Like give a IOContainer or a IOobject and in response to return a structure of the table view (like that in guid of rapidminer) and that structure i will parsed and write to a table.

    Other solution is that to have a operator which read any type of result and write it to a table on a sql server.
    Thank you very much;
  • Options
    haddockhaddock Member Posts: 849 Maven
    Hi there Sergiu,

    Many thanks for such a thought provoking post; if you look through this forum there is a consistent flow of requests to convert one class of RM object to another, whether it is association rules to examples, or performances to examples, and the drift towards meta optimisation is obvious. Wouldn't it be nice to have an "exchanger" operator, which attempts to create the specified output from whatever input?

    From what is in front of me ( an extension  building white paper and, most importantly, Eclipse templates in a package available from the RM website ), that is an Extension, or what is othertimes called a plugin. There is a section about adding preconditions to input ports.... 8)

    Gets you thinkin' ?

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    I think this is a very ambitious target to write whatever comes into a table. Especially because you can't press each object into a single table.
    And since each object is different you will have to write a converter for each class. Sometimes there might be super classes you can use, but not all the time. Sometimes there are already adaptors in RapidMiner for example for showing a table in the gui, but not all the time. So you will have a nice mapping from a class to the corresponding converter. Happy Coding!

    Greetings,
      Sebastian
Sign In or Register to comment.