persistent class %iKnow.UserDictionary extends

This class represents User Dictionaries, used to rewrite fragments of input data specific to a particular use case.

When creating a User Dictionary, you can pass initial values for the following properties to its %New method:

  1. Name (required)
  2. Description
Check the respective property descriptions for more details.


Parameters Properties Methods Queries Indices ForeignKeys Triggers
4 20 2


%Concurrency Description Id Name

%%OIDGet %1Check %AddJrnObjToSyncSet %AddToSaveSet
%AddToSyncSet %BMEBuilt %BindExport %BuildIndices
%BuildIndicesAsync %BuildIndicesAsyncResponse %BuildObjectGraph %CheckConstraints
%CheckConstraintsForExtent %ClassIsLatestVersion %ClassName %Close
%ComposeOid %ConstructClone %Delete %DeleteExtent
%DeleteId %DispatchClassMethod %DispatchGetModified %DispatchGetProperty
%DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty
%DowngradeConcurrency %ExecuteAfterTriggers %ExecuteBeforeTriggers %Exists
%ExistsId %Extends %FileIndices %GUID
%GUIDSet %GetLock %GetParameter %GetSwizzleObject
%Id %IncrementCount %IsA %IsModified
%IsNull %JournalObject %KillExtent %LockExtent
%LockId %New %NormalizeObject %ObjectIsNull
%ObjectModified %Oid %OnBeforeAddToSync %OnDetermineClass
%Open %OpenId %OriginalNamespace %PackageName
%PurgeIndices %Reload %RemoveFromSaveSet %ResolveConcurrencyConflict
%RollBack %SQLAcquireLock %SQLAcquireTableLock %SQLAfterTriggers
%SQLBeforeTriggers %SQLBuildIndices %SQLBuildPurgeIndexForRow %SQLBuildPurgeIndices
%SQLCheckUnique %SQLCheckUniqueIndices %SQLCheckUniqueKeys %SQLCopyIcolIntoName
%SQLCopyNameIntoIcol %SQLCreateInsDelTables %SQLDefineiDjVars %SQLDelete
%SQLDeleteChildren %SQLDeleteTempStreams %SQLEExit %SQLExists
%SQLFKeyDelLock %SQLFastInsert %SQLFieldValidate %SQLGetLock
%SQLGetOld %SQLGetOldAll %SQLGetOldIndex %SQLInsert
%SQLInsertComputes %SQLInsertStreams %SQLInvalid %SQLInvalid2
%SQLMVDelete %SQLMVIndexDelete %SQLMVIndexInsert %SQLMVIndexUpdate
%SQLMVInsert %SQLMVUpdate %SQLMissing %SQLNormalizeCompFields
%SQLNormalizeFields %SQLPurgeIndices %SQLQuickBulkInsert %SQLQuickBulkLoad
%SQLQuickBulkSave %SQLQuickBulkUpdate %SQLQuickDelete %SQLQuickDeleteChildren
%SQLQuickFindPKeyByRowID %SQLQuickFindRowIDByPKey %SQLQuickInsert %SQLQuickLoad
%SQLQuickLoadChildren %SQLQuickLogicalToOdbc %SQLQuickOdbcToLogical %SQLQuickUpdate
%SQLReleaseLock %SQLReleaseTableLock %SQLStorageValidation %SQLTrigDelTab
%SQLTrigInsTab %SQLUnlock %SQLUnlock2 %SQLUnlockError
%SQLUnlockRef %SQLUpdate %SQLUpdateComputes %SQLUpdateStreams
%SQLValidateCompFields %SQLValidateFields %SQLicompView %SQLnBuild
%Save %SaveDirect %SaveIndices %SerializeObject
%SetModified %SortBegin %SortEnd %SyncObjectIn
%SyncTransport %UnlockExtent %UnlockId %UpgradeConcurrency
%ValidateIndices %ValidateObject AddAttribute AddEntry
AddNegationTerm AddNegativeSentimentTerm AddPositiveSentimentTerm CheckIfManaged
ClearEntries CreateFromFile CreateTransient GetEntries
GetEntry NextEntry OpenByName RemoveEntry


• property Description as %String [ Final ];
• property Id as %Integer [ Final,ReadOnly ];
• property IsTransient as %Boolean [ Private,InitialExpression = 0,Transient ];
This property is used for transient versions only
• property Name as %String [ Final,ReadOnly ];


• method %ConstructClone(deep As %Boolean = 0, ByRef cloned As %String, location As %String) as %RegisteredObject
Clone the current object to a new object. If deep is 1 then this does a deep copy which will also copy any subobjects and if deep is 0 then it will create another reference to any subobjects and increment the reference count appropriately. It returns the new cloned object.

Note that even if deep=0 when you clone a parent object in a parent child relationship or a one object of a one to many relationship then it will construct clones of all the child/many objects. This is because a child/many object can only point at a single parent and so if we did not create a clone of these then you would have a relationship with zero items in it. If you really just want to clone the object without these child/many objects then pass deep=-1 to this method.

