'stats.log'), JLog :: ALL, array('stats')); if(!class_exists("Predis\Client")){ require $GLOBALS['PREDIS_ROOT'] . DIRECTORY_SEPARATOR ."autoload.php"; } try { //Predis\Autoloader::register(); $this->cache = new Predis\Client(array( "scheme" => $this->params->get('cachescheme'), "host" => $this->params->get('cacheserver'), "port" => $this->params->get('cacheport'))); $this->cache->connect(); } catch(Exception $e) { JLog :: add("Error connecting to Redis server: ".$e->getMessage(), JLog :: ERROR, 'stats'); $this->cache = null; } /*OVERALL*/ /*1*/ $this->codes[] = "{include_number PUBS}"; /*2*/ $this->codes[] = "{include_number OAPUBS}"; /*3*/ $this->codes[] = "{include_number NOAPUBS}"; /*4*/ $this->codes[] = "{include_number FPUBS}"; /*5*/ $this->codes[] = "{include_number PROJ}"; /*6*/ $this->codes[] = "{include_number DATASRC}"; /*7*/ $this->codes[] = "{include_number DATASRC-PUBS}"; /*8*/ $this->codes[] = "{include_number DATASRC-PUBREPS}"; /*9*/ $this->codes[] = "{include_number DATASRC-PUBOAJ}"; /*10*/$this->codes[] = "{include_number DATASRC-PUBAGGR}"; /*11*/$this->codes[] = "{include_number FUNDERS}"; /*FOR FP7*/ /*12*/$this->codes[] = "{include_number FP7PUBSTOTAL}"; /*13*/$this->codes[] = "{include_number FP7PROJPUBS}"; /*14*/$this->codes[] = "{include_number FP7PROJTOTAL}"; /*15*/$this->codes[] = "{include_number FP7OAPUBS}"; /*16*/$this->codes[] = "{include_number FP7RESPUBS}"; /*17*/$this->codes[] = "{include_number FP7EMBPUBS}"; /*18*/$this->codes[] = "{include_number SC39FP7PUBSTOTAL}"; /*19*/$this->codes[] = "{include_number SC39FP7PROJPUBS}"; /*20*/$this->codes[] = "{include number SC39FP7PROJTOTAL}"; /*21*/$this->codes[] = "{include_number SC39FP7OAPUBS}"; /*ERC*/ /*22*/$this->codes[] = "{include_number ERCPUBSTOTAL}"; /*23*/$this->codes[] = "{include_number ERCPROJPUBS}"; /*24*/$this->codes[] = "{include_number ERCPROJTOTAL}"; /*25*/$this->codes[] = "{include_number ERCOAPUBS}"; /*26*/$this->codes[] = "{include_number ERCRESPUBS}"; /*27*/$this->codes[] = "{include_number ERCEMBPUBS}"; /*WT*/ /*28*/$this->codes[] = "{include_number WTPUBSTOTAL}"; /*29*/$this->codes[] = "{include_number WTPROJPUBS}"; /*30*/$this->codes[] = "{include_number WTPROJTOTAL}"; /*31*/$this->codes[] = "{include_number WTOAPUBS}"; /*32*/$this->codes[] = "{include_number WTRESPUBS}"; /*33*/$this->codes[] = "{include_number WTEMBPUBS}"; // Latest Natalias requests /*34*/$this->codes[] = "{include_number DATASRC-WITHPUBS}"; /*35*/$this->codes[] = "{include_number ORG-WITHPUBS}"; /*36*/$this->codes[] = "{include_number DATA-TOTAL}"; // FET nums /*37*/$this->codes[] = "{include_number FETPUBS}"; /*38*/$this->codes[] = "{include_number FETOAPUBS}"; /*39*/$this->codes[] = "{include_number FETRESPUBS}"; /*40*/$this->codes[] = "{include_number FETEMBPUBS}"; // DATASETS /*41*/$this->codes[] = "{include_number DATASETPUBS}"; /*42*/$this->codes[] = "{include_number DATASETPROJ}"; /*43*/$this->codes[] = "{include_number PUBSDATASETS}"; // EGI NUMS /*44*/$this->codes[] = "{include_number EGIPUBS}"; /*45*/$this->codes[] = "{include_number EGIVO}"; /*46*/$this->codes[] = "{include_number EGIPROJ}"; // EGI NUMS /*47*/$this->codes[] = "{include_number EGIOA}"; /*48*/$this->codes[] = "{include_number EGIEMB}"; /*49*/$this->codes[] = "{include_number EGIRES}"; /*ERC*/ /*50*/$this->codes[] = "{include_number FCTPUBSTOTAL}"; /*51*/$this->codes[] = "{include_number FCTPROJPUBS}"; /*52*/$this->codes[] = "{include_number FCTPROJTOTAL}"; /*53*/$this->codes[] = "{include_number FCTOAPUBS}"; /*54*/$this->codes[] = "{include_number FCTRESPUBS}"; /*55*/$this->codes[] = "{include_number FCTEMBPUBS}"; /*53*/$this->codes[] = "{include_number RES}"; /*54*/$this->codes[] = "{include_number DTSRCDATAREPO}"; /*55*/$this->codes[] = "{include_number EGIPROJTOTAL }"; /*53*/$this->codes[] = "{include_number H2020PUBSTOTAL}"; /*53*/$this->codes[] = "{include_number H2020PROJPUBS}"; /*54*/$this->codes[] = "{include_number H2020PROJTOTAL}"; /*55*/$this->codes[] = "{include_number H2020OAPUBS}"; /*55*/$this->codes[] = "{include_number H2020RESPUBS}"; /*55*/$this->codes[] = "{include_number H2020EMBPUBS}"; /*NWO*/ /*50*/$this->codes[] = "{include_number NWOPUBSTOTAL}"; /*51*/$this->codes[] = "{include_number NWOPROJPUBS}"; /*52*/$this->codes[] = "{include_number NWOPROJTOTAL}"; /*53*/$this->codes[] = "{include_number NWOOAPUBS}"; /*54*/$this->codes[] = "{include_number NWORESPUBS}"; /*55*/$this->codes[] = "{include_number NWOEMBPUBS}"; /*MESTD*/ /*50*/$this->codes[] = "{include_number MESTDPUBSTOTAL}"; /*51*/$this->codes[] = "{include_number MESTDPROJPUBS}"; /*52*/$this->codes[] = "{include_number MESTDPROJTOTAL}"; /*53*/$this->codes[] = "{include_number MESTDOAPUBS}"; /*54*/$this->codes[] = "{include_number MESTDRESPUBS}"; /*55*/$this->codes[] = "{include_number MESTDEMBPUBS}"; /*SFI*/ $this->codes[] = "{include_number SFIPUBSTOTAL}"; $this->codes[] = "{include_number SFIPROJPUBS}"; $this->codes[] = "{include_number SFIPROJTOTAL}"; $this->codes[] = "{include_number SFIOAPUBS}"; $this->codes[] = "{include_number SFIRESPUBS}"; $this->codes[] = "{include_number SFIEMBPUBS}"; /*MZOS*/ $this->codes[] = "{include_number MZOSPUBSTOTAL}"; $this->codes[] = "{include_number MZOSPROJPUBS}"; $this->codes[] = "{include_number MZOSPROJTOTAL}"; $this->codes[] = "{include_number MZOSOAPUBS}"; $this->codes[] = "{include_number MZOSRESPUBS}"; $this->codes[] = "{include_number MZOSEMBPUBS}"; /*TUBITAK*/ $this->codes[] = "{include_number TUBITAKPUBSTOTAL}"; $this->codes[] = "{include_number TUBITAKPROJPUBS}"; $this->codes[] = "{include_number TUBITAKPROJTOTAL}"; $this->codes[] = "{include_number TUBITAKOAPUBS}"; $this->codes[] = "{include_number TUBITAKRESPUBS}"; $this->codes[] = "{include_number TUBITAKEMBPUBS}"; /*RCUK*/ $this->codes[] = "{include_number RCUKPUBSTOTAL}"; $this->codes[] = "{include_number RCUKPROJPUBS}"; $this->codes[] = "{include_number RCUKPROJTOTAL}"; $this->codes[] = "{include_number RCUKOAPUBS}"; $this->codes[] = "{include_number RCUKRESPUBS}"; $this->codes[] = "{include_number RCUKEMBPUBS}"; /*SNSF*/ $this->codes[] = "{include_number SNSFPUBSTOTAL}"; $this->codes[] = "{include_number SNSFPROJPUBS}"; $this->codes[] = "{include_number SNSFPROJTOTAL}"; $this->codes[] = "{include_number SNSFOAPUBS}"; $this->codes[] = "{include_number SNSFRESPUBS}"; $this->codes[] = "{include_number SNSFEMBPUBS}"; /*FWF*/ $this->codes[] = "{include_number FWFPUBSTOTAL}"; $this->codes[] = "{include_number FWFPROJPUBS}"; $this->codes[] = "{include_number FWFPROJTOTAL}"; $this->codes[] = "{include_number FWFOAPUBS}"; $this->codes[] = "{include_number FWFRESPUBS}"; $this->codes[] = "{include_number FWFEMBPUBS}"; /*NSF*/ $this->codes[] = "{include_number NSFPUBSTOTAL}"; $this->codes[] = "{include_number NSFPROJPUBS}"; $this->codes[] = "{include_number NSFPROJTOTAL}"; $this->codes[] = "{include_number NSFOAPUBS}"; $this->codes[] = "{include_number NSFRESPUBS}"; $this->codes[] = "{include_number NSFEMBPUBS}"; /*NIH*/ $this->codes[] = "{include_number NIHPUBSTOTAL}"; $this->codes[] = "{include_number NIHPROJPUBS}"; $this->codes[] = "{include_number NIHPROJTOTAL}"; $this->codes[] = "{include_number NIHOAPUBS}"; $this->codes[] = "{include_number NIHRESPUBS}"; $this->codes[] = "{include_number NIHEMBPUBS}"; /*NHMRC*/ $this->codes[] = "{include_number NHMRCPUBSTOTAL}"; $this->codes[] = "{include_number NHMRCPROJPUBS}"; $this->codes[] = "{include_number NHMRCPROJTOTAL}"; $this->codes[] = "{include_number NHMRCOAPUBS}"; $this->codes[] = "{include_number NHMRCRESPUBS}"; $this->codes[] = "{include_number NHMRCEMBPUBS}"; /*CSF*/ $this->codes[] = "{include_number CSFPUBSTOTAL}"; $this->codes[] = "{include_number CSFPROJPUBS}"; $this->codes[] = "{include_number CSFPROJTOTAL}"; $this->codes[] = "{include_number CSFOAPUBS}"; $this->codes[] = "{include_number CSFRESPUBS}"; $this->codes[] = "{include_number CSFEMBPUBS}"; /*ARC*/ $this->codes[] = "{include_number ARCPUBSTOTAL}"; $this->codes[] = "{include_number ARCPROJPUBS}"; $this->codes[] = "{include_number ARCPROJTOTAL}"; $this->codes[] = "{include_number ARCOAPUBS}"; $this->codes[] = "{include_number ARCRESPUBS}"; $this->codes[] = "{include_number ARCEMBPUBS}"; /*EC*/ $this->codes[] = "{include_number ECPUBSTOTAL}"; $this->codes[] = "{include_number ECPROJPUBS}"; $this->codes[] = "{include_number ECPROJTOTAL}"; $this->codes[] = "{include_number ECOAPUBS}"; $this->codes[] = "{include_number ECRESPUBS}"; $this->codes[] = "{include_number ECEMBPUBS}"; } public function onContentPrepare( $context, &$article, &$params, $page = 0 ) { $regex_base = '\{(include_number)\s+(PUBS|OAPUBS|NOAPUBS|FPUBS|PROJ|DATASRC|DATASRC-PUBS|DATASRC-PUBREPS|DATASRC-PUBOAJ|DATASRC-PUBAGGR|FUNDERS|FP7PUBSTOTAL|FP7PROJPUBS|FP7PROJTOTAL|FP7OAPUBS|FP7RESPUBS|FP7EMBPUBS|SC39FP7PUBSTOTAL|SC39FP7PROJPUBS|SC39FP7PROJTOTAL|SC39FP7OAPUBS|ERCPUBSTOTAL|ERCPROJTOTAL|ERCPROJPUBS|ERCOAPUBS|ERCRESPUBS|ERCEMBPUBS|WTPUBSTOTAL|WTPROJPUBS|WTPROJTOTAL|WTOAPUBS|WTRESPUBS|WTEMBPUBS|DATASRC-WITHPUBS|ORG-WITHPUBS|DATA-TOTAL|FETPUBS|FETOAPUBS|FETRESPUBS|FETEMBPUBS|DATASETPUBS|DATASETPROJ|PUBSDATASETS|EGIPUBS|EGIVO|EGIPROJ|EGIOA|EGIEMB|EGIRESERCPUBSTOTAL|FCTPROJTOTAL|FCTPROJPUBS|FCTOAPUBS|FCTRESPUBS|FCTEMBPUBS|RES|DTSRCDATAREPO|EGIPROJTOTAL|H2020PUBSTOTAL|H2020PROJPUBS|H2020PROJTOTAL|H2020OAPUBS|H2020RESPUBS|H2020EMBPUBS|NWOPROJTOTAL|NWOPROJPUBS|NWOOAPUBS|NWORESPUBS|NWOEMBPUBS|MESTDPUBSTOTAL|MESTDPROJPUBS|MESTDPROJTOTAL|MESTDOAPUBS|MESTDRESPUBS|MESTDEMBPUBS|SFIPUBSTOTAL|SFIPROJPUBS|SFIPROJTOTAL|SFIOAPUS|SFIRESPUBS|SFIEMBPUBS|MZOSPUBSTOTAL|MZOSPROJPUBS|MZOSOAPUBS|MZOSRESPUBS|MZOSEMBPUBS|TUBITAKPUBSTOTAL|TUBITAKPROJPUBS|TUBITAKOAPUBS|TUBITAKRESPUBS|TUBITAKEMBPUBS|RCUKPUBSTOTAL|RCUKPROJPUBS|RCUKOAPUBS|RCUKRESPUBS|RCUKEMBPUBS|SNSFPUBSTOTAL|SNSFPROJPUBS|SNSFOAPUBS|SNSFRESPUBS|SNSFEMBPUBS|FWFPUBSTOTAL|FWFPROJPUBS|FWFOAPUBS|FWFRESPUBS|FWFEMBPUBS|NSFPUBSTOTAL|NSFPROJPUBS|NSFOAPUBS|NSFRESPUBS|NSFEMBPUBS|NIHPUBSTOTAL|NIHPROJPUBS|NIHOAPUBS|NIHRESPUBS|NIHEMBPUBS|NHMRCPUBSTOTAL|NHMRCPROJPUBS|NHMRCOAPUBS|NHMRCRESPUBS|NHMRCEMBPUBS|CSFPUBSTOTAL|CSFPROJPUBS|CSFOAPUBS|CSFRESPUBS|CSFEMBPUBS|ARCPUBSTOTAL|ARCPROJPUBS|ARCOAPUBS|ARCRESPUBS|ARCEMBPUBS|ECPUBSTOTAL|ECPROJPUBS|ECOAPUBS|ECRESPUBS|ECEMBPUBS)\}'; $regex = "/$regex_base/"; $contents = $article->text; $found = preg_match_all($regex, $contents, $matches); if (!$found){ return true;} try { $str = 'pgsql:host='.$this->params->get('dbhost').';port='.$this->params->get('dbport').';dbname='.$this->params->get('dbname').';user='.$this->params->get('dbuser').';password='.$this->params->get('dbpass'); $this->db = new PDO($str); } catch(Exception $e){ JLog :: add('Could not connect to database: ' . $e->getMessage(), JLog :: ERROR, 'stats'); return false; } $cnt = count($matches); JLog :: add( "matches found: ".$cnt, JLog :: DEBUG, 'openaire'); $result = NULL; if ($this -> cache != null) { if($this->cache->exists("STATS_NUMBERS")) { $result = $this -> cache -> hgetall("STATS_NUMBERS"); JLog :: add("Found in cache!", JLog :: DEBUG, 'stats'); } else { $this->cache->quit(); JLog :: add("Not found in cache!", JLog :: DEBUG, 'stats'); $result = $this->makequeries(true); } } else {//make the queries but don't cache the result $result = $this->makequeries(false); } $article->text = str_replace($this->codes, $result, $article->text); return true; } private function makequeries($addflag){ JLog :: add("Not found in cache!", JLog :: DEBUG, 'stats'); $temp = array(); /*OVERALL*/ /*1*/ $qpubs = "SELECT count(*) FROM result where type='publication'"; /*2*/ $qoapubs = "SELECT count(*) FROM result WHERE access_mode='Open Access' and type='publication'"; /*3*/ $qnoapubs = "SELECT count(*) FROM result WHERE access_mode='Closed Access' and type='publication'"; /*4*/ $qfpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects where result.result_projects = result_projects.id and type='publication'"; /*5*/ $qproj = "SELECT count(*) FROM project"; /*6*/ $qdatasrc = "SELECT count(*) FROM datasource"; /*7*/ $qdtsrcpubs = "SELECT count(*) from datasource where compatibility!='non compatible' and compatibility!='unknown'"; /*8*/ $qdtsrcpubreps = "SELECT count(*) FROM datasource WHERE type='Repository'"; /*9*/ $qdtsrcoaj = "SELECT count(*) FROM datasource WHERE type='Aggregated Journal'"; /*10*/$qdtsrcpubaggr = "SELECT count(*) FROM datasource WHERE type='Aggregated Repository'"; /*11*/$qfunders = "SELECT count(distinct funding_lvl0) FROM project WHERE funding_lvl0 !=''"; /*FP7*/ /*12: total number of fp7 pubs */ $qfp7pubstotal = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id and type='publication' and result_projects.project = project.id and funding_lvl0 = 'FP7'"; /*13: number of fp7 projects with publications*/ $qfp7projpubs = "SELECT count(distinct project.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id and type='publication' and result_projects.project = project.id and funding_lvl0='FP7'"; /*14: total number of fp7 projects*/ $qfp7projtotal = "SELECT count(id) FROM project WHERE funding_lvl0 = 'FP7'"; /*15: fp7 open access pubs*/ $qfp7oapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result_projects = result_projects.id AND result_projects.project = project.id and type='publication' and funding_lvl0 = 'FP7' and access_mode='Open Access'"; /*16: fp7 restricted pubs*/ $qfp7respubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funding_lvl0 = 'FP7' and access_mode='Restricted' and type='publication'"; /*17: fp7 pubs in embargo*/ $qfp7embpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funding_lvl0 = 'FP7' and access_mode='Embargo' and type='publication'"; /*18: total number of fp7 pubs with sc39*/ $qsc39fp7pubstotal = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result_projects.project = project.id and funding_lvl0 = 'FP7' and sc39='yes' and result.result_projects = result_projects.id and type='publication'"; /*19: fp7 projs with sc39 and pubs*/ $qsc39fp7projpubs = "SELECT count(distinct project.id) FROM result, result_projects, project WHERE result_projects.project=project.id and funding_lvl0 = 'FP7' and sc39='yes' and result.result_projects = result_projects.id and type='publication'"; /*20: total number of fp7 proj with sc39*/ $qsc39fp7projtotal = "SELECT count(number) from project where funding_lvl0='FP7' and sc39='yes'"; /*21: open access fp7 pubs with sc39*/ $qsc39fp7oapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funding_lvl0 = 'FP7' and access_mode='Open Access' and sc39='yes' and type='publication'"; /*ERC*/ /*22: total number of erc pubs*/ $qercpubstotal = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result_projects.project = project.id and funding_lvl2 = 'ERC' and result.result_projects = result_projects.id and type='publication'"; /*23: erc projects with pubs*/ $qercprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funding_lvl2='ERC' and result.result_projects = result_projects.id and type='publication'"; /*24: total erc projects*/ $qercprojtotal = "SELECT count(id) FROM project WHERE funding_lvl2 = 'ERC'"; /*25: erc open access pubs*/ $qercoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funding_lvl2 = 'ERC' and access_mode='Open Access' and type='publication'"; /*26: erc restricted pubs*/ $qercrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funding_lvl2 = 'ERC' and access_mode='Restricted' and type='publication'"; /*27: erc embargo pubs*/ $qercembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funding_lvl2 = 'ERC' and access_mode='Embargo' and type='publication'"; /*WT*/ /*28: total number of wt pubs*/ $qwtpubstotal = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result_projects.project = project.id and funder = 'Wellcome Trust' and result.result_projects = result_projects.id and type='publication'"; /*29: wt projects with pubs*/ $qwtprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder = 'Wellcome Trust' and result.result_projects = result_projects.id and type='publication'"; /*30: total wt projects*/ $qwtprojtotal = "SELECT count(id) FROM project WHERE funding_lvl0 = 'WT'"; /*31: wt open access pubs*/ $qwtoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder = 'Wellcome Trust' and access_mode='Open Access' and type='publication'"; /*32: wt restricted pubs*/ $qwtrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder = 'Wellcome Trust' and access_mode='Restricted' and type='publication'"; /*33: wt embargo pubs*/ $qwtembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder = 'Wellcome Trust' and access_mode='Embargo' and type='publication'"; /*Natalia's extra stuff */ /*34: datasources with publication results */ $datasrc_withpubs = "SELECT count(distinct rd.datasource) from result_datasources rd join result r on r.id=rd.id where r.type='publication'"; /*35: organisations with publication results */ $org_withpubs = "select count(*) from (select dor.organization as organization from datasource_organizations dor join result_datasources rd on rd.datasource=dor.id join result r on r.id=rd.id where r.type='publication' union select por.organization as organization from project_organizations por join result_projects rp on rp.project=por.id join result r on r.id=rp.id where r.type='publication') as foo"; /*36: number of datasets */ $data_total = "select count(distinct id) from result where type='dataset';"; /*FET */ $fetpubs ="select count(distinct rc.id) as field0 from result_concepts rc join concept c on c.id=rc.concept join category cat on cat.id=c.category where cat.context ='fet'"; $fetoapubs ="select count(distinct rc.id) as field0 from result_concepts rc join result r on r.id=rc.id join concept c on c.id=rc.concept join category cat on cat.id=c.category where cat.context ='fet' and r. bestlicense='Open Access'"; $fetrespubs ="select count(distinct rc.id) as field0 from result_concepts rc join result r on r.id=rc.id join concept c on c.id=rc.concept join category cat on cat.id=c.category where cat.context ='fet' and r. bestlicense='Restricted'"; $fetembpubs ="select count(distinct rc.id) as field0 from result_concepts rc join result r on r.id=rc.id join concept c on c.id=rc.concept join category cat on cat.id=c.category where cat.context ='fet' and r. bestlicense='Embargo'"; /*DATASETS */ $datasetpubs= "select count(distinct r.id) from result r join result_results rr on rr.id=r.id join result rp on rp.id=rr.result where r.type='dataset' and rp.type='publication'" ; //# of datasets linked to projects $datasetproj="select count(distinct r.id) from result r join result_projects rp on rp.id=r.id join project p on p.id=rp.project where r.type='dataset' "; //# of publications linked to datasets $pubsdatasets ="select count(distinct r.id) from result r join result_results rr on rr.id=r.id join result rp on rp.id=rr.result where r.type='publication' and rp.type='dataset'"; /*EGI PAGE NUMS*/ $egivo="select count(distinct c.name) as field0 from result_concepts rc join concept c on c.id=rc.concept join category cat on cat.id=c.category where cat.id='egi::virtual'"; $egiproj="select count(distinct pr.id) as field0 from result_concepts rc, project_results pr, project p where p.id=pr.id and pr.result=rc.id and rc.concept like 'egi%'"; $egipubs= " select count( distinct rc.id) as field0 from result r,result_concepts rc, concept con, category cat where rc.id=r.id and con.id=rc.concept and con.category= cat.id and cat.context ='egi'"; $egioa="select count(distinct r.id) as field0 from result r join result_concepts rc on r.id=rc.id join concept c on c.id=rc.concept where bestlicense='Open Access'"; $egiemb="select count(distinct r.id) as field0 from result r join result_concepts rc on r.id=rc.id join concept c on c.id=rc.concept where bestlicense='Embargo'"; $egires="select count(distinct r.id) as field0 from result r join result_concepts rc on r.id=rc.id join concept c on c.id=rc.concept where bestlicense='Restricted'"; /* FCT*/ /*FCT*/ /*22: total number of FCTpubs*/ $qfctpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='FCT' and result.result_projects = result_projects.id and result.type='publication'"; /*23: FCTprojects with pubs*/ $qfctprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='FCT' and result.result_projects = result_projects.id and type='publication'"; /*24: total FCTprojects*/ $qfctprojtotal = "SELECT count(id) FROM project WHERE funder = 'FCT'"; /*25: FCTopen access pubs*/ $qfctoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder = 'FCT' and bestlicense='Open Access' and type='publication'"; /*26: FCTrestricted pubs*/ $qfctrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder = 'FCT' and bestlicense='Restricted' and type='publication'"; /*27: FCTembargo pubs*/ $qfctembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder = 'FCT' and bestlicense='Embargo' and type='publication'"; $res = "select count (distinct id) from result"; $dtsrcdatarepo = "SELECT count(*) FROM datasource WHERE type = 'Data Repository'"; $egiprojtotal = "select count(distinct c.name) as field0 from concept c join category cat on cat.id=c.category where cat.id='egi::projects' "; $h2020pubstotal = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id and type='publication' and result_projects.project = project.id and funding_lvl0 = 'H2020'"; $h2020projpubs = "SELECT count(distinct project.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id and type='publication' and result_projects.project = project.id and funding_lvl0='H2020'"; $h2020projtotal = "SELECT count(id) FROM project WHERE funding_lvl0 = 'H2020'"; $h2020oapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result_projects = result_projects.id AND result_projects.project = project.id and type='publication' and funding_lvl0 = 'H2020' and bestlicense='Open Access'"; $h2020respubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funding_lvl0 = 'H2020' and bestlicense='Restricted' and type='publication'"; $h2020embpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funding_lvl0 = 'H2020' and bestlicense='Embargo' and type='publication'"; //NWO /*22: total number of NWO pubs*/ $qnwopubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='Netherlands Organisation for Scientific Research (NWO)' and result.result_projects = result_projects.id and result.type='publication'"; /*23: NWO projects with pubs*/ $qnwoprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='Netherlands Organisation for Scientific Research (NWO)' and result.result_projects = result_projects.id and type='publication'"; /*24: total NWO projects*/ $qnwoprojtotal = "SELECT count(id) FROM project WHERE funder = 'Netherlands Organisation for Scientific Research (NWO)'"; /*25: NWO open access pubs*/ $qnwooapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder = 'Netherlands Organisation for Scientific Research (NWO)' and bestlicense='Open Access' and type='publication'"; /*26: NWO restricted pubs*/ $qnworespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder = 'Netherlands Organisation for Scientific Research (NWO)' and bestlicense='Restricted' and type='publication'"; /*27: NWO embargo pubs*/ $qnwoembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder = 'Netherlands Organisation for Scientific Research (NWO)' and bestlicense='Embargo' and type='publication'"; /*MESTD*/ $qmestdpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='Ministry of Education, Science and Technological Development of Republic of Serbia' and result.result_projects = result_projects.id and result.type='publication'"; $qmestdprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder ='Ministry of Education, Science and Technological Development of Republic of Serbia' and result.result_projects = result_projects.id and type='publication'"; $qmestdprojtotal = "SELECT count(id) FROM project WHERE funder = 'Ministry of Education, Science and Technological Development of Republic of Serbia'"; $qmestdoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder = 'Ministry of Education, Science and Technological Development of Republic of Serbia' and bestlicense='Open Access' and type='publication'"; $qmestdrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder = 'Ministry of Education, Science and Technological Development of Republic of Serbia' and bestlicense='Restricted' and type='publication'"; $qmestdembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder = 'Ministry of Education, Science and Technological Development of Republic of Serbia' and bestlicense='Embargo' and type='publication'"; // SFI $qsfipubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Science Foundation Ireland' and result.result_projects = result_projects.id and result.type='publication'"; $qsfiprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Science Foundation Ireland' and result.result_projects = result_projects.id and result.type='publication'"; $qsfiprojtotal = "SELECT count(id) FROM project WHERE funder ='Science Foundation Ireland'"; $qsfioapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Science Foundation Ireland' and bestlicense='Open Access' and result.type='publication'"; $qsfirespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Science Foundation Ireland' and bestlicense='Restricted' and result.type='publication'"; $qsfiembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Science Foundation Ireland' and bestlicense='Embargo' and result.type='publication'"; // MZOS $qmzospubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)' and result.result_projects = result_projects.id and result.type='publication'"; $qmzosprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)' and result.result_projects = result_projects.id and result.type='publication'"; $qmzosprojtotal = "SELECT count(id) FROM project WHERE funder ='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)'"; $qmzosoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)' and bestlicense='Open Access' and result.type='publication'"; $qmzosrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)' and bestlicense='Restricted' and result.type='publication'"; $qmzosembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Ministry of Science, Education and Sports of the Republic of Croatia (MSES)' and bestlicense='Embargo' and result.type='publication'"; // Tubitak $qtubitakpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Türkiye Bilimsel ve Teknolojj ik Ara�~_tırma Kurumu' and result.result_projects = result_projects.id and result.type='publication'"; $qtubitakprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Türkiye Bilimsel ve Teknolojii k Ara�~_tırma Kurumu' and result.result_projects = result_projects.id and result.type='publication'"; $qtubitakprojtotal = "SELECT count(id) FROM project WHERE funder ='Türkiye Bilimsel ve Teknolojik Ara�~_tırma Kurumu'"; $qtubitakoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Türkiye Bilimsel ve Teknolojik Ara�~_tırma Kurumu' and bestlicense='Open Access' and result.type='publication'"; $qtubitakrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Türkiye Bilimsel ve Teknolojik Ara�~_tırma Kurumu' and bestlicense='Restricted' and result.type='publication'"; $qtubitakembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Türkiye Bilimsel ve Teknolojik Ara�~_tırma Kurumu' and bestlicense='Embargo' and result.type='publication'"; // RCUK $qrcukpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Research Council UK' and result.result_projects = result_projects.id and result.type='publication'"; $qrcukprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Research Council UK' and result.result_projects = result_projects.id and result.type='publication'"; $qrcukprojtotal = "SELECT count(id) FROM project WHERE funder ='Research Council UK'"; $qrcukoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Research Council UK' and bestlicense='Open Access' and result.type='publication'"; $qrcukrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Research Council UK' and bestlicense='Restricted' and result.type='publication'"; $qrcukembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Research Council UK' and bestlicense='Embargo' and result.type='publication'"; // SNSF $qsnsfpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Swiss National Science Foundation' and result.result_projects = result_projects.id and result.type='publication'"; $qsnsfprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Swiss National Science Foundation' and result.result_projects = result_projects.id and result.type='publication'"; $qsnsfprojtotal = "SELECT count(id) FROM project WHERE funder ='Swiss National Science Foundation'"; $qsnsfoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Swiss National Science Foundation' and bestlicense='Open Access' and result.type='publication'"; $qsnsfrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Swiss National Science Foundation' and bestlicense='Restricted' and result.type='publication'"; $qsnsfembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Swiss National Science Foundation' and bestlicense='Embargo' and result.type='publication'"; // FWF $qfwfpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Austrian Science Fund (FWF)' and result.result_projects = result_projects.id and result.type='publication'"; $qfwfprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Austrian Science Fund (FWF)' and result.result_projects = result_projects.id and result.type='publication'"; $qfwfprojtotal = "SELECT count(id) FROM project WHERE funder ='Austrian Science Fund (FWF)'"; $qfwfoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Austrian Science Fund (FWF)' and bestlicense='Open Access' and result.type='publication'"; $qfwfrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Austrian Science Fund (FWF)' and bestlicense='Restricted' and result.type='publication'"; $qfwfembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Austrian Science Fund (FWF)' and bestlicense='Embargo' and result.type='publication'"; // NSF $qnsfpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Science Foundation' and result.result_projects = result_projects.id and result.type='publication'"; $qnsfprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Science Foundation' and result.result_projects = result_projects.id and result.type='publication'"; $qnsfprojtotal = "SELECT count(id) FROM project WHERE funder ='National Science Foundation'"; $qnsfoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='National Science Foundation' and bestlicense='Open Access' and result.type='publication'"; $qnsfrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='National Science Foundation' and bestlicense='Restricted' and result.type='publication'"; $qnsfembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='National Science Foundation' and bestlicense='Embargo' and result.type='publication'"; // NIH $qnihpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Institutes of Health' and result.result_projects = result_projects.id and result.type='publication'"; $qnihprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Institutes of Health' and result.result_projects = result_projects.id and result.type='publication'"; $qnihprojtotal = "SELECT count(id) FROM project WHERE funder ='National Institutes of Health'"; $qnihoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='National Institutes of Health' and bestlicense='Open Access' and result.type='publication'"; $qnihrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='National Institutes of Health' and bestlicense='Restricted' and result.type='publication'"; $qnihembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='National Institutes of Health' and bestlicense='Embargo' and result.type='publication'"; // NHMRC $qnhmrcpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Health and Medical Research Council (NHMRC)' and result.result_projects = result_projects.id and result.type='publication'"; $qnhmrcprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='National Health and Medical Research Council (NHMRC)' and result.result_projects = result_projects.id and result.type='publication'"; $qnhmrcprojtotal = "SELECT count(id) FROM project WHERE funder ='National Health and Medical Research Council (NHMRC)'"; $qnhmrcoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='National Health and Medical Research Council (NHMRC)' and bestlicense='Open Access' and result.type='publication'"; $qnhmrcrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='National Health and Medical Research Council (NHMRC)' and bestlicense='Restricted' and result.type='publication'"; $qnhmrcembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='National Health and Medical Research Council (NHMRC)' and bestlicense='Embargo' and result.type='publication'"; // CSF $qcsfpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Croatian Science Foundation (CSF)' and result.result_projects = result_projects.id and result.type='publication'"; $qcsfprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='Croatian Science Foundation (CSF)' and result.result_projects = result_projects.id and result.type='publication'"; $qcsfprojtotal = "SELECT count(id) FROM project WHERE funder ='Croatian Science Foundation (CSF)'"; $qcsfoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='Croatian Science Foundation (CSF)' and bestlicense='Open Access' and result.type='publication'"; $qcsfrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='Croatian Science Foundation (CSF)' and bestlicense='Restricted' and result.type='publication'"; $qcsfembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='Croatian Science Foundation (CSF)' and bestlicense='Embargo' and result.type='publication'"; // EC $qecpubstotal = "SELECT count( distinct result.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='European Commission' and result.result_projects = result_projects.id and result.type='publication'"; $qecprojpubs = "SELECT count(distinct project.id) FROM result, project, result_projects where result_projects.project = project.id and project.funder='European Commission' and result.result_projects = result_projects.id and result.type='publication'"; $qecprojtotal = "SELECT count(id) FROM project WHERE funder ='European Commission'"; $qecoapubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects= result_projects.id AND result_projects.project = project.id and funder ='European Commission' and bestlicense='Open Access' and result.type='publication'"; $qecrespubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects = result_projects.id AND result_projects.project = project.id and funder='European Commission' and bestlicense='Restricted' and result.type='publication'"; $qecembpubs = "SELECT count(distinct result_projects.id) FROM result, result_projects, project WHERE result.result_projects=result_projects.id AND result_projects.project = project.id and funder ='European Commission' and bestlicense='Embargo' and result.type='publication'"; /*FCT*/ /*22*/$temp['fctpubstotal'] = $this->doQuery($qfctpubstotal); /*23*/$temp['fctprojpubs'] = $this->doQuery($qfctprojpubs); /*24*/$temp['fctprojtotal'] = $this->doQuery($qfctprojtotal); /*25*/$temp['fctoapubs'] = $this->doQuery($qfctoapubs); /*26*/$temp['fctrespubs'] = $this->doQuery($qfctrespubs); /*27*/$temp['fctembpubs'] = $this->doQuery($qfctembpubs); /*1*/ $temp['pubs'] = $this->doQuery($qpubs); /*2*/ $temp['oapubs'] = $this->doQuery($qoapubs); /*3*/ $temp['noapubs'] = $this->doQuery($qnoapubs); /*4*/ $temp['fpubs'] = $this->doQuery($qfpubs); /*5*/ $temp['proj'] = $this->doQuery($qproj); /*6*/ $temp['datasrc'] = $this->doQuery($qdatasrc); /*7*/ $temp['dtsrcpubs'] = $this->doQuery($qdtsrcpubs); /*8*/ $temp['dtsrcpubreps'] = $this->doQuery($qdtsrcpubreps); /*9*/ $temp['dtsrcoaj'] = $this->doQuery($qdtsrcoaj); /*10*/$temp['dtsrcpubaggr'] = $this->doQuery($qdtsrcpubaggr); /*11*/$temp['funders'] = $this->doQuery($qfunders); /*FP7*/ /*12*/$temp['fp7pubstotal'] = $this->doQuery($qfp7pubstotal); /*13*/$temp['fp7projpubs'] = $this->doQuery($qfp7projpubs); /*14*/$temp['fp7projtotal'] = $this->doQuery($qfp7projtotal); /*15*/$temp['fp7oapubs'] = $this->doQuery($qfp7oapubs); /*16*/$temp['fp7respubs'] = $this->doQuery($qfp7respubs); /*17*/$temp['fp7embpubs'] = $this->doQuery($qfp7embpubs); /*18*/$temp['sc39fp7pubstotal'] = $this->doQuery($qsc39fp7pubstotal); /*19*/$temp['sc39fp7projpubs'] = $this->doQuery($qsc39fp7projpubs); /*20*/$temp['sc39fp7projtotal'] = $this->doQuery($qsc39fp7projtotal); /*21*/$temp['sc39fp7oapubs'] = $this->doQuery($qsc39fp7oapubs); /*ERC*/ /*22*/$temp['ercpubstotal'] = $this->doQuery($qercpubstotal); /*23*/$temp['ercprojpubs'] = $this->doQuery($qercprojpubs); /*24*/$temp['ercprojtotal'] = $this->doQuery($qercprojtotal); /*25*/$temp['ercoapubs'] = $this->doQuery($qercoapubs); /*26*/$temp['ercrespubs'] = $this->doQuery($qercrespubs); /*27*/$temp['ercembpubs'] = $this->doQuery($qercembpubs); /*WT*/ /*28*/$temp['wtpubstotal'] = $this->doQuery($qwtpubstotal); /*29*/$temp['wtprojpubs'] = $this->doQuery($qwtprojpubs); /*30*/$temp['wtprojtotal'] = $this->doQuery($qwtprojtotal); /*31*/$temp['wtoapubs'] = $this->doQuery($qwtoapubs); /*32*/$temp['wtrespubs'] = $this->doQuery($qwtrespubs); /*33*/$temp['wtembpubs'] = $this->doQuery($qwtembpubs); /*34*/$temp['datasrc_withpubs'] = $this->doQuery($datasrc_withpubs); /*35*/$temp['org_withpubs'] = $this->doQuery($org_withpubs); /*36*/$temp['data_total'] = $this->doQuery($data_total); //FET NUMS /*37*/$temp['fetpubs'] = $this->doQuery($fetpubs); /*38*/$temp['fetoapubs'] = $this->doQuery($fetoapubs); /*39*/$temp['fetrespubs'] = $this->doQuery($fetrespubs); /*40*/$temp['fetembpubs'] = $this->doQuery($fetembpubs); /*41*/$temp['datasetpubs'] = $this->doQuery($datasetpubs); /*42*/$temp['datasetproj'] = $this->doQuery($datasetproj); /*43*/$temp['pubsdatasets'] = $this->doQuery($pubsdatasets); /*44*/$temp['egivo'] = $this->doQuery($egivo); /*45*/$temp['egiproj'] = $this->doQuery($egiproj); /*46*/$temp['egipubs'] = $this->doQuery($egipubs); /*44*/$temp['egioa'] = $this->doQuery($egioa); /*45*/$temp['egiemb'] = $this->doQuery($egiemb); /*46*/$temp['egires'] = $this->doQuery($egires); /*44*/$temp['res'] = $this->doQuery($res); /*45*/$temp['dtsrcdatarepo'] = $this->doQuery($dtsrcdatarepo); /*46*/$temp['egiprojtotal'] = $this->doQuery($egiprojtotal); /*47*/$temp['h2020pubstotal'] = $this->doQuery($h2020pubstotal); /*48*/$temp['h2020projpubs'] = $this->doQuery($h2020projpubs); /*49*/$temp['h2020projtotal'] = $this->doQuery($h2020projtotal); /*50*/$temp['h2020oapubs'] = $this->doQuery($h2020oapubs); /*50*/$temp['h2020respubs'] = $this->doQuery($h2020respubs); /*51*/$temp['h2020embpubs'] = $this->doQuery($h2020embpubs); //NWO /*22*/$temp['nwopubstotal'] = $this->doQuery($qnwopubstotal); /*23*/$temp['nwoprojpubs'] = $this->doQuery($qnwoprojpubs); /*24*/$temp['nwoprojtotal'] = $this->doQuery($qnwoprojtotal); /*25*/$temp['nwooapubs'] = $this->doQuery($qnwooapubs); /*26*/$temp['nworespubs'] = $this->doQuery($qnworespubs); /*27*/$temp['nwoembpubs'] = $this->doQuery($qnwoembpubs); /*MESTD*/ /*22*/$temp['mestdpubstotal'] = $this->doQuery($qmestdpubstotal); /*23*/$temp['mestdprojpubs'] = $this->doQuery($qmestdprojpubs); /*24*/$temp['mestdprojtotal'] = $this->doQuery($qmestdprojtotal); /*25*/$temp['mestdoapubs'] = $this->doQuery($qmestdoapubs); /*26*/$temp['mestdrespubs'] = $this->doQuery($qmestdrespubs); /*27*/$temp['mestdembpubs'] = $this->doQuery($qmestdembpubs); //SFI NUMS $this->storeQuery('sfipubstotal', $qsfipubstotal); $this->storeQuery('sfiprojpubs', $qsfiprojpubs); $this->storeQuery('sfiprojtotal', $qsfiprojtotal); $this->storeQuery('sfioapubs', $qsfioapubs); $this->storeQuery('sfirespubs', $qsfirespubs); $this->storeQuery('sfiembpubs', $qsfiembpubs); //MZOS NUMS $this->storeQuery('mzospubstotal', $qmzospubstotal); $this->storeQuery('mzosprojpubs', $qmzosprojpubs); $this->storeQuery('mzosprojtotal', $qmzosprojtotal); $this->storeQuery('mzosoapubs', $qmzosoapubs); $this->storeQuery('mzosrespubs', $qmzosrespubs); $this->storeQuery('mzosembpubs', $qmzosembpubs); //TUBITAK NUMS $this->storeQuery('tubitakpubstotal', $qtubitakpubstotal); $this->storeQuery('tubitakprojpubs', $qtubitakprojpubs); $this->storeQuery('tubitakprojtotal', $qtubitakprojtotal); $this->storeQuery('tubitakoapubs', $qtubitakoapubs); $this->storeQuery('tubitakrespubs', $qtubitakrespubs); $this->storeQuery('tubitakembpubs', $qtubitakembpubs); //RCUK NUMS $this->storeQuery('rcukpubstotal', $qrcukpubstotal); $this->storeQuery('rcukprojpubs', $qrcukprojpubs); $this->storeQuery('rcukprojtotal', $qrcukprojtotal); $this->storeQuery('rcukoapubs', $qrcukoapubs); $this->storeQuery('rcukrespubs', $qrcukrespubs); $this->storeQuery('rcukembpubs', $qrcukembpubs); //SNSF NUMS $this->storeQuery('snsfpubstotal', $qsnsfpubstotal); $this->storeQuery('snsfprojpubs', $qsnsfprojpubs); $this->storeQuery('snsfprojtotal', $qsnsfprojtotal); $this->storeQuery('snsfoapubs', $qsnsfoapubs); $this->storeQuery('snsfrespubs', $qsnsfrespubs); $this->storeQuery('snsfembpubs', $qsnsfembpubs); //FWF NUMS $this->storeQuery('fwfpubstotal', $qfwfpubstotal); $this->storeQuery('fwfprojpubs', $qfwfprojpubs); $this->storeQuery('fwfprojtotal', $qfwfprojtotal); $this->storeQuery('fwfoapubs', $qfwfoapubs); $this->storeQuery('fwfrespubs', $qfwfrespubs); $this->storeQuery('fwfembpubs', $qfwfembpubs); //NSF NUMS $this->storeQuery('nsfpubstotal', $qnsfpubstotal); $this->storeQuery('nsfprojpubs', $qnsfprojpubs); $this->storeQuery('nsfprojtotal', $qnsfprojtotal); $this->storeQuery('nsfoapubs', $qnsfoapubs); $this->storeQuery('nsfrespubs', $qnsfrespubs); $this->storeQuery('nsfembpubs', $qnsfembpubs); //NIH NUMS $this->storeQuery('nihpubstotal', $qnihpubstotal); $this->storeQuery('nihprojpubs', $qnihprojpubs); $this->storeQuery('nihprojtotal', $qnihprojtotal); $this->storeQuery('nihoapubs', $qnihoapubs); $this->storeQuery('nihrespubs', $qnihrespubs); $this->storeQuery('nihembpubs', $qnihembpubs); //NHMRC NUMS $this->storeQuery('nhmrcpubstotal', $qnhmrcpubstotal); $this->storeQuery('nhmrcprojpubs', $qnhmrcprojpubs); $this->storeQuery('nhmrcprojtotal', $qnhmrcprojtotal); $this->storeQuery('nhmrcoapubs', $qnhmrcoapubs); $this->storeQuery('nhmrcrespubs', $qnhmrcrespubs); $this->storeQuery('nhmrcembpubs', $qnhmrcembpubs); //CSF NUMS $this->storeQuery('csfpubstotal', $qcsfpubstotal); $this->storeQuery('csfprojpubs', $qcsfprojpubs); $this->storeQuery('csfprojtotal', $qcsfprojtotal); $this->storeQuery('csfoapubs', $qcsfoapubs); $this->storeQuery('csfrespubs', $qcsfrespubs); $this->storeQuery('csfembpubs', $qcsfembpubs); //ARC NUMS $this->storeQuery('arcpubstotal', $qarcpubstotal); $this->storeQuery('arcprojpubs', $qarcprojpubs); $this->storeQuery('arcprojtotal', $qarcprojtotal); $this->storeQuery('arcoapubs', $qarcoapubs); $this->storeQuery('arcrespubs', $qarcrespubs); $this->storeQuery('arcembpubs', $qarcembpubs); //EC NUMS $this->storeQuery('ecpubstotal', $qecpubstotal); $this->storeQuery('ecprojpubs', $qecprojpubs); $this->storeQuery('ecprojtotal', $qecprojtotal); $this->storeQuery('ecoapubs', $qecoapubs); $this->storeQuery('ecrespubs', $qecrespubs); $this->storeQuery('ecembpubs', $qecembpubs); if($addflag){ JLog:: add("params to store: ".print_r($temp, TRUE), JLog :: ERROR, 'stats'); $this->cache = new Predis\Client(array( "scheme" => $this->params->get('cachescheme'), "host" => $this->params->get('cacheserver'), "port" => $this->params->get('cacheport'))); $this->cache->connect(); $this->cache->hmset("STATS_NUMBERS", $temp); $this->cache->save(); $this->cache->quit(); } return $temp; } private function doQuery($query){ $stmt = $this->db->query($query); if(!$stmt){ $arr = $this->db->errorInfo(); JLog :: add("Error executing query: ".$query." ".$arr[2], JLog :: ERROR, 'stats'); return "-"; } $t = $stmt->fetch(); return number_format($t[0]); } } ?>