query-cluster
The SOAP name of this function is: QueryCluster
Synopsis
tree nodeset query-cluster(query-object, documents, stemmers, kbs, inline-kbs, segmenter, depth);
operator nodeset query-object;
document nodeset documents;
string stemmers;
string kbs;
kb nodeset inline-kbs;
string segmenter;
int depth;
string stream;
string stream-log4j-configuration;
string stream-jvm-options;
Parameters
- operator nodeset query-object - A query object (similar to the object obtained by parsing the query string according to the syntax). This query object is convenient to pass programmatically generated queries. When both a query string and a query object are specified they are combined with an "and" operator. It is perfectly fine to specify both (to combine a user generated query with a programmatic condition for example).
- document nodeset documents - A list of document for which to return clusters.
- string stemmers - Space separated list of stemmers to use for clustering and near-deduplication. Multiple stemmers can be combined. For example: dutch french applies the Dutch stemmer, and then, if that stemmer did not stem the word, the French stemmer. See the main documentation for the list of currently supported stemmers. Default value: delanguage english depluralize.
- string kbs - Space separated list of knowledge bases to use for clustering and near-deduplication (predefined or user defined). If the same word appears in more than one knowledge base, the knowledge base listed last is used. For example, with "english german" both knowledge bases contain die, but the entry in the German knowledge base takes priority since it is listed last. See the main documentation for the list of currently predefined knowledge bases. Default value: core web english custom.
- kb nodeset inline-kbs - A collection of knowledge bases to use for clustering and near-deduplication. These knowledge bases will be applied after the knowledge bases specified only by name. Unlike the knowledge bases specified only by name, the rules in these knowledge bases apply only to this particular call, making them well suited for rapidly changing rules or rules that should not apply globally.
- string segmenter - Specifies the segmenter to use for clustering and near-deduplication. A segmenter is used to take sequential utterances in non-segmented languages (for example, Japanese or Chinese) languages and divide the utterance into the individual components (or words). See the main documentation for the list of currently supported segmenters. Default value: none.
- int depth - Sets the depth to which clusters should be returned. Default value: 1.
- string stream - A stream, represented as a string, to use for clustering. For example, with this configuration option you can use a <content-analytics-stream> to perform clustering. This parameter should not be used to override the stemmer, segmenter, and knowledge base options.
- string stream-log4j-configuration - The logging (log4j) configuration to use if using a lexical analysis stream.
- string stream-jvm-options - The JVM arguments to use if using a lexical analysis stream.
Return Value
- tree nodeset
Exceptions
- There are no exceptions specific to this function.
Authentication
Like all Watson Explorer Engine API functions except for ping, the query-cluster function requires authentication.
When using REST, you can simply pass v.username and v.password as CGI parameters via HTTP or HTTPS to authenticate the REST call to the query-cluster function.
When using the SOAP API, you can pass credentials as parameters on an endpoint, or you can leverage the authentication method that is supported by all Watson Explorer Engine functions. Each provides a setAuthentication method that can be passed an authentication object to provide the user name and password under which a function runs. An example of this in Java for a SOAP call to the query-cluster function is the following:
Authentication authentication = new Authentication();
authentication.setUsername("joe-user");
authentication.setPassword("joes-password");
QueryCluster foo = new QueryCluster();
foo.setAuthentication(authentication);
A single authentication object would typically be reused throughout each individual application.