Skip to main content

%iKnow.Queries.CrcAPI

Class %iKnow.Queries.CrcAPI Extends %iKnow.Queries.AbstractAPI [ Deprecated, System = 4 ]

The InterSystems IRIS NLP iKnow technology is now deprecated. Please see the product documentation for more detail.

This is the main Query API to retrieve Concept-Relation-Concept triples (CRCs). In a CRC, the first concept is called the Head and the last the Tail, which are linked to one another through the Relation element.

Parameters

GetValueRT

Parameter GetValueRT = "head:%String,relation:%String,tail:%String";

GetByEntitiesRT

Parameter GetByEntitiesRT = "crcId:%Integer,head:%String,relation:%String,tail:%String,frequency:%Integer,spread:%Integer";

GetByEntityIdsRT

Parameter GetByEntityIdsRT = "crcId:%Integer,head:%String,relation:%String,tail:%String,frequency:%Integer,spread:%Integer";

GetTopRT

Parameter GetTopRT = "crcId:%Integer,head:%String,relation:%String,tail:%String,freq:%Integer,spread:%Integer";

GetByFilterRT

Parameter GetByFilterRT = "crcId:%Integer,head:%String,relation:%String,tail:%String,frequency:%Integer,spread:%Integer";

GetBySourceRT

Parameter GetBySourceRT = "crcId:%Integer,head:%String,relation:%String,tail:%String,frequency:%Integer,spread:%Integer";

GetOccurrencesBySourceRT

Parameter GetOccurrencesBySourceRT = "crcOccId:%Integer,crcUniId:%Integer,head:%String,relation:%String,tail:%String,sentenceId:%Integer,posInSent:%Integer";

Methods

GetValue

ClassMethod GetValue(domainid As %Integer, crcid As %Integer, vSrcId As %Integer = 0) As %List

Returns the entity values this CRC is composed of.

When specifying a Virtual Source ID, it will treat the crcid as a virtual one, in the context of that vSrcId.

GetValueInternal

ClassMethod GetValueInternal(domainid As %Integer, crcid As %Integer, vSrcId As %Integer = 0) As %List [ Internal ]

Internal version of GetValue, skipping security checks.

GetId

ClassMethod GetId(domainid As %Integer, head As %String, relation As %String, tail As %String, vSrcId As %Integer = 0) As %Integer

Returns, if any, the CRC ID for the combination of Head, Relation and Tail specified.

When specifying a Virtual Source ID, it will treat the head, relation and tails as virtual entities, in the context of that vSrcId.

GetIdInternal

ClassMethod GetIdInternal(domainid As %Integer, ByRef head As %String, ByRef relation As %String, ByRef tail As %String, vSrcId As %Integer = 0, stripPunctuation As %Boolean = 1) As %Integer [ Internal ]

Internal version of GetId

GetFrequency

ClassMethod GetFrequency(domainId As %Integer, crcUniId As %Integer, vSrcId As %Integer = 0, filter As %iKnow.Filters.Filter = "", Output sc As %Status = {$$$OK}) As %Integer

Returns the frequency of the CRC corresponding to the supplied crcUniId.

When specifying a Virtual Source ID, the frequency within the virtual source will be returned.

GetSpread

ClassMethod GetSpread(domainId As %Integer, crcUniId As %Integer, filter As %iKnow.Filters.Filter = "", Output sc As %Status = {$$$OK}) As %Integer

Returns the spread of the CRC corresponding to the supplied crcUniId.

GetByEntities

ClassMethod GetByEntities(ByRef result, domainid As %Integer, entitylist As %List, page As %Integer = 1, pagesize As %Integer = 10, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}, positionstomatch As %Integer = {$$$USEPOSALL}, pActualFormOnly As %Boolean = 0) As %Status

This method will return all CRC triples in which any of the entities supplied in the entitylist participate, within the boundaries of the supplied domain.

