Get the argmin of a variable :param variable: a variable :param relation: a relation :return: the argmin of a variable
(variable: str, attribute: str, sparql_executor)
| 192 | |
| 193 | |
| 194 | def argmin(variable: str, attribute: str, sparql_executor): |
| 195 | """ |
| 196 | Get the argmin of a variable |
| 197 | :param variable: a variable |
| 198 | :param relation: a relation |
| 199 | :return: the argmin of a variable |
| 200 | """ |
| 201 | if attribute not in variable_attributes_cache[variable]: |
| 202 | raise ValueError("argmin: attribute must be an attribute of the variable") |
| 203 | |
| 204 | rtn_str = f"Observation: variable ##, which are instances of {variable.type}" |
| 205 | new_variable = Variable(variable.type, f"(ARGMIN {variable.program} {attribute})") |
| 206 | return new_variable, rtn_str |
| 207 |