Creating geometry data type in KNIME

To create the geometric data type, I create the GeometryValue and GeometryCell class which implements GeometryValue, when I run the node it does not show me the output table, the only thing that comes out is “loading by content”, besides a notification in the console that shows me this: "ERROR ModalContext DataTypeRegistry CODING PROBLEM Data cell implementation ‘utils.GeometryCell’ is not registered at extension point ‘org.knime.core.DataType’ via it’s serializer, using buddy classloading as fallback. Please change your implementation and use the extension point ". Could someone help me with that?,
Regards,
Laura

Hi Laura,

when creating new custom DataCells, you need to register the implementation at the KNIME DataType extension point. This can be done in the 'plugin.xml' file of the plugin you created. In eclipse, open the 'plugin.xml' >> Extensions (tab at the bottom) >> Add >> type in 'DataType' into the filter box and select 'org.knime.core.DataType' and hit 'Finish'. The left view (All Extensions) should now show a tree view with an element 'org.knime.DataType'. This should already contain a child (if not, right-click on the item >> new >> DataType). If you select the new DataType, the 'Extension Element Details' show up on the right. Here you need to point to your data cell and data cell factory implementations. For the 'cellClass' your implementation must extend 'org.knime.core.data.DataCell' and the factory must implement 'org.knime.core.data.DataCellParser'. For some details you can right-click on element 'org.knime.DataType' and select 'Show Description'. For an example implementation you could look at some implementations of 'org.knime.core.data.DataCell' here.

I hope that helps.

Cheers

David

Hello David

Thank you for your answer, it helped me a lot, and I fixed the problem that I was giving. I thought that this problem was causing me, that when I execute the node it execute perfectly, but I keep it and close it, and when I return it to open, the column that supposedly had data, now it's empty, what can this be ?, could you help me again ?. Thanks,

Regards,

Laura

Hi Laura,

you are probably missing the Cell Serializer. E.g. have a look at this class for an example. Basically, you need to add an inner class implementing 'DataCellSerializer<MyCell>' to the cell class.

Ceers

David

Hi, David,

I implemented DataCellSerializer<MyCell> like this:

public static final DataCellSerializer<GeometryCell> getCellSerializer() {
        return new GeometrySerializer();
    }

This is my part of the Serialize code, please see the comments

public static final class GeometrySerializer implements DataCellSerializer <GeometryCell>
{
@Override
public void serialize (GeometryCell cell, DataCellDataOutput output) throws IOException {
output.writeDataCell (cell); // If I put .writeDataCell in the workflow, I can not save it
}
@Override
public GeometryCell deserialize (DataCellDataInput input) throws IOException {
return null; // Here I do not know how to deserialize my geometry with the input parameter that I have to use
}

}

The node works, but if I save and close and reload the workflow, only the column that I think is the only one that comes out without data, all the others have the data.

I read "Save and Load Your Internal Representation" but what they explain I copy it, and there are many variables that I do not know where they came from

Can you help me again??,

Cheers,

Laura

Hi Laura,

it depends on what data your GeometryCell consists off. Have a look at the methods of the DataCellDataOutput of ' serialize (GeometryCell cell, DataCellDataOutput output) throws IOException'. There you can write primitive data types like double or a byte array. In the 'public GeometryCell deserialize (DataCellDataInput input) throws IOException' method you can read the data again in the same order using e.g. the methods 'input.readDouble()' of DataCellDataInput. With this data you can then create a new GeometryCell and return that.

Cheers

David

Hello David,

thank you very much for your help, the node works fine.

Cheers,

Laura

Hi David,
I have a little doubt, when I put GeometryCell.TYPE instead of going out Geometry puts me GeometryCell again.
You could tell me how I can change this so that I get it right, because because of this when I create another node and I want it to filter me for that kind of data, it does not.
Regards,
Laura

Hi Laura,

I’m sorry but I did not quite understand what the problem is about. Could you maybe provide me with more detail?

Cheers
David

Hi David
My problem is that I created a new Geometry data type (GeometryCell and GeometryValue), but when I’m going to request the data type from GeometryCell, I should get Geometry (just like when you say StringCell.Type, it returns String) and me GeometryCell is output as the data type that contains the GeometryCell cell, instead of Geometry.
Cheers,
Laura

Have a look at how this implemented in the StringCell:


this should give you an idea how to adapt your own code.

2 Likes

Hello gab1one ,
Thank you for your response, that’s how I had it in the code, I looked for the StringCell that I had said and I saw other things that I lacked, thank you.
Laura

1 Like