EDOBE XDOM PMML Uživatelský manuál

Procházejte online nebo si stáhněte Uživatelský manuál pro Vývojový software EDOBE XDOM PMML. TIBCO Spotfire Miner 8.1 Java/C++ Extensibility Uživatelská příručka

  • Stažení
  • Přidat do mých příruček
  • Tisk

Shrnutí obsahu

Strany 1

TIBCO Spotfire Miner™ 8.2Java/C++ ExtensibilityNovember 2010TIBCO Software Inc.

Strany 2 - IMPORTANT INFORMATION

10• x-position (if in a worksheet)• y-position (if in a worksheet)• Property values set in the node property dialog

Strany 3 - Technical

11For example, the XML for the Correlations node in the Explorer pane is:<ActivityNode engineClass= "com.insightful.miner.CorrelationsEn

Strany 4 - JAVA/C++ EXTENSIBILITY

12If your new components are implemented entirely using S-PLUS script nodes, and you have no special property dialogs or viewers then the jar file is

Strany 5

13extension.xml FilesIf the file extension.xml exists within an extension subdirectory, it must be an XML file that describes exactly which files comp

Strany 6 - OVERVIEW

14• libraryFile: Value is one or more C++ library files that is loaded when the extension is processed.•imageDirectory: Value is one or more directori

Strany 7 - EXTENSION FILES

15DEVELOPMENT TOOLSYou will need Java and possibly C++ compilers to create new nodes.Java Compiler To compile the Java code, you will need a Java comp

Strany 8 - Extension File

16Optional Tools While the compilers are the only tools strictly required for developing new nodes, we use some additional tools as a standard part of

Strany 9 - Explorer IML

17ARCHITECTURE FEATURESThe architecture for Spotfire Miner has a number of key features that are important for understanding how the application works

Strany 10

18DateDate columns are used to represent dates and times. They are stored as a long representing the number of milliseconds since an origin of Januar

Strany 11

19CreatedA created node has been created and possibly linked to other nodes, but does not have all of its required property values specified. The use

Strany 12 - C++ Library

2IMPORTANT INFORMATIONSOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE T

Strany 13

20INFRASTRUCTURE JAVA CLASSESSome important classes for storing and exchanging information are XTProps for storing property information and XTMetaData

Strany 14

21GRAPHICAL USER INTERFACE CLASSESOverview Spotfire Miner is structured as a client/server application. Each component such as a Read File node has a

Strany 15 - DEVELOPMENT TOOLS

22Constructors The constructor method is typically empty. When the constructor is called, the node properties have not been initialized. Any subclas

Strany 16

23Column Filter GeneratorSome nodes are able to create a Filter Columns node where the columns selected are determined based upon the node’s computati

Strany 17 - ARCHITECTURE FEATURES

24Node Dialog The user has great latitude in how the node’s properties dialog is implemented. In the application each node has its own class extendin

Strany 18

25ENGINE CLASSESOverview For each type of node, there is a class extending EngineNode that is responsible for providing metadata to the activity node

Strany 19

26Output Meta DataThe calculateOutputMetaData() method is called to determine the names and types of the output columns. The pipeline takes care of c

Strany 20 - INFRASTRUCTURE JAVA CLASSES

27An example execute() method is in the section Simple Java Version on page 28.C++ Procs If the computation is to be performed in C++, the CNKProc cla

Strany 21 - Activity Node

28EXAMPLE: COPYING INPUTSThis section presents a simple example of the steps needed to create a new node. We will create a node that simply copies d

Strany 22 - Interfaces

