Home > Class Reference > %SYS namespace > %iKnow.Matching.Formats.Format


abstract class %iKnow.Matching.Formats.Format extends %Library.RegisteredObject

This abstract class describes the interface to be implemented by an actual Dictionary Format matching object. Subclasses of this class can for example introduce regular expression matching, date matching, number checking or something more domain-specific.

Subclasses should at least override MatchSingle() and optionally provide a format-specific implementation for MatchAll().

Format implementations can be parameterized through a number of parameters the Format class defines, which will get passed to the MatchSingle() and MatchAll() methods as a formatParams parameter of type %List.

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property DomainId as %Integer [ ReadOnly ];
Property methods: DomainIdDisplayToLogical(), DomainIdGet(), DomainIdIsValid(), DomainIdLogicalToDisplay(), DomainIdNormalize()

Methods (Including Private)

private method %OnNew(domainId As %Integer) as %Status [ Language = objectscript ]
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.

method Finalize() as %Status [ Language = objectscript ]

This method is called after matching has finished to clean up eventual memory structures generated while executing MatchSingle() or MatchAll() calls and can be overridden in subclasses to perform any required cleanup operations.

method HasMatchAll() as %Boolean [ Language = objectscript ]

Whether or not this Format class has a MatchAll() function that deals with a set of strings directly. Subclasses should make sure to override this method (to make it return true) if they override MatchAll().

method MatchAll(stringsGlobalName As %String, resultGlobalName As %String, formatParams As %List, minEntUniId As %Integer = 0) as %Status [ Language = objectscript ]

This method loops through @stringsGlobalName@(" "_string) = id and matches all global entries, storing the results in @resultGlobalName@(id) = $lb(matchScore, matchedWordBits, isScattered, formatOutput). The implementation should ignore all ids < minEntUniId and should not store any results if the matchScore is 0.

Implementing this method only makes sense if the specific format this class represents can exploit the inverse global structure of @stringsGlobalName.

Note: entries in @stringsGlobalName are all in lowercase and prefixed with a space

Warning: an implementation for this method does not replace MatchSingle(). There should still be a MatchSingle alternative, for example to process strings longer than $$$IKHASHSIZE that would not appear in @stringsGlobalName.

final method MatchAllHashes(hashGlobalName As %String, idGlobalName As %String, resultGlobalName As %String, formatParams As %List, minEntUniId As %Integer = 0) as %Status [ Language = objectscript ]

As MatchAll() can only tackle those strings shorter than $$$IKHASHSIZE, this method complements it by looping through the corresponding global structures for longer strings and checking them manually using MatchSingle().

abstract method MatchSingle(string As %String, formatParams As %List, Output matchScore As %Numeric, Output matchedWordBits, Output isScattered As %Boolean, Output formatOutput) as %Status [ Language = objectscript ]

Implementations of this method check whether an individual string complies with the format this class represents, returning a matchScore (0..1) and optional matchedWordBits, isScattered and formatOutput through output parameters.

classmethod TestParams(pFormatParams As %List, pDomainId As %Integer = 0) as %Status [ Language = objectscript ]
Utility method subclasses can implement to verify user-supplied format parameters are valid. The default implementation instantiates an object of this matching format class and calls its MatchSingle() method for "test string". The %Status object returned by that call is returned for this method.

Inherited Members

Inherited Methods (Including Private)