DocBook|Search
Class Reference
%iKnow.Queries.SentenceAPI
   
Server:basexml
Instance:SOAXML
User:UnknownUser
 
-
  [BASEXML] >  [%iKnow] >  [Queries] >  [SentenceAPI]
Private  Storage  

class %iKnow.Queries.SentenceAPI extends %iKnow.Queries.AbstractAPI

Main Query API class to retrieve sentence information.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
9 28


Summary

Methods
%%OIDGet %AddToSaveSet %ClassIsLatestVersion %ClassName
%ConstructClone %DispatchClassMethod %DispatchGetModified %DispatchGetProperty
%DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty
%Extends %GetParameter %IsA %IsModified
%New %NormalizeObject %ObjectModified %OriginalNamespace
%PackageName %RemoveFromSaveSet %SerializeObject %SetModified
%ValidateObject GetByCrcIds GetByCrcMask GetByCrcs
GetByEntities GetByEntityIds GetByPathIds GetBySource
GetCountByCrcIds GetCountByCrcMask GetCountByCrcs GetCountByDomain
GetCountByEntities GetCountByEntityIds GetCountByPathIds GetCountBySource
GetLanguage GetNewBySource GetPartLiteral GetParts
GetPosition GetSourceId GetValue


Parameters

• parameter GetByCrcIdsRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetByCrcMaskRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetByCrcsRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetByEntitiesRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetByEntityIdsRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetByPathIdsRT = "srcId:%Integer,externalId:%String,sentId:%Integer,sentenceValue:%String";
• parameter GetBySourceRT = "sentId:%Integer,sentenceValue:%String,sentenceIsTruncated:%Boolean";
• parameter GetNewBySourceRT = "sentId:%Integer,sentenceValue:%String,score:%Numeric";
• parameter GetPartsRT = "entOccId:%Integer,entUniId:%Integer,literal:%String,role:%Integer";

Methods

• classmethod GetByCrcIds(ByRef result, domainid As %Integer, crcidlist As %List, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, setop As %Integer = $$$UNION) as %Status

Retrieves all sentences containing the given CRC ids.

See also GetByEntities for a description of the parameters.

• classmethod GetByCrcMask(ByRef result, domainid As %Integer, master As %String = $$$WILDCARD, relation As %String = $$$WILDCARD, slave As %String = $$$WILDCARD, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, setop As %Integer = $$$UNION) as %Status

Retrieves all sentences containing a CRC satisfying the given CRC Mask.

See also GetByEntities for a description of the parameters.

• classmethod GetByCrcs(ByRef result, domainid As %Integer, crclist As %List, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, setop As %Integer = $$$UNION) as %Status

Retrieves all sentences containing the given CRCs.

See also GetByEntities for a description of the parameters.

• classmethod GetByEntities(ByRef result, domainid As %Integer, entitylist As %List, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, setop As %Integer = $$$UNION) as %Status

This method will retrieve all sentences containing any (if setop = $$$UNION) or all (if setop = $$$INTERSECT) of the entities supplied through entitylist, within the list of sources supplied through sourceidlist.

• classmethod GetByEntityIds(ByRef result, domainid As %Integer, entityidlist As %List, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10, setop As %Integer = $$$UNION) as %Status

Retrieves all sentences containing the given entity IDs.

See also GetByEntities for a description of the parameters.

• classmethod GetByPathIds(ByRef result, domainid As %Integer, pathidlist As %List, sourceidlist As %List, page As %Integer = 1, pagesize As %Integer = 10) as %Status

Retrieves all sentences containing the given path IDs.

See also GetByEntities for a description of the parameters.

• classmethod GetBySource(ByRef result, domainid As %Integer, sourceid As %Integer, page As %Integer = 1, pagesize As %Integer = 10) as %Status
Returns the sentences for the given source. A negative source ID is interpreted as a Virtual Source.
• classmethod GetCountByCrcIds(domainid As %Integer, crcidlist As %List, sourceidlist As %List, setop As %Integer = $$$UNION, Output sc As %Status = $$$OK) as %Integer

Retrieves the number of sentences containing the given CRC ids.

See also GetByEntities for a description of the parameters.

• classmethod GetCountByCrcMask(domainid As %Integer, master As %String = $$$WILDCARD, relation As %String = $$$WILDCARD, slave As %String = $$$WILDCARD, sourceidlist As %List, setop As %Integer = $$$UNION, Output sc As %Status = $$$OK) as %Integer

Retrieves the number of sentences containing a CRC satisfying the given CRC Mask.

See also GetByEntities for a description of the parameters.

• classmethod GetCountByCrcs(domainid As %Integer, crclist As %List, sourceidlist As %List, setop As %Integer = $$$UNION, Output sc As %Status = $$$OK) as %Integer

Retrieves the number of sentences containing the given CRCs.

See also GetByEntities for a description of the parameters.

• classmethod GetCountByDomain(domainid As %Integer, filter As %iKnow.Filters.Filter = "", Output sc As %Status = $$$OK) as %Integer

Returns the total number of sentences for a given domain, optionally filtered to those sources satisfying a %iKnow.Filters.Filter object passed in through filter.

• classmethod GetCountByEntities(domainid As %Integer, entitylist As %List, sourceidlist As %List, setop As %Integer = $$$UNION, Output sc As %Status = $$$OK) as %Integer

Retrieves the number of sentences containing the given entities.

See also GetByEntities for a description of the parameters.

• classmethod GetCountByEntityIds(domainid As %Integer, entityidlist As %List, sourceidlist As %List, setop As %Integer = $$$UNION, Output sc As %Status = $$$OK) as %Integer

Retrieves the nubmer of sentences containing the given entity ids.

See also GetByEntities for a description of the parameters.

• classmethod GetCountByPathIds(domainid As %Integer, pathidlist As %List, sourceidlist As %List, Output sc As %Status = $$$OK) as %Integer

Retrieves the number of sentences containing the given path IDs.

See also GetByEntities for a description of the parameters.

• classmethod GetCountBySource(domainid As %Integer, sourceidlist As %List, Output sc As %Status = $$$OK) as %Integer

Returns the total number of sentences for the given sources. Negative Source IDs are interpreted as referring to Virtual Sources.

• classmethod GetLanguage(domainid As %Integer, sentenceid As %Integer, Output confidence As %Numeric = "", vSrcId As %Integer = 0) as %String

Retrieves the language of the given sentence, as derived by the Automatic Language Identification algorithm or, if ALI was disabled, the language specified when indexing this sentence.

The confidence level is returned as well through an output parameter. If the confidence level is 0, this means ALI was not used and the language was defined by the user loading the source.

If a Virtual Source ID is specified, the sentence ID is treated as a virtual one, in the context of the supplied vSrcId.

• classmethod GetNewBySource(ByRef result, domainid As %Integer, sourceid As %Integer, length As %Integer = 5, filter As %iKnow.Filters.Filter = "", algorithm As %String = $$$NEWENTSIMPLE, algorithmParams As %List = "", newEntitiesWindow As %Integer = 100, blackListIds As %List = "") as %Status

Retrieves the sentences with the most significant concepts compared to the rest of the domain (or optionally a subset thereof as filtered through filter). This list of sentences is based on results of the GetNewBySource query in %iKnow.Queries.EntityAPI, using the supplied algorithm and parameter values. The scores of the first [newEntitiesWindow] concepts are aggregated across sentences to produce the result of this query.

Please refer to the documentation of the GetNewBySource query in %iKnow.Queries.EntityAPI for more details on the parameters and available algorithms.

• classmethod GetPartLiteral(domainId As %Integer, sentenceId As %Integer, position As %Integer) as %String
Returns the literal of the entity or nonrelevant at the specified position.
• classmethod GetParts(ByRef result, domainid As %Integer, sentenceid As %Integer, includeCRCMarkers As %Boolean = 0, includePathMarkers As %Boolean = 0, vSrcId As %Integer = 0) as %Status

Returns the elements (concepts, relations and nonrelevants) that make up the sentence, optional including markers for the beginning and end of any CRCs or Paths in the sentence. This information can be used to display the sentence value (see also GetValue) and/or highlight specific elements of interest.

Output structure:
result(pos) = $lb(entOccId, entUniId, entity, role)
when includeCRCMarkers = 1, adds
result(pos, [CRCMASTER | CRCRELATION | CRCSLAVE]) = $lb(crcOccId, crcUniId)
when includePathMarkers = 1, adds
result(pos, [PATHBEGIN | PATHEND]) = $lb(pathId)

Note: the subscript levels for CRC and Path markers are not available in the QAPI and WSAPI versions of this query.

If a Virtual Source ID is specified, the sentence ID is treated as a virtual one, in the context of the supplied vSrcId.

• classmethod GetPosition(domainId As %Integer, sentenceId As %Integer) as %Integer
Returns the position within the source this sentence occurs at (1-based).
• classmethod GetSourceId(domainId As %Integer, sentenceId As %Integer) as %Integer
Returns the source ID in which the supplied sentence ID occurs
• classmethod GetValue(domainid As %Integer, sentenceid As %Integer, Output fullSentence As %Boolean = 1, vSrcId As %Integer = 0) as %String

This method rebuilds a sentence based on the literals and entities it is composed of.

The string returned is the first part, up to the maximum string length, whereas the output parameter fullSentence is an array containing all the parts in the right order, containing a %Boolean value at the top level indicating whether the returned string is the full sentence (1) or (if 0) the user should have to look into this array to learn the full sentence.

If a Virtual Source ID is specified, the sentence ID is treated as a virtual one, in the context of the supplied vSrcId.