The scope of this query can be limited through supplying a %iKnow.Filters.Filter object for the filter parameter to restrict the result to those CRCs occurring in any source satisfying the filter criteria. When using a filter, the filtermode parameter will control whether or not the frequency and spread of returned records should be recalculated and whether results should be resorted along these recalculated numbers.

Specifying a value for positionstomatch will limit the result to those CRCs in which the supplied entities are in the Head (with positionstomatch = $$$USEPOSH), Relation (with positionstomatch = $$$USEPOSR) or Tail (with positionstomatch = $$$USEPOST) role of the CRC, or in any combination of these (with positionstomatch = $$$USEPOSHT, $$$USEPOSHR, $$$USEPOSRT, $$$USEPOSALL (the default)).

If stemming is enabled for this domain through $$$IKPSTEMMING, CRCs containing any actual form of the entities in entityList will be returned. Use pActualFormOnly=1 to retrieve only those CRCs containing the actual forms in entitylist. This argument is ignored if stemming is not enabled.

GetByEntityIds

ClassMethod GetByEntityIds(ByRef result, domainid As %Integer, entityidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}, positionstomatch As %Integer = {$$$USEPOSALL}, pActualFormOnly As %Boolean = 0) As %Status

Returns the CRCs in this domain containing any or all of a list of entity IDs.

See also GetByEntities for a description of the parameters.

GetByEntitiesInternal

ClassMethod GetByEntitiesInternal(ByRef result, domainid As %Integer, ByRef entitylist, page As %Integer, pagesize As %Integer, filter As %iKnow.Filters.Filter, filtermode As %Integer, positionstomatch As %Integer) As %Status [ Internal ]

GetTop

ClassMethod GetTop(ByRef result, domainid As %Integer, page As %Integer = 1, pagesize As %Integer = 10, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}, sorttype As %Integer = {$$$SORTBYDOMAINDEFAULT}, vSrcId As %Integer = 0) As %Status

Returns the most frequently occurring CRCs for this domain, sorted by descending frequency (with sorttype $$$SORTBYFREQUENCY), spread (with sorttype $$$SORTBYSPREAD) or the domain default (with sorttype $$$SORTBYDOMAINDEFAULT).

The scope of this query can be limited through supplying a %iKnow.Filters.Filter object for the filter parameter to restrict the result to those CRCs occurring in any source satisfying the filter criteria. When using a filter, the filtermode parameter will control whether or not the frequency and spread of returned records should be recalculated and whether results should be resorted along these recalculated numbers.

If a Virtual Source ID is provided, only the entities in that virtual source will be considered, filters are ignored and the sort type will always be $$$SORTBYFREQUENCY.

GetByFilter

ClassMethod GetByFilter(ByRef result, domainid As %Integer, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}) As %Status

Returns all CRCs appearing in any source satisfying the supplied filter objects criteria, with their frequencies and spread recalculated to comply with the filter depending on the value of filtermode, but the result is NOT re-sorted, regardless of the value for filtermode (use GetTop if you want sorted results).

GetByFilterInternal

ClassMethod GetByFilterInternal(ByRef result, domainid As %Integer, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}, sortIndex As %Integer = -1) As %Status [ Internal ]

sortIndex = -1 means regular output, otherwise an additional first subscript will be introduced to sort by frequency ($$$SORTBYFREQUENCY) or spread ($$$SORTBYSPREAD): result(-sort, entUniId) WARNING: for internal use only, no input checking is performed!

GetByFilterInternal20121

ClassMethod GetByFilterInternal20121(ByRef result, domainid As %Integer, filter As %iKnow.Filters.Filter = "", filtermode As %Integer = {$$$FILTERONLY}, sortIndex As %Integer = -1) As %Status [ Internal ]

GetBySource

ClassMethod GetBySource(ByRef result, domainid As %Integer, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10) As %Status

Returns the unique CRCs appearring in the specified sources.

