new StructuredQuery(domainsopt)
Constructs structured query
Name | Type | Attributes | Description |
---|---|---|---|
domains | $k.Domain | <optional> | The domain or internal name of a type |
- Since
- 4.1.0 Represents a structured query
Extends
Methods
addAlternativeGroup() → {$k.AlternativeGroupCondition}
Add an empty alternative condition group (OR group)
- Since
- 4.2.0
addAttribute(type) → {$k.HasAttributeCondition}
Add an empty attribute condition without value/cardinality conditions
Name | Type | Description |
---|---|---|
type | AttributeType or internal name |
- Since
- 4.1.0
If the attribute cannot be found
If the type is not an attribute type
If the condition is not valid
- Type:
- $k.HasAttributeCondition
addAttributeValue(type, parameteropt, operatoropt, defaultValueopt) → {$k.AttributeValueCondition}
Add an attribute value condition
Name | Type | Attributes | Description |
---|---|---|---|
type | AttributeType or internal name | ||
parameter | <optional> | Parameter name of the value | |
operator | string | <optional> | Name of operator |
defaultValue | <optional> | Default value if no parameter is specified |
- Since
- 4.1.0
If the attribute cannot be found
If the type is not an attribute type
If the condition is not valid
addCardinality(type, cardinality, operatoropt)
Add a cardinality condition
Name | Type | Attributes | Description |
---|---|---|---|
type | AttributeType or internal name | ||
cardinality | number | Cardinality. Must be an integer >= 0. | |
operator | string | <optional> | Name of cardinality operator. One of
|
- Since
- 4.1.0
If the type cannot be found
If the type is not a property type
If the condition is not valid
HasAttribute or HasRelation condition
addElementsFilter(parameter) → {$k.ElementsCondition}
Add an element condition. Only elements from the list / parameter are returned.
Name | Type | Description |
---|---|---|
parameter | Element or array of elements or the name of a parameter to use its value |
- Since
- 4.1.0
If neither elements or a parameter was passed
If the condition is not valid
- Type:
- $k.ElementsCondition
addHandle(parameter) → {Condition}
Add a handle
Name | Type | Description |
---|---|---|
parameter | string |
- Version
- Experimental feature, might be removed at any time
- Since
- 4.1.0
- Type:
- Condition
addQueryReference(queryopt, operatoropt) → {QueryReferenceCondition}
References another query that selects elements of this query according to the operator. If $k.Operator.EQUAL or NOT_EQUAL are selected, then the reference works in both directions. If $k.Operator.FILTER is selected, then the subquery is only applied to this query.
Name | Type | Attributes | Description |
---|---|---|---|
query | <optional> | Referenced query. A new empty query will be referenced if not defined | |
operator | string | <optional> | An operator that defines how the subquery is applied. One of $k.Operator.EQUAL, NOT_EQUAL, FILTER. Default is FILTER |
- Since
- 4.1.0
If the condition is not valid
Condition for the subquery
- Type:
- QueryReferenceCondition
addRelation(type) → {$k.HasRelationCondition}
Add an empty relation condition without target/cardinality conditions
Name | Type | Description |
---|---|---|
type | RelationType or internal name |
- Since
- 4.1.0
If the relation cannot be found
If the type is not an relation type
If the condition is not valid
- Type:
- $k.HasRelationCondition
addRelationTarget(type, targetQueryopt) → {$k.RelationTargetCondition}
Add a relation target condition
Name | Type | Attributes | Description |
---|---|---|---|
type | RelationType or internal name | ||
targetQuery | <optional> | Target query. If not specified an empty subquery will be build |
- Since
- 4.1.0
If the relation cannot be found
If the type is not an relation type
If the condition is not valid
Condition for the relation target
clone() → {$k.StructuredQuery}
Returns a copy of the query. The copy can be modified.
- Since
- 4.1.0
If the query cannot be cloned
- Type:
- $k.StructuredQuery
conditions() → {Array.<QueryConditon>}
Returns the conditions of the query
- Since
- 4.1.0
- Type:
- Array.<QueryConditon>
definedParameters() → {Array.<$k.QueryParameter>}
Returns the parameters of the query
- Overrides
- Type:
- Array.<$k.QueryParameter>
deregister()
Deregisters the element. The id will be undefined afterwards. Equivalent to setId(undefined)
- Inherited From
- See
- setId
domains() → {Array.<$k.Domain>}
Returns the domains of the query
- Since
- 4.1.0
- Type:
- Array.<$k.Domain>
explainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}
Returns elements involved in the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | Elements to explain. Elements that do not match the query are ignored. | |
parameters | object | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
filterElements(elements, parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}
Returns all elements that match the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | ||
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
var hits = $k.Registry.query("experts").filterElements(persons);
filterHits(hits, parametersopt, searchStringopt) → {Array.<$k.Hit>}
Returns all hits that match the query
Name | Type | Attributes | Description |
---|---|---|---|
hits | Array.<$k.Hit> | ||
parameters | object | <optional> | |
searchString | string | <optional> |
- Since
- 5.3.0
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.Hit>
var hits = $k.Registry.query("experts").filterHits(hits);
findElements(parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}
Search and return all found semantic elements
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });
findHits(parametersopt, searchStringopt) → {Array.<$k.Hit>}
Search and return all found hits.
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.Hit>
var hits = $k.Registry.query("directSearch").findHits("Test*");
findResultSize(parametersopt, searchStringopt) → {number}
Search and return the number of found semantic elements
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Since
- 5.3.3
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- number
findSolutions(parametersopt, singleElementIdentifiersopt) → {Array.<object>}
Search and return all solutions
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
singleElementIdentifiers | array | <optional> |
- Since
- 5.2.2
When the query could not be solved, e.g. missing parameters
Each solution is an object containing an element of the result set, and all elements at identifiers of the query, e.g. {element: element1, identifiers: { someIdentifier1: [ element2, ... ], someIdentifier2: [ element3, ... ] }}
. Each identifier in singleElementIdentifiers will be distribute multiple elements to one separate solution each
- Type:
- Array.<object>
fullExplainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}
Returns all elements involved in the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | Elements to full explain. Elements that do not match the query are ignored. | |
parameters | object | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
handleConditions(handle) → {Array.<$k.QueryCondition>}
Name | Type | Description |
---|---|---|
handle | string |
- Version
- Experimental feature, might be removed at any time
- Since
- 5.4.2
Handle conditions with the given handle
- Type:
- Array.<$k.QueryCondition>
id() → {string}
Returns the registered ID, or undefined if not registered.
- Inherited From
- Type:
- string
inheritance() → {boolean}
Returns true if elements of subdomains should be returned
- Since
- 4.1.0
- Type:
- boolean
inverseConditions() → {Array.<QueryConditon>}
Returns the conditions pointing to this query
- Since
- 4.1.0
- Type:
- Array.<QueryConditon>
name() → {string}
Returns the name
- Overrides
- Type:
- string
parentFolders() → {Array.<$k.Folder>}
Returns the folders that contain this element
- Inherited From
- Type:
- Array.<$k.Folder>
registryType() → {string}
Returns the name of the registry that contains elements of this type
- Inherited From
- Type:
- string
renderElements(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}
Search and render found semantic elements using the given table configuration
Name | Type | Attributes | Description |
---|---|---|---|
tableConfiguration | $k.TableConfiguration | ||
keyFilter | object | <optional> | Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters(). |
detailFilter | object | <optional> | Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail() |
- Since
- 4.1.0
- Overrides
- Deprecated
- This function is deprecated and might be removed in future releases
When the query could not be solved, e.g. missing parameters
The rendered objects
- Type:
- Array.<object>
renderHits(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}
Search and render found hits using the given table configuration
Name | Type | Attributes | Description |
---|---|---|---|
tableConfiguration | $k.TableConfiguration | ||
keyFilter | object | <optional> | Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters(). |
detailFilter | object | <optional> | Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail() |
- Since
- 4.1.0
- Overrides
- Deprecated
- This function is deprecated and might be removed in future releases
When the query could not be solved, e.g. missing parameters
The rendered objects
- Type:
- Array.<object>
searchString() → {string}
Returns the search string
- Overrides
- Type:
- string
setAccessParameter(accessParameter, value)
Set a parameter of the query.
Name | Type | Description |
---|---|---|
accessParameter | string | One of the access parameters ("topic", "property", "accessedObject", "concept", "user" etc) |
value | The value of the parameter. The type (string etc.) depends on the parameter. Arrays of values can be passed, too. The value undefined or null disables the parametrized condition. |
When the value is not suitable for the parameter
setAlternatives(conditions)
Set the conditions as alternatives (OR group). If <= 1 conditions are passed this will be a no-op.
Name | Type | Description |
---|---|---|
conditions | Array.<$k.QueryCondition> | Conditions of this query that should be alternatives |
- Since
- 4.1.0
- Deprecated
- Use
addAlternativeGroup()
instead
- Use
If the conditions cannot be alternatives of this query
setDomain(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains | $k.Domain | The domain or internal name of a type |
- Since
- 4.1.0
- Overrides
setDomains(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains | Array.<$k.Domain> | The domains or internal names of types |
- Overrides
setFacetFilters(facetFiltersArray)
Set the selected facets and terms for the query
Name | Type | Description |
---|---|---|
facetFiltersArray | array | Array with selected facets and terms |
- Since
- 5.1.3
- Overrides
setId(id, replaceScriptReferences)
Registers the element with the given ID. If the element has already been registered, then the id changes. If the id is undefined, then the element will be deregistered.
Name | Type | Description |
---|---|---|
id | string | The ID |
replaceScriptReferences | boolean | True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined. |
- Inherited From
setInheritance(useInheritance)
Set to false if elements of subdomains should not be returned
Name | Type | Description |
---|---|---|
useInheritance | boolean |
- Since
- 4.1.0
setMergeCauses(mergeCauses)
Determines whether causes should be merged when filtering hits
Name | Type | Description |
---|---|---|
mergeCauses | boolean |
- Version
- Experimental feature, might be removed at any time
- Since
- 5.3.0
setName(name)
Sets the name of the query
Name | Type | Description |
---|---|---|
name | string | The name |
- Version
- Experimental feature, might be removed at any time
- Since
- 5.3.2
- Overrides
setParameter(parameterId, value)
Set a parameter of the query.
Name | Type | Description |
---|---|---|
parameterId | string | The ID of the parameter |
value | The value of the parameter. The type (string etc.) depends on the parameter. Arrays of values can be passed, too. The value undefined or null disables the parametrized condition. |
- Overrides
When the value is not suitable for the parameter
setParameters(parameters)
Set the parameters of the query from the properties of the object
Name | Type | Description |
---|---|---|
parameters | The parameters |
- Overrides
When a value is not a suitable parameter
setSearchString(searchString)
Set the string to search for
Name | Type | Description |
---|---|---|
searchString | string |
- Overrides