GraphAware\Reco4PHP\RecommenderService::findInputBy PHP Метод

findInputBy() публичный Метод

public findInputBy ( string $label, string $key, mixed $value ) : GraphAware\Common\Type\Node
$label string
$key string
$value mixed
Результат GraphAware\Common\Type\Node
    public function findInputBy($label, $key, $value)
    {
        $query = sprintf('MATCH (n:%s {%s: {value} }) RETURN n as input', $label, $key);
        $result = $this->databaseService->getDriver()->run($query, ['value' => $value]);
        return $this->validateInput($result);
    }

Usage Example

 /**
  * @param int $id
  * @return \GraphAware\Reco4PHP\Result\Recommendations
  */
 public function recommendMovieForUserWithId($id)
 {
     $input = $this->service->findInputBy('User', 'id', $id);
     $recommendationEngine = $this->service->getRecommender("user_movie_reco");
     return $recommendationEngine->recommend($input, new SimpleContext());
 }