To get the unique CRCs of a virtual source, only a single virtual source can be supplied using its negative ID value (otherwise, -1 is returned).

GetCountByDomain

ClassMethod GetCountByDomain(domainid As %Integer, filter As %iKnow.Filters.Filter = "", Output sc As %Status = {$$$OK}, includeZeroFrequency As %Boolean = 0) As %Integer

Returns the total number of unique CRCs in a domain, optionally limited through supplying a %iKnow.Filters.Filter object as the filter parameter to restrict the result to those CRCs occurring in any source satisfying the filter criteria.

GetCountBySource

ClassMethod GetCountBySource(domainid As %Integer, sourceidlist As %List, setop As %Integer = {$$$UNION}, Output sc As %Status = {$$$OK}) As %Integer

Returns the total number of unique CRCs appearing in either (if setop = $$$UNION) or all (if setop = $$$INTERSECT) of the sources specified by ID in sourceidlist.

To get the unique CRCs of a virtual source, only a single virtual source can be supplied using its negative ID value (otherwise, -1 is returned).

GetOccurrenceCountBySource

ClassMethod GetOccurrenceCountBySource(domainid As %Integer, sourceidlist As %List, Output sc As %Status = {$$$OK}) As %Integer

Returns the total number of CRC occurrences in the specified sources.

Use negative source IDs to refer to virtual sources

GetOccurrencesBySource

ClassMethod GetOccurrencesBySource(ByRef result, domainid As %Integer, srcid As %Integer, page As %Integer = 1, pagesize As %Integer = 10) As %Status

Returns the CRC occurrences for a given source, in the order in which they appear.

GetCountByEntities

ClassMethod GetCountByEntities(domainid As %Integer, entitylist As %List, filter As %iKnow.Filters.Filter = "", positionstomatch As %Integer = {$$$USEPOSALL}, Output sc As %Status = {$$$OK}, pActualFormOnly As %Boolean = 0) As %Integer

Returns the number of CRCs in this domain, based on a list of entities.

See also GetByEntities for a description of the parameters.

GetCountByEntityIds

ClassMethod GetCountByEntityIds(domainid As %Integer, entityidlist As %List, filter As %iKnow.Filters.Filter = "", positionstomatch As %Integer = {$$$USEPOSALL}, Output sc As %Status = {$$$OK}, pActualFormOnly As %Boolean = 0) As %Integer

Returns the number of CRCs in this domain, based on a list of entity IDs.

See also GetByEntities for a description of the parameters.

GetCountByEntitiesInternal

ClassMethod GetCountByEntitiesInternal(domainid As %Integer, ByRef entityIdList, filter As %iKnow.Filters.Filter, positionstomatch As %Integer, Output sc As %Status = {$$$OK}) As %Integer [ Internal ]

TranslateCrcList

ClassMethod TranslateCrcList(domainid As %Integer, crclist As %List, globName As %String = "^||%IK.CrcIds", vSrcId As %Integer = 0, Output unMatchedCount As %Integer) As %Status [ Internal ]

translate a list of CRCs in their full-text $lb representation to CrcUniIds, removing inexistent crcs and duplicates

TranslateCrcIdList

ClassMethod TranslateCrcIdList(domainid As %Integer, crcIdList As %List, globName As %String = "^||%IK.CrcIds", vSrcId As %Integer = 0, Output unMatchedCount As %Integer) As %Status [ Internal ]

clean a list of CrcUniIds from duplicates and inexistent ids

TranslateMRSMaskToCrcIdList

ClassMethod TranslateMRSMaskToCrcIdList(domainid As %Integer, head As %String = {$$$WILDCARD}, relation As %String = {$$$WILDCARD}, tail As %String = {$$$WILDCARD}, globName As %String = "^||%IK.CrcIds", vSrcId As %Integer = 0, pIncludeAllForms As %Boolean = 0) As %Status [ Internal ]