After the clone is constructed it will call %OnConstructClone(object,deep,.cloned) on the clone if it is defined so that you can perform any additional steps e.g. taking out a lock. This works just the same way as %OnNew() does.

The object is the oref of the original object that was cloned. The cloned array is just used internally when doing a deep clone to prevent recursive loops, do not pass anything in at all for this parameter on the initial call. If you write a %OnConstructClone and from here you wish to call %ConstructClone on another object pass in the cloned array, e.g. 'Do oref.%ConstructClone(1,.cloned)' so that it can prevent recursive loops.

The location is used internally to pass the new location for stream objects.

• classmethod %DeleteExtent(concurrency As %Integer = -1, ByRef deletecount, ByRef instancecount, pInitializeExtent As %Integer = 1) as %Status
Delete all instances of this class from its extent. On exit instancecount contains the original number of instances while deletecount contains the number of instances actually deleted.

Internally, %DeleteExtent iterates over the set of instances in the collection and invokes the %Delete method.
Refer to Object Concurrency Options for more details on the optional concurrency argument.
The option pInitializeExtent argument allows the user to override the default behavior of calling %KillExtent when all instances are successfully deleted. %KillExtent is called by default when the extent is empty so that empty globals can be killed. If %KillExtent is not called then some empty globals can remain as well as the ID counter if it exists. The default value for pInitializeExtent is 1. Unless the caller specifies a false value for pInitializeExtent the globals used by the extent will be killed. In some cases, the globals used by the extent are not used exclusively by the extent. In those cases it is possible that some globals will still be defined even when pInitializeExtent is true. By default this call to %KillExtent will not delete default stream storage global, but if you pass '2' in pInitializeExtent and if the entire extent was deleted we will call %KillExtent passing the 'killstreams' flag to ask it to remove kill the default storage global.

Returns a %Status value indicating success or failure.

• private classmethod %KillExtentData(killstreams As %Boolean = 0) as %Status
%KillExtentData() - kills extent data in storage. This method is implemented by the storage class. If killstreams is true (default is false) it will also kill the default stream storage global.
• private method %OnBeforeSave(insert As %Boolean) as %Status
This callback method is invoked by the %Save method to provide notification that the object is being saved. It is called before any data is written to disk.

insert will be set to 1 if this object is being saved for the first time.

If this method returns an error then the call to %Save will fail.

• private classmethod %OnDelete(oid As %ObjectIdentity) as %Status
This callback method is invoked by the %Delete method to provide notification that the object specified by oid is being deleted.

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

• private method %OnNew(pName As %String, pDescription As %String = "") as %Status
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 AddAttribute(pWord As %String, pAttribute As %String = "UDNegation", Output pPosition) as %Status
• method AddEntry(pRewriteFrom As %String, pRewriteTo As %String, ByRef pPosition As %Integer = 0) as %Status

Adds a single entry to this User Dictionary at position. If position <= 0 (default=0), it is added at the bottom of the list, otherwise at the requested position, shifting existing entries down if it was already taken.

These changes are saved automatically. There is no need to call %Save

• method AddNegationTerm(pWord As %String, Output pPosition As %Integer) as %Status
• method AddNegativeSentimentTerm(pWord As %String, Output pPosition As %Integer) as %Status
• method AddPositiveSentimentTerm(pWord As %String, Output pPosition As %Integer) as %Status
• classmethod CheckIfManaged(pUserDict As %iKnow.UserDictionary) as %Status
Checks if the supplied User Dictionary instance is managed
• method ClearEntries() as %Status
Removes all entries from this user dictionary (only relevant for non-transient ones)
• classmethod CreateFromFile(pPath As %String) as %iKnow.UserDictionary
Creates a UserDictionary instance based on a file containing comma-separated from/to pairs on each line. The instance produced by this classmethod is transient and cannot be saved through %Save()
• classmethod CreateTransient(pName As %String = "") as %iKnow.UserDictionary
• method GetEntries(ByRef pResult) as %Status

Returns the contents of this User Dictionary in the form pResult(position) = $lb(rewriteFrom, rewriteTo).

• method GetEntry(pKey As %Integer) as %List
• method NextEntry(pKey As %Integer) as %Integer
• classmethod OpenByName(pName As %String) as %iKnow.UserDictionary

Returns a User Dictionary object by name. First, this method checks if pName is a name used by any saved User Dictionary object. If none found, it is used as a file path for the legacy file-based User Dictionaries. If there is no file at this path, "" is returned.

Note: file-based User Dictionaries are deprecated. Please use object-based ones by using %New, %Save and AddEntry.

• method RemoveEntry(pPosition As %Integer) as %Status

Removes the User Dictionary entry registered at position. This method will not impact the order or position of any remaining entries.

These changes are saved automatically. There is no need to call %Save


•index (NameIndex on Name) [Unique];
•index (PKINDEX on Id) [IdKey,PrimaryKey,Unique];
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA