Knime

From Pigbert Wiki

Code can be found under C:\cygwin\home\yz\knime\workspace\KnimeBasic\src\org\knime\base

  • Source
  • Sink
  • Learner
  • Predictor
  • Manipulator
  • Visualizer
  • Meta
  • Other
Table of contents

Links

  • Eclipse Plugin dependencies (http://www.ibm.com/developerworks/opensource/library/os-eclplgndep/)
  • eclipse/knime running order : command line arguments overwrites eclipse.ini, but batch mode does look at both

Command Line

  • -nosave => do not save the workflow after execution has finished
  • -reset => reset workflow prior to execution
  • -masterkey[=...] => prompt for master password (used in e.g. database nodes), if provided with argument, use argument instead of prompting
  • -workflowFile=... => ZIP file with a ready-to-execute workflow in the root of the ZIP
  • -workflowDir=... => directory with a ready-to-execute workflow
  • -destFile=... => ZIP file where the executed workflow should be written to if omitted the workflow is only saved in place
  • -option=nodeID,name,value,type => set the option with name name of the node with ID nodeID to the given value, which has type type. type can be any of the primitive Java types, String or any of StringCell, DoubleCell, or IntCell. If name addresses a nested element (for instance rowFilter -> ColValRowFilterUpperBound), the entire path must be given, separated by "/". If the node is part of a meta node, provide also the node ids of the parent node(s). e.g. 90/56.


Some KNIME settings can also be adjusted by Java properties; they need to be provided as last option in the command line: -vmargs -Dorg.knime.core.maxThread=n sets the maximum number of threads used by KNIME

Log4j

  • A short introduction (http://logging.apache.org/log4j/1.2/manual.html)
  • Log4j Xml Format (http://wiki.apache.org/logging-log4j/Log4jXmlFormat)
  • Log4j API (http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/ConsoleAppender.html)
  • Pattern Layout (http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html)
  • Log By Level (http://wiki.apache.org/logging-log4j/_LogByLevel_)
  • FAQ1 (http://logging.apache.org/log4j/1.2/faq.html#2.3) [Wiki FAQ]
Threshold
  • all (-2147483648)
  • debug (10000)
  • info (20000)
  • warn (30000)
  • error (40000)
  • fatal (50000)
  • off (2147483647)
  • null ()
In Java Console
----------------
logger.warn
logger.coding
logger.error
logger.info
logger.debug    (System.out)


=================================================
In Knime Console
-----------------
logger.warn     (System.out)
logger.coding   (System.err)
logger.error    (System.err)


// controlled by C:\cygwin\home\yz\knime\workspace\.metadata\knime <-- to be changed
// controlled by C:\cygwin\home\yz\knime\runtime_configuration\.metadata\knime
=================================================
Debugging
  • setWarningMessage(String)
 hline-music11.gif

Wizard

Node Creation Wizard

In KNIME perspective:

File => New => Other => Konstanz Information Miner => Create a new KNIME Node-Extension
Java build path correction
Project => Clean => Clean projects slected below
Node Testing
Run => Run ... => Eclipse Application => New configuration
Deployment

This is done with "File" -> Export..." -> Choose "Deployable plug-ins and fragments" -> select your project which contains the node(s) you want to export -> Choose an export destination (knime/plugins), in the options tab select whether you want to include the source code or not -> "Finish".

 hline-music11.gif

Eclipse plugin files

Knime's connection with Eclipse workbench:

  1. the editor
  2. preferences page
  3. perspective-extension points
plugin.xml
specifies the new extension points
category extension: To introduce new category folders displayed in the node repository: Extensions => add... => org.knime.workbench.repository.categories
node extension: To add a new functional node to the node repository: Extensions => add... => org.knime.workbench.repository.nodes
META-INF/MANIFEST.MF
Register the Bundle Activator through MyNodePlugin: Overview => Activator => pigbert.knime.rsknn.RSKnnNodePlugin
class path information
required plugins information: Dependencies => Required Plug-ins
vendor and version information
which java packages should be made visible outside
build.properties
configures the way a plugin is exported(deployed)
defines the name of the jar file in which the classes of the plugin should be stored as well as the files to be included in deployment: Runtime => Exported Packages
enables you to define two build settings
includes source code Build => Source Build
no source code Build => Binary Build
MyNodePlugin.java
required by eclipse "Bundle Activator". It has nothing to do with the functionality of the node.
specified/connected through META-INF/MANIFEST.MF => Overview => Activator => pigbert.knime.rsknn.RSKnnNodePlugin
 hline-music11.gif

Functional Node Class Structure


NodeView

how to display the result of the node.

NodeFactory
NodePlugin
 hline-music11.gif

Example Code

Inner Class (Single) Cell Factory
        ColumnRearranger result = new ColumnRearranger(metaIn);
        DataColumnSpecCreator creator = new DataColumnSpecCreator(predictionColumnName, DoubleCell.TYPE);
        SingleCellFactory predictionCellFactory = new SingleCellFactory(creator.createSpec()) {
            @Override
            public DataCell getCell(final DataRow row) {
                DataCell cell = predictionResults.get(row.getKey());
                return (cell == null ? DataType.getMissingCell() : cell);
            }
        };
        result.append(predictionCellFactory);

Data Representation in Knime (http://www.knime.org/docs/api/org/knime/core/data/doc-files/newtypes.html)

Personal tools