public function outWithRank($link = 'ARGUMENT', $rank = 0)
{
if ($rank === 'first') {
// @note : can't use has() with integer!
$this->addMethod('out("' . $link . '").has("rank", eq(0))');
} elseif ($rank === 'last') {
$this->addMethod('map( __.out("' . $link . '").order().by("rank").tail(1) )');
} elseif ($rank === '2last') {
$this->addMethod('map( __.out("' . $link . '").order().by("rank").tail(2) )');
} else {
$this->addMethod('out("' . $link . '").has("rank", eq(' . abs(intval($rank)) . '))');
}
return $this;
}