DataColumnDomain has lower- and upper Bounds but no values

Hi,

i've started to implement a new Node, wich should basically do the same like the CAIMDiscretizationNode but on multiple Classhierachies. So i first started to extend this Node but I think it is the wrong way because the Implementation didn't expected any Extension and so the interesting Methods are private.

Now, i want to start from Scratch but I have following Problem:

In my NodeModel in the execute-Method i've got follwoing:

 protected BufferedDataTable[] execute(final BufferedDataTable[] inData,
            final ExecutionContext exec) throws Exception {

        long startTime = System.currentTimeMillis();
        exec.setProgress(0.0, "Preparing...");
       
        DataTableSpec data = inData[DATA_INPORT].getDataTableSpec();
        try {
        System.out.println("test"+m_includedColumnName.getIncludeList().size());
        /*Step 1: iterate over all F_i*/
        for(String colName : m_includedColumnName.getIncludeList()) {
            /*Step 1.1 find minimum and maximum*/
            DataColumnDomain colDomain =
                data.getColumnSpec(colName).getDomain();
       
           
            if (colDomain == null || colDomain.getValues() == null) {
                String message = colName+"(="+colDomain+") or Values of "+colName+"(="+colDomain.getValues()+") does not exist\n bool:"+colDomain.hasValues();             
                throw new RuntimeException(message);
            }

(...)

 

in the DataColumnDomain (colDomain), are lower and upper Bounds but no values in there. But how can that be, because the lower and upper Bounds have to be found as well out of the whole DataSet?!?!

More diffusing is the Fact, that in the original Kaim-implementation this thing works like (in createClassFromToIndexMaps):

Set<DataCell> classValues =
                tableSpec.getColumnSpec(m_classColumnName.getStringValue())
                        .getDomain().getValues();

and there is no test if there are Values in the DataColumnDomain even in the configure-method.

So what am I doing wrong?

 

Thank you


 

Ok I found the difference. It has to be a String-Value to get Values out of the DataColumnDomain. This is kind of stupid for me because now I have to implement it on my own and i think this is an example of either bad documentation or inconsistent implementation. Both is very bad to extend the Knime framework.
I am the best example because I have spend now half a day to find the Problem.

 

best regards

Well, the Javadoc of DataColumnDomain.getValues() says:

"Returns all possible values in this column. Note, that this set can be
null if this information is not available (for continuous double values, for example)..."

This is exactly what happened in your case. Also, domain values are not computed automatically in each case, e.g. if there are too many (the default cut-off is 60).

Ok sorry my fault. I didn't read this part with the continuous double values, i think i read mainly only the class Description. But the other Note with the cutoff stands only in the class Description. So at least its needed to read both (and remember)...