Skip to main content

%iKnow.Utils.CopyUtils

class %iKnow.Utils.CopyUtils extends %Library.RegisteredObject

This utility class groups a few methods to easily copy the contents of a domain into another one (which doens't necessarily have to be empty).

Please note any domain elements copied will be created using the version of the target domain, regardless of the source domain's version number.

Method Inventory

Methods

classmethod CopyBlackLists(pFromDomainId As %Integer, pToDomainId As %Integer, pVerbose As %Boolean = 1, pIgnoreDuplicates As %Boolean = 1) as %Status

Copies any BlackList definitions and their contents from the domain identified by ID pFromDomainId into domain pToDomainId. If a BlackList with the same name already exists in the target domain, pIgnoreDuplicates=0 will cause an error to be thrown, whereas pIgnoreDuplicates=1 will mean the BlackList in the target domain will be extended with the strings in the BlackList from the source domain.

classmethod CopyDictionaries(pFromDomainId As %Integer, pToDomainId As %Integer, pVerbose As %Boolean = 1, pIgnoreDuplicates As %Boolean = 1, pCopyProfiles As %Boolean = 1) as %Status

Copies any dictionaries and matching profiles (if pCopyProfiles is true) from the domain identified by ID pFromDomainId into domain pToDomainId. If a dictionary, item or profile with the same name already exists, pIgnoreDuplicates=0 will cause an error to be thrown, whereas pIgnoreDuplicates=1 will mean the element in the target domain will be left as is, but extended with the items and terms of the element in the source domain.

classmethod CopyDictionary(pFromDomainId As %Integer, pToDomainId As %Integer, pDictionaryId As %Integer, pVerbose As %Boolean = 1, pIgnoreDuplicates As %Boolean = 1, ByRef pProfileMap="") as %Status

Copies a single dictionary (identified by pDictionaryId from the domain identified by ID pFromDomainId into domain pToDomainId. If a dictionary or item with the same name already exists, pIgnoreDuplicates=0 will cause an error to be thrown, whereas pIgnoreDuplicates=1 will mean the element in the target domain will be left as is, but extended (in the case of a dictionary or item) with the items and terms of the element in the source domain.

An array of matching profile IDs can be passed in through pProfileMap to map any default matching profiles from the source domain to IDs of the corresponding profiles in the target domain.

classmethod CopyDomain(pFromDomain As %String, pToDomain As %String, pCopySources As %Boolean = 1, pCopySettings As %Boolean = 1, pCopyDictionaries As %Boolean = 1, pMatchCopy As %Boolean = 1, pVerbose As %Boolean = 1, pUseConfiguration As %String = "", pCopyMetrics As %Integer = 1) as %Status

Copies all contents from the domain named pFromDomain into the domain pToDomain. If pToDomain does not yet exist, it will be created automatically. The copy flags represent the following domain elements:

  • pCopySources includes regular source content as well as metadata (if the corresponding metadata fields exist in pToDomain or are created through pCopySettings. See also %iKnow.Source.Domain.Lister
  • pCopySettings includes domain parameters, metadata, LOVs and blacklists
  • pCopyDictionaries includes dictionaries, their items and terms and any domain-specific matching profiles. If pMatchCopy is 1 as well, all sources in the target domain will be matched against all dictionaries.
  • pCopySettings includes domain parameters, metadata and blacklists
  • if pCopyMetrics>0, all metric definitions are copied and if pCopyMetrics>1, all metric values are copied along

This method relies on the other class methods in this class and uses a value of 1 for pIgnoreDuplciates when calling these methods.

If required, a specific iKnow Configuration name (cf %iKnow.Configuration) can be supplied through pUseConfiguration to use while re-indexing the data. If this parameter is left blank (default), the default configuration of the original domain (configured using the $$$IKPDEFAULTCONFIG domain parameter) or $$$DEFAULTCONFIG will be used.

Note: if pCopySettings is true, only domain parameters a user is allowed to modify will be copied!!

classmethod CopyMatchingProfile(pFromDomainId As %Integer, pToDomainId As %Integer, pProfileId As %Integer, pVerbose As %Boolean = 1, Output pNewProfileId As %Integer = 0) as %Status

Copies a single Matching Profile (identified by pProfileId) from the domain identified by ID pFromDomainId into domain pToDomainId. If a profile with the same name already exists in the target domain, pIgnoreDuplicates=0 will cause an error to be thrown, whereas pIgnoreDuplicates=1 will mean the metadata field in the target domain will be left as is.

classmethod CopyMetadataFields(pFromDomainId As %Integer, pToDomainId As %Integer, pVerbose As %Boolean = 1, pIgnoreDuplicates As %Boolean = 1) as %Status

Copies any metadata field definitions and List of Values from the domain identified by ID pFromDomainId into domain pToDomainId. If a field with the same name already exists in the target domain, pIgnoreDuplicates=0 will cause an error to be thrown, whereas pIgnoreDuplicates=1 will mean the metadata field in the target domain will be left as is.

classmethod CopyMetric(pFromDomainId As %Integer, pToDomainId As %Integer, pMetricId As %Integer, pPreserveOffsets As %Boolean = 0, pVerbose As %Boolean = 1) as %Status
Copies a Metric Definition from one domain to another. No values are copied. WARNING: only use pPreserveOffsets when copying metrics into a domain that didn't have any metric targets registered.
classmethod CopyMetrics(pFromDomainId As %Integer, pToDomainId As %Integer, pCopyValues As %Boolean = 0, pVerbose As %Boolean = 1) as %Status

Copies all metric definitions from one domain to another, optionally including their values.

WARNING: only Entity-, CRC-, CC- and source-based metric data can be copied from one domain to another. Use the metrics' builder class to (re-)generate metric values for path- or sentence-based metrics.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab