|
1 | 1 | ruby4knime |
2 | 2 | ========== |
3 | 3 |
|
4 | | -Ruby scripting extension for [Knime](http://knime.org) |
| 4 | +## Intro |
| 5 | +Ruby scripting extension for [KNIME](http://knime.org) |
5 | 6 |
|
6 | 7 | This is preliminary support of Ruby scripting language for Knime. |
7 | 8 |
|
8 | | -Now realized Source (Ruby Generator) and Manipulator (Ruby Script) node types. |
| 9 | +Now realized following node types: |
9 | 10 | * Ruby Generator allows to generate any string or numeric data. Or process any external sources using Ruby. |
10 | | -* Ruby Script allows to process input DataTable into output. |
| 11 | +* Ruby Script allows to process input DataTable into output DataTable. |
| 12 | +* Ruby Script 2x2 allows to process 2 input DataTable into 2 output DataTable. |
| 13 | +* Ruby Snippet allows to process input DataTable into output DataTable by writing code only for one row processing. |
11 | 14 |
|
12 | 15 | See [Ruby wrapper](RubyScript/rb/README.rdoc) |
13 | 16 |
|
14 | 17 | [Download binary](https://drive.google.com/folderview?id=0Bwx0cbtdU5K6TklLRG90cm5HbFk) |
| 18 | + |
| 19 | +## Sample workflow |
| 20 | +[Download sample workflow](samples/KNIME_Ruby_Test.zip) |
| 21 | + |
| 22 | +This is simple workflow for ruby4knime testing only. It includes all realized node types. |
| 23 | + |
| 24 | + |
| 25 | +Now some details. |
| 26 | + |
| 27 | +Node 1 contains the following code: |
| 28 | + 1000.times do |i| |
| 29 | + x = i * 0.1 / Math::PI |
| 30 | + $outContainer << Cells.new.double(x).double(Math.sin(x)).double(Math.sin(x + Math::PI/3)) |
| 31 | + end |
| 32 | + |
| 33 | +Node 2 contains the following code: |
| 34 | + $outContainer.rowKey = 100000 # generate table keys from this number |
| 35 | + 1000.times do |i| |
| 36 | + x = i * 0.1 / Math::PI |
| 37 | + $outContainer << Cells.new.double(x).double(Math.cos(x)).double(Math.cos(0.3*x)) |
| 38 | + end |
| 39 | + |
| 40 | +Node 3 contains the following code: |
| 41 | + $inData0.each do |row| |
| 42 | + $outContainer << (row << Cells.new.double(row[1].to_f-row[2].to_f)) |
| 43 | + end |
| 44 | + |
| 45 | + |
| 46 | +Node 4 contains the following code: |
| 47 | + $inData0.each do |row| |
| 48 | + $outContainer0 << row |
| 49 | + end |
| 50 | + $inData1.each do |row| |
| 51 | + $outContainer1 << row |
| 52 | + end |
| 53 | + |
| 54 | +Node 6 contains the following code: |
| 55 | + Cells.new. |
| 56 | + double(row[1].to_f). |
| 57 | + double(row[2].to_f - row[4].to_f) |
| 58 | + |
| 59 | + |
| 60 | +Joiner (Node 5) generates following data: |
| 61 | + |
| 62 | + |
| 63 | +We can control results by line plots. |
| 64 | + |
| 65 | +Fragment of Line Plot (Node 10) |
| 66 | + |
| 67 | + |
| 68 | +Fragment of Line Plot (Node 11) |
| 69 | + |
| 70 | + |
| 71 | +Fragment of Line Plot (Node 12) |
| 72 | + |
| 73 | + |
| 74 | +Fragment of Line Plot (Node 13) |
| 75 | + |
| 76 | + |
| 77 | +You can combine these Ruby nodes in any combination with other KNIME nodes. |
0 commit comments