1 /*global $k*/ 2 3 /** 4 * @class Represents a query 5 * @extends $k.FolderElement 6 **/ 7 $k.Query = function() { }; 8 9 /** 10 * Returns the parameters of the query 11 * 12 * @function 13 * @returns {$k.QueryParameter[]} 14 * @see $k.Query#setParameter 15 **/ 16 $k.Query.prototype.definedParameters = function() { }; 17 18 /** 19 * Returns all elements involved in the query 20 * 21 * @function 22 * @param {$k.SemanticElement[]} elements Elements to explain. Elements that do not match the query are ignored. 23 * @param {object} [parameters] 24 * @returns {$k.SemanticElement[]} 25 * @throws {$k.exception.QueryError} When the query could not be solved, e.g. missing parameters 26 * @see $k.Query#setParameter 27 **/ 28 $k.Query.prototype.explainElements = function(elements, parameters) { }; 29 30 /** 31 * Returns all elements that match the query 32 * 33 * @function 34 * @param {$k.SemanticElement[]} elements 35 * @param {object} [parameters] 36 * @param {string} [searchString] 37 * @returns {$k.SemanticElement[]} 38 * @throws {$k.exception.QueryError} When the query could not be solved, e.g. missing parameters 39 * @example var hits = $k.Registry.query("experts").filterElements(persons); 40 * @see $k.Query#setParameter 41 **/ 42 $k.Query.prototype.filterElements = function(elements, parameters, searchString) { }; 43 44 /** 45 * Search and return all found semantic elements 46 * 47 * @function 48 * @param {object} [parameters] 49 * @param {string} [searchString] 50 * @returns {$k.SemanticElement[]} 51 * @throws {$k.exception.QueryError} When the query could not be solved, e.g. missing parameters 52 * @example var hits = $k.Registry.query("directSearch").findHits("Test"); 53 * @example var hits = $k.Registry.query("compositeSearch").findHits("Test", { context: "portal" }); 54 * @see $k.Query#setParameter 55 **/ 56 $k.Query.prototype.findElements = function(parameters, searchString) { }; 57 58 /** 59 * Search and return all found hits. 60 * 61 * @function 62 * @param {object} [parameters] 63 * @param {string} [searchString] 64 * @returns {$k.Hit[]} 65 * @throws {$k.exception.QueryError} When the query could not be solved, e.g. missing parameters 66 * @example var hits = $k.Registry.query("directSearch").findHits("Test*"); 67 * @see $k.Query#setParameter 68 **/ 69 $k.Query.prototype.findHits = function(parameters, searchString) { }; 70 71 /** 72 * Returns the name 73 * 74 * @function 75 * @returns {string} 76 **/ 77 $k.Query.prototype.name = function() { }; 78 79 /** 80 * Returns the search string 81 * 82 * @function 83 * @returns {string} 84 **/ 85 $k.Query.prototype.searchString = function() { }; 86 87 /** 88 * Restrict the query results to objects/types of the domains 89 * 90 * @function 91 * @param {$k.Domain[]} domains The domains 92 **/ 93 $k.Query.prototype.setDomains = function(domains) { }; 94 95 /** 96 * Set a parameter of the query. 97 * 98 * @function 99 * @param {string} parameterId The ID of the parameter 100 * @param 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. 101 * @throws {$k.exception.TypeError} When the value is not suitable for the parameter 102 **/ 103 $k.Query.prototype.setParameter = function(parameterId, value) { }; 104 105 /** 106 * Set the parameters of the query from the properties of the object 107 * 108 * @function 109 * @param parameters The parameters 110 * @throws {$k.exception.TypeError} When a value is not a suitable parameter 111 * @see $k.Query#setParameter 112 **/ 113 $k.Query.prototype.setParameters = function(parameters) { }; 114 115 /** 116 * Set the string to search for 117 * 118 * @function 119 * @param {string} searchString 120 **/ 121 $k.Query.prototype.setSearchString = function(searchString) { }; 122 123