function collection_from_freebase ($topic, $collection
{
// construct the query
$simplequery = array'id'=>$topic, $collection=>array());
// issue the query
$results = freebase_query$simplequery);
// get the result
if (isset$results[0][$collection])) {
$array = $results[0][$collection];
} else {
$array = array(); // not there? return empty array
}
// sort and return
sort$array);
return $array
}