Search in sources :

Example 61 with PortObject

use of org.knime.core.node.port.PortObject in project knime-core by knime.

the class GlobalTimerinfoNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
    BufferedDataTable result0 = NodeTimer.GLOBAL_TIMER.getGlobalStatsTable(exec);
    BufferedDataContainer result1 = exec.createDataContainer(createSpecOut1());
    int rowcount = 0;
    for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) {
        for (IBundleGroup feature : provider.getBundleGroups()) {
            DataRow row = new DefaultRow(new RowKey("Row " + rowcount++), new StringCell(feature.getIdentifier()), new StringCell(feature.getVersion()));
            result1.addRowToTable(row);
        }
    }
    result1.close();
    return new PortObject[] { result0, result1.getTable() };
}
Also used : IBundleGroup(org.eclipse.core.runtime.IBundleGroup) IBundleGroupProvider(org.eclipse.core.runtime.IBundleGroupProvider) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) RowKey(org.knime.core.data.RowKey) StringCell(org.knime.core.data.def.StringCell) BufferedDataTable(org.knime.core.node.BufferedDataTable) DefaultRow(org.knime.core.data.def.DefaultRow) DataRow(org.knime.core.data.DataRow) PortObject(org.knime.core.node.port.PortObject)

Example 62 with PortObject

use of org.knime.core.node.port.PortObject in project knime-core by knime.

the class Normalizer3NodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    CalculationResult result = calculate(inObjects, exec);
    NormalizerPortObject p = new NormalizerPortObject(result.getSpec(), result.getConfig());
    return new PortObject[] { result.getDataTable(), p };
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 63 with PortObject

use of org.knime.core.node.port.PortObject in project knime-core by knime.

the class One2ManyCol2PMMLNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    BufferedDataTable inData = (BufferedDataTable) inObjects[0];
    DataTableSpec dts = inData.getDataTableSpec();
    checkColumnsSpecs(dts);
    String[] includes = m_includedColumns.applyTo(dts).getIncludes();
    One2ManyCellFactory cellFactory = new One2ManyCellFactory(dts, Arrays.asList(includes), m_appendOrgColName);
    BufferedDataTable outData = exec.createColumnRearrangeTable(inData, createRearranger(dts, cellFactory), exec);
    if (m_pmmlOutEnabled) {
        // the optional PMML in port (can be null)
        PMMLPortObject inPMMLPort = m_pmmlInEnabled ? (PMMLPortObject) inObjects[1] : null;
        PMMLOne2ManyTranslator trans = new PMMLOne2ManyTranslator(cellFactory.getColumnMapping(), new DerivedFieldMapper(inPMMLPort));
        PMMLPortObjectSpecCreator creator = new PMMLPortObjectSpecCreator(inPMMLPort, outData.getDataTableSpec());
        PMMLPortObject outPMMLPort = new PMMLPortObject(creator.createSpec(), inPMMLPort);
        outPMMLPort.addGlobalTransformations(trans.exportToTransDict());
        return new PortObject[] { outData, outPMMLPort };
    } else {
        return new PortObject[] { outData };
    }
}
Also used : DerivedFieldMapper(org.knime.core.node.port.pmml.preproc.DerivedFieldMapper) DataTableSpec(org.knime.core.data.DataTableSpec) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) BufferedDataTable(org.knime.core.node.BufferedDataTable) One2ManyCellFactory(org.knime.base.node.preproc.columntrans2.One2ManyCellFactory) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) PortObject(org.knime.core.node.port.PortObject) PMMLPortObjectSpecCreator(org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator)

Example 64 with PortObject

use of org.knime.core.node.port.PortObject in project knime-core by knime.

the class BinnerNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inPorts, final ExecutionContext exec) throws Exception {
    BufferedDataTable inData = (BufferedDataTable) inPorts[DATA_INPORT];
    DataTableSpec spec = inData.getDataTableSpec();
    ColumnRearranger colReg = createColumnRearranger(spec);
    BufferedDataTable buf = exec.createColumnRearrangeTable(inData, colReg, exec);
    if (!m_pmmlOutEnabled) {
        return new PortObject[] { buf };
    }
    // handle the optional PMML in port (can be null)
    PMMLPortObject inPMMLPort = m_pmmlInEnabled ? (PMMLPortObject) inPorts[1] : null;
    PMMLPortObject outPMMLPort = createPMMLModel(inPMMLPort, spec, buf.getDataTableSpec());
    return new PortObject[] { buf, outPMMLPort };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) ColumnRearranger(org.knime.core.data.container.ColumnRearranger) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) BufferedDataTable(org.knime.core.node.BufferedDataTable) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 65 with PortObject

use of org.knime.core.node.port.PortObject in project knime-core by knime.

the class FilterApplyNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    exec.setProgress(0);
    PortObject portObject = inObjects[1];
    DataTableSpec filterSpec = portObject == null ? ((BufferedDataTable) inObjects[0]).getDataTableSpec() : ((FilterDefinitionHandlerPortObject) portObject).getSpec();
    final BufferedDataTableRowOutput out = new BufferedDataTableRowOutput(exec.createDataContainer(((BufferedDataTable) inObjects[0]).getDataTableSpec()));
    execute(new DataTableRowInput((BufferedDataTable) inObjects[0]), out, filterSpec, exec, ((BufferedDataTable) inObjects[0]).size());
    return new BufferedDataTable[] { out.getDataTable() };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) BufferedDataTable(org.knime.core.node.BufferedDataTable) DataTableRowInput(org.knime.core.node.streamable.DataTableRowInput) FilterDefinitionHandlerPortObject(org.knime.core.node.port.viewproperty.FilterDefinitionHandlerPortObject) PortObject(org.knime.core.node.port.PortObject) BufferedDataTableRowOutput(org.knime.core.node.streamable.BufferedDataTableRowOutput)

Aggregations

PortObject (org.knime.core.node.port.PortObject)173 BufferedDataTable (org.knime.core.node.BufferedDataTable)97 DataTableSpec (org.knime.core.data.DataTableSpec)68 PMMLPortObject (org.knime.core.node.port.pmml.PMMLPortObject)59 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)39 InactiveBranchPortObject (org.knime.core.node.port.inactive.InactiveBranchPortObject)37 FlowVariablePortObject (org.knime.core.node.port.flowvariable.FlowVariablePortObject)35 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)34 IOException (java.io.IOException)33 DataRow (org.knime.core.data.DataRow)25 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)24 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)23 DataCell (org.knime.core.data.DataCell)20 FileStorePortObject (org.knime.core.data.filestore.FileStorePortObject)19 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)19 DatabasePortObject (org.knime.core.node.port.database.DatabasePortObject)18 PortObjectSpec (org.knime.core.node.port.PortObjectSpec)16 ExecutionContext (org.knime.core.node.ExecutionContext)15 DataColumnSpec (org.knime.core.data.DataColumnSpec)14 InactiveBranchPortObjectSpec (org.knime.core.node.port.inactive.InactiveBranchPortObjectSpec)13