%iKnow.Filters.Filter
deprecated abstract class %iKnow.Filters.Filter extends %Library.RegisteredObject
This is the base class for iKnow Filter objects, restricting the scope of an iKnow Query to a subset of all the sources in a domain through filter criteria based on the properties of a Source. These criteria are expressed through a number of Filter Parameters which should be passed as arguments to the %New() method when instantiating a filter object. Typically, the first Filter Parameter is the Domain ID of the domain of which sources are to be filtered.
Filters have a String Representation so they can be passed around in non-object environments such as SQL and SOAP. Subclasses should therefore provide an unambiguous implementation for ToString(), serializing its Filter Parameters so the string can be passed around and then deserialized through the RestoreFilterFromString() method. See also CreateAsString() and %iKnow.Filters.FilterWSAPI for handling filters in non-COS environments.
Subclasses should provide an implementation for (at least) BuildSourceFilter(), building a bitstring with 1s for those Source IDs satisfying the filter criteria the filter class represents. In their %OnNew() implementation, subclasses should make sure to set the DomainId property and call Initialize() after setting all other properties specific to its implementation that influence the outcome of its ToString().
Filters can be cached so their calculated bitstrings can be reused (as long as they are still valid) across processes and time. Cache usage can be configured either by setting the $$$IKPENABLEFILTERCACHE domain parameter, or through a subclass explicitly enabling or disabling it when calling Initialize().
Sample Filter implementations include %iKnow.Filters.ExternalIdFilter, %iKnow.Filters.SentenceCountFilter and %iKnow.Filters.SimpleMetadataFilter
WARNING: When implementing a custom filter class, either make its properties read-only, or override the corresponding Set methods to call ChangeParams() to reset the internal representations after property values change. When setting these updateable properties in the class' %OnNew() method, use i% syntax to bypass these setters.
Property Inventory
Method Inventory
- CheckResultCache()
- CheckResultCacheSingle()
- ClearCachedFilter()
- ClearCachedFilters()
- CreateAsString()
- CreateFromBitstring()
- CreateGroupAsString()
- FromString()
- GetCRCOccurrenceFilter()
- GetCRCUniqueFilter()
- GetCcUniqueFilter()
- GetEntityOccurrenceFilter()
- GetEntityUniqueFilter()
- GetFilteredCcFrequency()
- GetFilteredCcSpread()
- GetFilteredCrcFrequency()
- GetFilteredCrcSpread()
- GetFilteredEntityFrequency()
- GetFilteredEntitySpread()
- GetFilteredEntityUniqueCount()
- GetFilteredStemFrequency()
- GetFilteredStemSpread()
- GetFirstFilteredSource()
- GetLabel()
- GetNextCRCOccurrenceFilterOffset()
- GetNextCRCUniqueFilterOffset()
- GetNextCcUniqueFilterOffset()
- GetNextEntityOccurrenceFilterOffset()
- GetNextEntityUniqueFilterOffset()
- GetNextPathFilterOffset()
- GetNextSourceFilterOffset()
- GetNextSrcId()
- GetPathFilter()
- GetSourceFilter()
- Initialize()
- Invalidate()
- IsFiltered()
- IsValid()
- RestoreFilterFromId()
- RestoreFilterFromString()
- StoreResultCache()
- StoreResultCacheSingle()
- ToString()
Properties
The total number of sources satisfying this filter instances criteria.
This property is used to choose the fastest access path in iKnow Query implementations.
The ratio of sources satisfying this filter instances criteria to the total number of sources in this domain.
This property is used to choose the fastest access path in iKnow Query implementations.
Methods
Clears a specific filter from the persistent filter cache, if it exists.
Clears all filters from the persistent filter cache.
This class method is an access point to generate the string representation (as specified in ToString()) for %iKnow.Filters.Filter classes, accessible from COS and SQL scenarios that cannot or prefer not to directly instantiate objects through COS.
When calling this method, you should supply the Filter Parameters as if calling the %New() method of this particular Filter implementation.
For Web Service scenario's, use the corresponding method in %iKnow.Filters.FilterWSAPI.
This class enables SQL users to create the string representation of a %iKnow.Filters.GroupFilter composed of multiple subfilters passed in using their respective string representations as the filters... parameter.
For Web Service scenario's, use the corresponding method in %iKnow.Filters.FilterWSAPI.
Converts the supplied string pString into a %iKnow.Filters.Filter object. In addition to the normal RestoreFilterFromString() functionality (which expects pString to be the output of a ToString() call on a filter object), this method supports the following shorthands:
- A comma-separated list of source IDs (fe: "123,45,987" or "654"), resulting in a %iKnow.Filters.SourceIdFilter
- A range of source IDs expressed as [from]:[to] (fe: "1:500", which includes source IDs 1 and 500), resulting in a %iKnow.Filters.SourceIdRangeFilter
- A metadata filter condition [field name][operator][value] (fe: "Year>2000" or "Country!=Canada"), resulting in a %iKnow.Filters.SimpleMetadataFilter
Note: while covering a majority of common filter operations, the shorthand syntax is meant to simplify exploration through the command-line and does not handle every possible combination of parameters. Application code should therefore always use regular filter constructor methods and the string representations produced by ToString() (which this method also accepts).
Returns a bitstring on crcOccIDs, representing those CRC occurrences appearing in a source satisfying the filter criteria.
Returns a bitstring on crcUniIDs, representing those unique CRCs appearing in at least one source satisfying the filter criteria.
Returns a bitstring on crcUniIDs, representing those unique CCs appearing in at least one source satisfying the filter criteria.
Returns a bitstring on entOccIDs, representing those entity occurrences appearing in a source source satisfying the filter criteria.
Returns a bitstring on entUniIDs, representing those unique entities appearing in at least one source satisfying the filter criteria.
Returns the total frequency of a CC in the sources satisfying this filter instances criteria.
Returns the total number of sources satisfying this filter instances criteria in which the supplied CC appears.
Returns the total frequency of a CRC in the sources satisfying this filter instances criteria.
Returns the total number of sources satisfying this filter instances criteria in which the supplied CRC appears.
Returns the total frequency of an entity in the sources satisfying this filter instances criteria, where the entities role is concept (if role = $$$ENTTYPECONCEPT), relation (if role = $$$ENTTYPERELATION) or either of the two (if role = $$$ENTTYPEANY).
Returns the total number of sources in which the supplied entity appears that satisfy this filter instances criteria, where its role is concept (if role = $$$ENTTYPECONCEPT), relation (if role = $$$ENTTYPERELATION) or either of the two (if role = $$$ENTTYPEANY).
Returns the total number of distinct entities occurring in at least one of the sources satisfying this filter instances criteria.
This property is used to choose the fastest access path in iKnow Query implementations.
Returns the total frequency of a stem in the sources satisfying this filter instances criteria, where the stem's role is concept (if pRole = $$$ENTTYPECONCEPT), relation (if pRole = $$$ENTTYPERELATION) or either of the two (if pRole = $$$ENTTYPEANY).
Returns the total number of sources in which the supplied stem appears that satisfy this filter instances criteria, where its role is concept (if pRole = $$$ENTTYPECONCEPT), relation (if pRole = $$$ENTTYPERELATION) or either of the two (if pRole = $$$ENTTYPEANY).
Returns the first Source ID satisfying this filter isntances criteria, starting from the lowest (direction 1) or highest Source ID (direction -1). Returns "" when no source is filtered.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on CRC occurrence IDs.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on unique CRC IDs.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on unique CC IDs.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on entity occurrence IDs.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on unique entity IDs.
Returns the next offset for which this filter has bits (also returned as nextBits) in its filter on path IDs.
Retrieves a bitstring representing the Source IDs satisfying this Filters criteria, for the offset (sourceId\64000+1) following the supplied one. The returned number is the next offset (given the direction).
Returns a bitstring on path IDs, representing those paths appearing in a source satisfying the filter criteria.
Returns a bitstring representing the Source IDs satisfying this Filters criteria, for the given offset (sourceId\64000+1).
This method initializes the data structures this Filter object will be using througout its lifetime as an object instance. If caching is enabled for this object (useCache = 1), it will check if there is already a cached entry corresponding to these filter criteria it can reuse, or create a new cache entry otherwise. If caching is disabled (useCache = 0), Process-Private Globals will be used for storing this filter instances internals and nothing will be reused. If useCache = -1 (default), the domain default will be used (set through the $$$IKPENABLEFILTERCACHE domain parameter).
Resets all internal representations, forcing further use of this filter to recalculate results. If a type is supplied, only the bitstrings of that type are reset, including dependent ones. In the case of Source IDs (type = $$$IKFSOURCE), specific offset values can be invalidated separately.
Returns whether the id of the given type appears in any source satisfying this filter instances criteria.
Checks if this filter for type is still up-to-date with regards to incorporating the most recent source additions and changes. Subclasses might wish to override this method but should combine their additional checks with the result of this root implementation if they do.
If the requested filter is not calculated, this method will return 0.
Utility method to restore a cached filter based on its cached filter ID.
Utility method to recreate a filter based on its string representation, which by default corresponds to the filter class name, a pipe character (|) and a filter-specific string containing all parameters required to recreate the string using the %New() method. Subclasses should override RestoreFilterFromStringInternal() if this default behavior is not sufficient.
This method is used primarily in SQL and Web Service scenarios, where the filter objects themselves cannot be passed in a SQL statement or SOAP request.
Subclasses should implement this method to build a string representation of the filter instance. It should start with the filter class name, followed by a pipe (|) character and then a string representation that can be interpreted by its RestoreFilterFromStringInternal() implementation.
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()
Subclasses
- %iKnow.DeepSee.MDXFilter
- %iKnow.Filters.ContainsEntityFilter
- %iKnow.Filters.ContainsRelatedEntitiesFilter
- %iKnow.Filters.DictionaryItemMatchFilter
- %iKnow.Filters.DictionaryMatchFilter
- %iKnow.Filters.DictionaryTermMatchFilter
- %iKnow.Filters.ExternalIdFilter
- %iKnow.Filters.GroupFilter
- %iKnow.Filters.PathFilter
- %iKnow.Filters.RandomFilter
- %iKnow.Filters.SentenceCountFilter
- %iKnow.Filters.SentenceFilter
- %iKnow.Filters.SimpleMetadataFilter
- %iKnow.Filters.SourceIdFilter
- %iKnow.Filters.SqlFilter