<commit_before><?php

namespace Db\CreatorBundle\Entity;

use Doctrine\ORM\EntityRepository;

class InventorRepository extends EntityRepository{
    
    public function getInventorsCollabs(){
        
        return  $this->createQueryBuilder('i1')
                    ->select('i1.fullName source, i2.fullName target, count(i1.fullName) value')
                    ->innerJoin('i1.patents', 'p')
                    ->innerJoin('p.inventors', 'i2', 'WITH', 'i2.fullName > i1.fullName')
                    ->groupBy('source, target')
                    ->orderBy('value','DESC')
                    ->setMaxResults(300)        // For performance purposes
                    ->getQuery()->getResult();
    }
}<commit_msg>The function getTopXInventors(, ) is added : gets top  inventors from  if defined (allows a better time-rendering in the front-end)<commit_after><?php

namespace Db\CreatorBundle\Entity;

use Doctrine\ORM\EntityRepository;

class InventorRepository extends EntityRepository{
    
    public function getInventorsCollabs()
    {
        
        return  $this->createQueryBuilder('i1')
                    ->select('i1.fullName source, i2.fullName target, count(i1.fullName) value')
                    ->innerJoin('i1.patents', 'p')
                    ->innerJoin('p.inventors', 'i2', 'WITH', 'i2.fullName > i1.fullName')
                    ->groupBy('source, target')
                    ->orderBy('value','DESC')
                    ->setMaxResults(300)        // For performance purposes
                    ->getQuery()->getResult();
    }

    public function getTopXInventors($x, $country=null)
    {

        $qb =  $this->createQueryBuilder('inv')
                    ->select('inv.fullName, c.code code, count(p.id) num')
                    ->innerJoin('inv.patents', 'p')
                    ->innerJoin('inv.country', 'c')
                    ->groupBy('inv.fullName')
                    ->orderBy('num', 'DESC');

        if(($country !== null) && (gettype($country) === "string") ){
            $qb->andWhere('inv.country = :country')
                ->setParameter('country', $country);
        }
        
        return $qb->setMaxResults($x)->getQuery()->getResult();
    }
}
{'fraction_non_alphanumeric': 0.14646237043713384, 'fraction_numerical': 0.009914375844975214, 'mean_word_length': 1.956058588548602, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5389824', 'n_tokens_mistral': 644, 'n_tokens_neox': 614, 'n_words': 115}