%iKnow.TextTransformation.Definition
Class %iKnow.TextTransformation.Definition Extends %RegisteredObject [ Abstract, Deprecated, System = 4 ]
This class represents a Text Transformation model, as defined in its Transformation XData block. See the %Apply and %ApplyBatch methods for ways how to invoke this model on input text.
Parameters
DEFAULTSECTIONHEADER
Parameter DEFAULTSECTIONHEADER = "no header";
XDatas
Transformation
XData Transformation [ XMLNamespace = "http://www.intersystems.com/iknow/transformation" ]
The XML definition for this class' Text Transformation. See also %iKnow.TextTransformation.Model.Model.
Methods
%OnBeforeTransformation
Method %OnBeforeTransformation(ByRef pOutput As Output) As %Status
This callback method is invoked before a record is processed, after the Output object has been instantiated.
%OnAfterTransformation
Method %OnAfterTransformation(ByRef pOutput As Output) As %Status
This callback method is invoked after a record has been processed, before the Output object is saved.
%OnCreateSection
Method %OnCreateSection(ByRef pSection As OutputSection, ByRef pOutput As Output) As %Status
Callback method invoked upon the creation of a Section object. Use this callback to customize behavior upon creating sections. Setting pSection to null will remove the section from the output.
%OnCreateKeyValue
Method %OnCreateKeyValue(ByRef pKeyValue As OutputKeyValue, ByRef pOutput As Output) As %Status
Callback method invoked upon the creation of a KeyValue object. Use this callback to customize behavior upon creating key-value pairs. Setting pKeyValue to null will prevent the key-value pair from being added to the output.
%ApplyStream
ClassMethod %ApplyStream(pStream As %Stream.Object, Output pOutput As %iKnow.TextTransformation.Output) As %Status [ Final ]
Invokes the transformation model on a character stream. See also %Apply.
%Apply
ClassMethod %Apply(ByRef pString As %String, Output pOutput As %iKnow.TextTransformation.Output) As %Status [ Final ]
Invokes the model defined in Transformation on the string pString, identifying sections, headers and key-value pairs as specified in the model. These elements are returned through an pOutput object of the output class specified in the model, defaulting to %iKnow.TextTransformation.Output.
pString may also be supplied as an array of strings representing consecutive lines of text (by reference). To invoke the model in batch on a bunch of records, use %ApplyBatch.
%ApplyBatch
ClassMethod %ApplyBatch(pResultSet As %ResultSet) As %Status [ CodeMode = objectgenerator, Final, ForceGenerate, GenerateAfter = %GetOutputClass ]
Invokes the model specified in Transformation on all records retrieved by pResultSet, populating and saving an output object for each record. The first column of pResultSet is used as an identifier and saved as the Ref property of the output object. The second column is assumed to contain the text to be transformed by this model.
Note that the output object used for this batch operation should inherit from %Persistent in order for the output to be effectively persisted.
See also %Apply.
%ProcessInput
Method %ProcessInput(ByRef pString As %String, Output pTextArray) As %Status [ Internal, Private ]
Transforms input strings into a text array representing actual lines of text
%ProcessOutput
Method %ProcessOutput(ByRef pOutputArray, ByRef pOutput As %iKnow.TextTransformation.Output) As %Status [ Internal, Private ]
Transforms the pOutputArray produced by a sequence of transformations and annotations into an output object.
%ApplyInternal
Method %ApplyInternal(ByRef pString As %String, Output pOutput As %iKnow.TextTransformation.Output) As %Status [ CodeMode = objectgenerator, Final, ForceGenerate, GenerateAfter = %GetDefinition, Internal, Private ]
Internal method applying the model to a text array. The code for this method is automatically generated based on the mode definition in Transformation.
%InitializeSection
Method %InitializeSection(ByRef pOutput As Output, Output pSection As OutputSection, pHeader As %String, pLocation As OutputLocation) As %Status [ Final, Internal ]
Initializes a new section object (returned through pSection.
%FinalizeSection
Method %FinalizeSection(ByRef pOutput As Output, ByRef pSection As OutputSection, pLocationEnd As OutputLocation) As %Status [ Final, Internal ]
Finalizes a section object pSection, ensuring the %OnCreateSection callback is invoked.
%CreateSection
Method %CreateSection(ByRef pOutput As Output, pHeader As %String, pText As %String, pLocation As OutputLocation, ByRef pKeyValues) As %Status [ Final ]
Helper method to create a Section object. Custom code in any of the callbacks (such as %OnBeforeTransformation) may invoke this method to add default sections. Note that no further callbacks are invoked for key-value pairs in the pKeyValues array.
%CreateKeyValue
Method %CreateKeyValue(ByRef pOutput As Output, pHeader As %String, pKey As %String, pValue As %String, pLocation As OutputLocation) As %Status [ Final ]
Helper method to create a KeyValue object. Custom code in any of the callbacks (such as %OnBeforeTransformation) may invoke this method to add default key value pairs.
%GetOutputClass
ClassMethod %GetOutputClass() As %String [ CodeMode = objectgenerator, ForceGenerate, GenerateAfter = %LoadKeysAndHeaders, Internal ]
Returns the class name of the output class for this TT model, as specified in Transformation.
%OnNew
Method %OnNew() As %Status [ Internal, ServerOnly = 1 ]
%GetDefinition
ClassMethod %GetDefinition(pClassName As %String, Output pDefinition As %iKnow.TextTransformation.conf.Model) As %Status [ Internal ]
Returns the TT model definition specified in Transformation as a %iKnow.TextTransformation.Model.Model object.
%LoadKeysAndHeaders
Method %LoadKeysAndHeaders() As %Status [ CodeMode = objectgenerator, ForceGenerate, GenerateAfter = %ApplyInternal, Internal ]
Loads the key and header sets from the locations specified in Transformation.