function biological_classification ($lifeform
{
// construct the query
$query = array'name'=>$lifeform,
'type'=>'/biology/organism_classification',
'higher_classification'=>null,
'rank'=>null,
'scientific_name'=>null
);
// issue the query
$results = freebase_query$query);
if (isset$results[0])) {
if (isset$results[0]['name']))
$lifeform = $results[0]['name'];
$return = "$lifeformnn"
do {
$rank = '(unranked)'
$higher = ''
$scientific = ''
if (isset$results[0]['higher_classification']))
$higher = $results[0]['higher_classification'];
if (isset$results[0]['scientific_name']))
$scientific = $results[0]['scientific_name'];
if (isset$results[0]['rank']))
$rank = $results[0]['rank'];
// scientific name found
if ($scientific != '') {
$return .= "$rank: $scientificn"
} else {
$return .= "no informationn"
}
// higher lifeform found
if ($higher != '') {
$query'name'] = $higher
$results = freebase_query$query);
}
} while ($higher != '');
return $return
} else {
throw new Exception"Lifeform $lifeform not found");
}
}