Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openml_OS/models/api/v1/Api_evaluation.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private function evaluation_list($segs, $user_id) {
// TODO: remove dependency on task_inputs and dataset table
// TODO (2): transform into subquery where all columns except evaluation_fold are obtained in subquery (along with limit requirements, as MYSQL query optimizer does not seem to understand this query has an upper limit to the number of obtained runs that need to be inspected)
$sql =
'SELECT r.rid, r.task_id, r.start_time, s.implementation_id, s.sid, f.name AS `function`, i.fullName, d.did, d.name, e.evaluation_engine_id, ' . $columns . ' ' .
'SELECT r.rid, r.task_id, r.start_time, r.uploader, s.implementation_id, s.sid, f.name AS `function`, i.fullName, d.did, d.name, e.evaluation_engine_id, ' . $columns . ' ' .
'FROM run r, ' . $eval_table . ' e, algorithm_setup s, implementation i, dataset d, task t, task_inputs ti, math_function f ' .
'WHERE r.setup = s.sid ' .
'AND e.source = r.rid ' .
Expand Down
29 changes: 29 additions & 0 deletions openml_OS/models/api/v1/Api_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function __construct() {

function bootstrap($format, $segments, $request_type, $user_id) {
$this->outputFormat = $format;

# http://test.openml.org/api/v1/user/list/uploader/1,2
if (count($segments) >= 1 && $segments[0] == 'list') {
array_shift($segments);
$this->username_list($segments);
return;
}

/*$getpost = array('get','post');

Expand Down Expand Up @@ -74,5 +81,27 @@ function bootstrap($format, $segments, $request_type, $user_id) {
$this->_xmlContents( 'user-delete', array( 'user' => $user ) );
} */


private function username_list($segs)
{
# pass uploader list to get username list
$legal_filters = array('uploader');
$query_string = array();
for ($i = 0; $i < count($segs); $i += 2) {
$query_string[$segs[$i]] = urldecode($segs[$i+1]);
if (in_array($segs[$i], $legal_filters) == false) {
$this->returnError(370, $this->version, $this->openmlGeneralErrorCode, 'Legal filter operators: ' . implode(',', $legal_filters) .'. Found illegal filter: ' . $segs[$i]);
return;
}
}
$uploader_id = element('uploader', $query_string);
$sql = 'SELECT `username`,`id` FROM `users` WHERE `id` In ('. $uploader_id.')';
$users = $this->Author->query($sql);
$this->xmlContents('user-name', $this->version, array('users' => $users));
}

}



?>
1 change: 1 addition & 0 deletions openml_OS/views/pages/api_new/v1/xml/evaluations.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?php foreach( $evaluations as $e ): ?>
<oml:evaluation>
<oml:run_id><?php echo $e->rid; ?></oml:run_id>
<oml:uploader><?php echo $e->uploader; ?></oml:uploader>
<oml:task_id><?php echo $e->task_id; ?></oml:task_id>
<oml:setup_id><?php echo $e->sid; ?></oml:setup_id>
<oml:flow_id><?php echo $e->implementation_id; ?></oml:flow_id>
Expand Down
8 changes: 8 additions & 0 deletions openml_OS/views/pages/api_new/v1/xml/user-name.tpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<oml:users xmlns:oml="http://openml.org/openml">
<?php foreach( $users as $u ): ?>
<oml:user>
<oml:id><?php echo $u->id ?></oml:id>
<oml:username><?php echo $u->username ?></oml:username>
</oml:user>
<?php endforeach; ?>
</oml:users>