29/** * Very simple implementation of engine node copying each * input to the corresponding output. Assumes the same * number of inputs as outputs.

Strany 23 - Column Filter

3identification purposes only. This software may be available on multiple operating systems. However, not all operating system platforms for a specifi

Strany 24 - HtmlFrame

30 * is executed. */ public void execute(CNKProcJavaTransform proc) { for (int i=0; i<getNumInputs(); i++) { proc.copyData(i, 0, 0, i,

Strany 25 - ENGINE CLASSES

31CompilationNow that we have our Java code, we need to compile it and place it in a jar file. The specific steps for compiling the code and creating

Strany 26 - CNKProc

32<DisplayInfo labelText="First Copy Columns"defaultLabelText="First Copy Columns"smallIcon="default_small.gif"largeI

Strany 27

33Engine Node The engine node corresponding to a C++ proc differs from the version for the straight Java implementation in a variety of ways:• The cla

Strany 28 - EXAMPLE: COPYING INPUTS

34 /** * Passes the input column name/type information as the * output information. */ public XTMetaData calculateOutputMetaData(int outputNum

Strany 29

35 * DLL */ public void createPeerObject() { createCNKObject("cnkcopy", new String[] { "CNKProcCppSecondCopy", "

Strany 30

36#include "CNKProcCppSecondCopy.h"CNK_DEFINE_ACCESSIBLE_CLASS(CNKProcCppSecondCopy)CNKProcCppSecondCopy::CNKProcCppSecondCopy() : CNKPro

Strany 31

37Now that we have the C++ source and header files, we need to compile the code to create the DLL.CompilationThe programming examples directory contai

Strany 32 - Simple C++

38 numOutputs="2" > <DisplayInfo labelText="Second Copy Columns" defaultLabelText="Second Copy Columns"

Strany 33

39public class ThirdCopyNodeModel extends ActivityNodeModel { /** * Boilerplate constructor. */ public ThirdCopyNodeModel() { } /** * Show t

Strany 34

4Important Information 2Overview 6Extension Files 7Default Extension File Names 8Explorer IML Files 9Java Files 11C++ Library Files 12Image Files 12He

Strany 35

40 } catch (Exception e) { e.printStackTrace(); valid = false; } return valid; } /** * Display the cached input metadata as HTM

Strany 36

41The column selection control is a list box of column names with selection indicating which Columns to Copy. Use the standard Windows selection mech

Strany 37 - numInputs="2"

42 private ThirdCopyDialog() { super(); pack(); setMinimumSize(new Dimension(500,500)); } /** * Restore the list of column names and sel

Strany 38 - Extended Java

43 } } /** * Method called by the dialog to save properties in Model */ public void saveProperties() throws NodeDialog.DialogExcept

Strany 39

44 listModel = new DefaultListModel(); listBox = new JList(); listBox.setModel(listModel); listBox.setSelectionMode( ListSe

Strany 40

45 JOptionPane.INFORMATION_MESSAGE); }}Engine Node The engine node implementation displays a variety of functionality:• Return the metadata fo

Strany 41

46 /** * Empty constructor just uses the super method. */ public ThirdCopyEngineNode() { } /** * Boilerplate for specifying this class provi

Strany 42

47 /** * Store the column names to be referred to when * executing. This shows how to store information for * use in multiple chunks. */ pu

Strany 43

48 // Some error checking if (inColNum < 0) { proc.addError("Column '" + colName + "' n

Strany 44

49 m_columnNames = null; }}XML Description The XML description for this node differs from the previous versions in the engine class name, GUI clas

Strany 45

5Special Interfaces 22Node Dialog 24Viewers 24Engine Classes 25Overview 25General Methods 25Constructors 25Initialization 25Output Meta Data 26CNKProc

Strany 46

50THE TIBCO SPOTFIRE PIPELINEOverview The TIBCO Spotfire Pipeline is a C++ system for accessing and manipulating very large data sets. The core of the

Strany 47

51PipelineA Pipeline object contains a set of bufs and procs. When a pipeline is executed, it repeatedly executes the procs, which read data from and

Strany 48

52FactorThe factor data type is much more complicated. A factor column maintains a list of strings, representing the levels of the factor. When a str

Strany 49

53StringString columns are used for informational columns such as names or addresses that do not represent categories and are not used in computations

Strany 50 - THE TIBCO SPOTFIRE PIPELINE

54enough rows available), but the proc writing to that buf cannot write to it (because the buf doesn't have enough free rows for writing to). In

Strany 51

55Cnkmisc LibraryThe cnkmisc library contains the C++ code for the various C++ procs in Spotfire Miner. This includes components such as linear regre

Strany 52

56These classes, and their publicly-accessible methods, will be described below.All of these classes have similarly-named header files (CNKObj.h, CNKB

Strany 53

57These methods set and get a name associated with the CNK object. The initial value for name is NULL.This is a good opportunity to mention several a

Strany 54

58 severity_warning, severity_error }; void addError(const char* msg); void addWarning(const char* msg); void addInformation(const char* msg)

Strany 55

59only storing messages for the first few rows. The getNumMessagesAtLevel() method returns the number of messages at a specified severity level.CNKOb

Strany 56 - Parent Class

6OVERVIEWSpotfire Miner is written in Java and C++. The graphical user interface and some computational components are in Java. The underlying pipel

Strany 57

60 static int isLevelNumNA(long val); static const char* getStringNA(); static int isStringNA(const char* val); static CNKTimeDate getTime

Strany 58

61 static CNKConverter* getDefaultConverter();These methods support conversions between string and double or time/date values. Such conversions de

Strany 59

62CNKPropertyInfo Information other than the actual data is stored and exchanged using properties. A property is a name/value pair where the name uni

Strany 60

63These methods are similar to getPropAsInt, etc., except that they can interpret the objects representing pointers to CNKBuf and CNKProc objects. Fo

Strany 61

64 if (propInfo->isPropName("seed")) { setSeed(propInfo->getPropAsINT32()); } else if (propInfo->isPropName("total.

Strany 62

65CNKBuf, CNKBufReader, CNKBufWriter: Data BuffersThe three classes CNKBuf, CNKBufReader, and CNKBufWriter together are used to implement a first-in-f

Strany 63

66immediately: it does not support "suspending" a CNKBuf data access method, if the data is not currently available. To handle these limita

Strany 64

67When a CNKMemoryBuf or CNKBackingFileBuf, is passed to one of the CNKProc::setInputBuf or CNKProc::setOutputBuf methods, this actually creates an in

Strany 65 - Data Buffers

68CNKBuf:: void setNumRows(long numRows); void setNumColumns(int cols); long getNumRows(); int getNumColumns();Set/get the number of rows

Strany 66 - Subclasses:

69 column_type_string, column_type_timeDate}; void setColumnType(int colNum, int typeNum); int getColumnType(int colNum); int columnTypeI

Strany 67

7EXTENSION FILESThe Spotfire Miner software is implemented using a large number of Java and C++ object files, image files, etc, stored in various subd

Strany 68 - CNKBufWriter

70integer part of this number is the number of days, and the fractional part represents a fraction of a day, e.g. the hours, minutes, and seconds.CNKB

Strany 69

71The "MaxAutoLevels" property determines the maximum number of levels that will be automatically created. The actual number of levels in a

Strany 70

72CNKBuf will call CNKBufReader::getEOF() to check whether there EOF has been set. CNKBuf::getEOF() gives the same information: it returns true (non-

Strany 71

73To avoid this problem, the CNKBuf must have at least as many rows as the largest possible CNKBufWriter::setRequestRows value plus the largest possib

Strany 72

74single buf reader can access the data sequentially, or read the data in multiple passes or via random access. As different parts of the data are ac

Strany 73 - CNKBackingFileB

75These methods return information about the storage of the data in the backing file. getBackingFileRowBytes returns the number of bytes for each row

Strany 74

76increasing, until releaseRows is called to release some of the read data rows. Therefore, it is safe to save the value returned by getRowsReady, an

Strany 75 - CNKBufReader

77 virtual double getDouble(long rowNum, int columnNum); virtual long getLevelNum(long rowNum, long colNum); virtual const char* getString(lo

Strany 76

78releaseAll() should be called when the reader is no longer interested in reading this data. After calling releaseAll(), no requests will be satisfi

Strany 77

79CNKBufWriter MethodsMost of the methods for CNKBufWriter are similar to those for CNKBufReader. Like the other class, where is no public constructo

Strany 78

8• Possibly a Windows DLL with compiled C++ code.• Possibly help files in a format such as compiled HtmlHelp• Possibly documentation in a format such

Strany 79

80isReady returns true (non-zero) if the CNKBuf is ready to be written to. Normally, this is true if getRowsReady() is greater than or equal to getRe

Strany 80

81With setConvertFactor, if the column is actually a double column, the argument is registered as a factor level for the column (by calling CNKBuf::ma

Strany 81

82 virtual INT64 getChunkPosition();At any time, a CNKBufWriter can write a "chunk" of data rows in a potentially-very-large series of da

Strany 82

83Likewise, the subclass init method should call the CNKProc::init(), as follows:void CNKProcCount::init(){CNKProc::init();...}The destructor ~CNKPro

Strany 83

84After inputs and outputs have been created, they can be accessed with getInputBuf and getOutputBuf (returning the linked CNKBuf objects), and getInp

Strany 84

85At a rough level of detail, the pipeline engine works by repeatedly scanning through all of the CNKProc objects. For each CNKProc, the engine calls

Strany 85

86Each CNKProc contains a field counting the number of times that it has been executed. This field is incremented by the pipeline engine, which calls

Strany 86 - Subclass of

87of a class, this creates and exports a regular C function (with a long, ugly name including the class name) that creates an instance of that class.

Strany 87

881. Request input and output data rows.The execute() method must call CNKBufReader::setRequestRows to request access to its input data, and call CNKB

Strany 88

89If the CNKProc has outputs, the execute() method may set the column names and types of the output CNKBuf objects if they are not set already. This

Strany 89

9In this case, the extension subdirectory is named my_extension, and the extension uses two gif files.Explorer IML FilesAn Explorer IML file is an XML

Strany 90 - Summaries

90Releasing rows and performing these other tasks can often by done by calling CNKProc::executeReleaseRows(long rows), passing the number of rows to r

Strany 91

91After reading a set of input rows, the accumulated max, min, counts, and crosstab values can be extracted from the proc. CNKProcCount:: CNKProcCo

Strany 92

92getCountNA returns the number of NA values read. getCountOK returns the number of non-NA values read.CNKProcCount:: int getColumnNumLevels(int c

Strany 93

93setCrossIndex sets the crosstab level for the crosstab column specified by crossNum. The level for this column is set to levelNum, which is interpr

Strany 94

94These methods set/get the total number of rows to be written by this proc, before the proc sends an EOF to the output buf, and specifies that it is

Strany 95

95CNKProcPrintfThe CNKProcPrintf proc prints information about each block of data. It prints the position of the block in the data, the number of row

Strany 96 - Pipeline Object

96These are the constructor, destructor, and init() methods. The execute() method is run when this CNKProc is executed within a pipeline.CNKProcRando

Strany 97

97 CNKProc* getProc(int i); CNKProc* getProc(const char* name); void addBuf(CNKBuf* buf); void removeBuf(CNKBuf* buf); int getNumBufs()

Strany 98

98 INT64 getLastExecutionCount(); INT64 getTotalExecutionCount();These methods return the number of times that the pipeline has executed a CNKPr

Komentáře k této Příručce

Žádné komentáře