org.knime.core.node.port.pmml
Class DataDictionaryContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.knime.core.node.port.pmml.PMMLContentHandler
org.knime.core.node.port.pmml.DataDictionaryContentHandler
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class DataDictionaryContentHandler
- extends PMMLContentHandler
Parses a PMML DataDictionary and converts it into a DataTableSpec
.
Each DataField is converted into a DataColumnSpec
.
- <xs:attribute name="name" type="FIELD-NAME" use="required" /> will be
the column name
- <xs:attribute name="dataType" type="DATATYPE" use="required" /> will be
the column type
- if the dataType attribute is not available (optional until PMML v3.2),
it is tried to be inferred from
<xs:attribute name="optype" type="OPTYPE" />,
which is one of
- categorical
- ordinal
- continuous.
Continuous is mapped to DoubleCell.TYPE
, the others are assumed to be
of type StringCell.TYPE
.
The DataColumnDomain
is also created by using either the Interval or
the Value fields from PMML:
<
<xs:choice>
<xs:element ref="Interval" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Value" minOccurs="0" maxOccurs="unbounded" />
</xs:choice>
Some examples simply list each occurring value also for continuous columns,
thus they are all collected, sorted and then the minimal and maximal values
are chosen as the lower and upper bound. If they are not numerical they are
used as nominal values.
- Author:
- Fabian Dill, University of Konstanz
Field Summary |
static String |
ID
ID to identify registered handler. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ID
public static final String ID
- ID to identify registered handler.
- See Also:
- Constant Field Values
DataDictionaryContentHandler
public DataDictionaryContentHandler()
startElement
public void startElement(String uri,
String localName,
String name,
Attributes atts)
throws SAXException
-
- Specified by:
startElement
in interface ContentHandler
- Specified by:
startElement
in class PMMLContentHandler
- Throws:
SAXException
endElement
public void endElement(String uri,
String localName,
String name)
throws SAXException
-
- Specified by:
endElement
in interface ContentHandler
- Specified by:
endElement
in class PMMLContentHandler
- Throws:
SAXException
getDataTableSpec
public DataTableSpec getDataTableSpec()
- Returns:
- the loaded dta table spec
characters
public void characters(char[] ch,
int start,
int length)
throws SAXException
-
- Specified by:
characters
in interface ContentHandler
- Specified by:
characters
in class PMMLContentHandler
- Throws:
SAXException
endDocument
public void endDocument()
throws SAXException
-
- Specified by:
endDocument
in interface ContentHandler
- Specified by:
endDocument
in class PMMLContentHandler
- Throws:
SAXException
Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display,
or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the
copyright owner or as specified in the license file distributed with this product.