Home > Class Reference > %SYS namespace > %iKnow.Source.Processor

%iKnow.Source.Processor

abstract class %iKnow.Source.Processor extends %Library.RegisteredObject

This is the base class for any Processor implementations. Processor classes are developed to read source data as referenced (or stored temporarily) by %iKnow.Source.Lister classes in their ExpandList() methods. It is up to the Lister to make sure the references they store in this stage refer to the proper Processor implementation and contain the details it needs to find and read that source while executing FetchSource().

Each Processor implementation tackles a specific type of location where source data can be read from, such as a filesystem for %iKnow.Source.File.Processor or a global for %iKnow.Source.Global.Processor.

Processor objects are handled by the loading framework automatically and custom code should never instantiate a Processor object or call any of its methods directly.

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property Buffer as %RegisteredObject [ Private ];
Property methods: BufferGet(), BufferGetSwizzled(), BufferIsValid(), BufferNewObject(), BufferSet()
property ConvParams as %String [ Private ];
Property methods: ConvParamsDisplayToLogical(), ConvParamsGet(), ConvParamsIsValid(), ConvParamsLogicalToDisplay(), ConvParamsLogicalToOdbc(), ConvParamsNormalize(), ConvParamsSet()
property Converter as %iKnow.Source.Converter [ Private ];
Property methods: ConverterGet(), ConverterGetSwizzled(), ConverterIdDisplayToLogical(), ConverterIdGet(), ConverterIdIsValid(), ConverterIdLogicalToDisplay(), ConverterIdNormalize(), ConverterIdSet(), ConverterIsValid(), ConverterNewObject(), ConverterSet()
property ConverterId as %Integer [ Private ];
Property methods: ConverterIdDisplayToLogical(), ConverterIdGet(), ConverterIdIsValid(), ConverterIdLogicalToDisplay(), ConverterIdNormalize(), ConverterIdSet()
property DirectInput as %iKnow.DirectInput [ Private ];
Property methods: DirectInputGet(), DirectInputGetSwizzled(), DirectInputIsValid(), DirectInputNewObject(), DirectInputSet()
property DomainId as %Integer [ Private ];
Property methods: DomainIdDisplayToLogical(), DomainIdGet(), DomainIdIsValid(), DomainIdLogicalToDisplay(), DomainIdNormalize(), DomainIdSet()
property Indexer as %iKnow.Indexer [ Private ];
Property methods: IndexerGet(), IndexerGetSwizzled(), IndexerIsValid(), IndexerNewObject(), IndexerSet()
property ListerId as %Integer [ Private ];
Property methods: ListerIdDisplayToLogical(), ListerIdGet(), ListerIdIsValid(), ListerIdLogicalToDisplay(), ListerIdNormalize(), ListerIdSet()
property Params as %String [ Private ];
Property methods: ParamsDisplayToLogical(), ParamsGet(), ParamsIsValid(), ParamsLogicalToDisplay(), ParamsLogicalToOdbc(), ParamsNormalize(), ParamsSet()
property TempId as %Integer [ Private ];
surrogate domain ID for use in CacheTemp guaranteed to be unique across namespaces
Property methods: TempIdDisplayToLogical(), TempIdGet(), TempIdIsValid(), TempIdLogicalToDisplay(), TempIdNormalize(), TempIdSet()

Methods (Including Private)

private method %OnNew(domainId As %Integer, indexer As %iKnow.Indexer, directInput As %iKnow.DirectInput) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

private method FetchSource(loc As %Integer, ref As %List) as %Status

This is the primary method that will need to be implemented by subclasses. It gets the local ID of the source being processed (as assigned by the lister) and the Composite Reference in %List format. Data read by the Processor should be buffered through calling ..Buffer.BufferString(), which will automatically forward the data to the iKnow Indexing engine or, if configured, a %iKnow.Source.Converter object that will in turn push converted data through to the engine.

If this Processor also extracts metadata while reading (as specified in its GetMetadataKeys() implementation), it should make sure to invoke SetCurrentMetadataValues() at some point in this methods execution.

method GetKnownLanguage(loc As %Integer, ref As %List, keyid As %Integer = "") as %String

This method is called from ProcessListElement() and ProcessVirtualListElement() right before calling on the Indexer to process the data read by this Processor instance. It returns the language (two-letter ISO code) for the source being processed, if there is any means to derive it from known facts about the source. If no language can be derived with enough certainty, this method returns "".

The default implementation looks if there is a $$$IKPLANGUAGEFIELDNAME parameter defined pointing to a metadata field containing the language code. Subclasses may override and/or extend this method if they have access to additional information.

classmethod GetMetadataKeys(params As %String) as %List

Subclasses should override this method to identify those metadata keys that are calculated or extracted by this Processor implementation and will be registered for every source processed by calling SetCurrentMetadataValues() during the FetchSource() execution.

final method ProcessListElement(loc As %Integer, ref As %List, keyid As %Integer, metadata As %String, Output skipped As %Boolean = 0) as %Status

This is the primary method that will be called from the %iKnow.Source.Loader for each source identified by the %iKnow.Source.Lister objects involved in this loading process. It will buffer what's read in the FetchSource() implementation, trigger the %iKnow.Source.Converter if one is configured, and then instruct the Indexer to process the resulting plain text, directing its output to the appropriate DirectInput object.

Also, this method will gather any metadata set by the Lister, combine it with metadata calculated by the Processor or Converter and push it to the DirectInput object as well.

final method ProcessVirtualListElement(loc As %Integer, ref As %List) as %Status
Same as ProcessListElement(), but for Virtual Sources.
private final method ReportError(ref As %List, message As %String, location As %String = "", errorId As %String = "") as %Status
Utility method to report failures for a given source (identified through a Composite Reference)
private final method ReportWarning(ref As %List, message As %String, location As %String = "") as %Status
Utility method to report warnings for a given source (identified through a Composite Reference)
final method SetConverter(convId As %Integer, convParams As %String) as %Status

Registers the Converter to be used by this Processor onwards.

private final method SetCurrentMetadataValues(metaValues As %List) as %Status

Stores the metadata values for the source currently being processed. Their order and number should correspond to the keys returned by GetMetadataKeys().

method SetParams(params As %String) as %Status

This method stores the Processor parameters in the Params property, from where they can be referenced in the FetchSource() implementation.

NOTE: If this method is overridden by a subclass, it should make sure to either call this method via ##super, or set Params itself.

Inherited Members

Inherited Methods (Including Private)

Subclasses