100 |
100 |
const DATASET_AUTHOR_ID = 'relpersonid';
|
101 |
101 |
const DATASET_ID = 'objIdentifier';
|
102 |
102 |
const PROJECT_QUERY = '(oaftype exact project)';
|
|
103 |
const PROJECT = 'project';
|
103 |
104 |
const PROJECT_FUNDER = 'funderid';
|
104 |
105 |
const PROJECT_FUNDING_STREAM = 'fundinglevel0_id';
|
105 |
106 |
const PROJECT_SCIENTIFIC_AREA = 'fundinglevel1_id';
|
... | ... | |
212 |
213 |
// Retrieve publication statistics using cache if enabled.
|
213 |
214 |
// $locale the locale to use
|
214 |
215 |
// return statistics (object)
|
215 |
|
public function getPublicationStatistics($locale) {
|
|
216 |
public function getPublicationStatistics($locale,$allFunders) {
|
216 |
217 |
if ($this->cache->getCaching()) {
|
217 |
|
$cacheId = self :: PUBLICATION_STATISTICS_CACHE_ID . '.' . $locale;
|
|
218 |
$cacheId = self :: PUBLICATION_STATISTICS_CACHE_ID . '.' . $locale.'.'.$allFunders;
|
218 |
219 |
$statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
|
219 |
220 |
if ($statistics === FALSE) {
|
220 |
|
$statistics = $this->_getPublicationStatistics($locale);
|
|
221 |
$statistics = $this->_getPublicationStatistics($locale,$allFunders);
|
221 |
222 |
if ($statistics !== NULL)
|
222 |
223 |
$this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
|
223 |
224 |
}
|
224 |
225 |
} else
|
225 |
|
$statistics = $this->_getPublicationStatistics($locale);
|
|
226 |
$statistics = $this->_getPublicationStatistics($locale,$allFunders);
|
226 |
227 |
return $statistics;
|
227 |
228 |
}
|
228 |
229 |
|
... | ... | |
231 |
232 |
// return statistics (object)
|
232 |
233 |
public function getDatasetStatistics($locale) {
|
233 |
234 |
if ($this->cache->getCaching()) {
|
234 |
|
$cacheId = self :: DATASET_STATISTICS_CACHE_ID . '.' . $locale;
|
|
235 |
$cacheId = self :: DATASET_STATISTICS_CACHE_ID . '.' . $locale.'.'. $allFunders;
|
235 |
236 |
$statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
|
236 |
237 |
if ($statistics === FALSE) {
|
237 |
|
$statistics = $this->_getDatasetStatistics($locale);
|
|
238 |
$statistics = $this->_getDatasetStatistics($locale, $allFunders);
|
238 |
239 |
if ($statistics !== NULL)
|
239 |
240 |
$this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
|
240 |
241 |
}
|
241 |
242 |
} else
|
242 |
|
$statistics = $this->_getDatasetStatistics($locale);
|
|
243 |
$statistics = $this->_getDatasetStatistics($locale, $allFunders);
|
243 |
244 |
return $statistics;
|
244 |
245 |
}
|
245 |
246 |
|
246 |
247 |
// Retrieve project statistics using cache if enabled.
|
247 |
248 |
// $locale the locale to use
|
248 |
249 |
// return statistics (object)
|
249 |
|
public function getProjectStatistics($locale) {
|
|
250 |
public function getProjectStatistics($locale, $allFunders) {
|
250 |
251 |
if ($this->cache->getCaching()) {
|
251 |
|
$cacheId = self :: PROJECT_STATISTICS_CACHE_ID . '.' . $locale;
|
|
252 |
$cacheId = self :: PROJECT_STATISTICS_CACHE_ID . '.' . $locale.'.'. $allFunders;
|
252 |
253 |
$statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
|
253 |
254 |
if ($statistics === FALSE) {
|
254 |
|
$statistics = $this->_getProjectStatistics($locale);
|
|
255 |
$statistics = $this->_getProjectStatistics($locale, $allFunders);
|
255 |
256 |
if ($statistics !== NULL)
|
256 |
257 |
$this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
|
257 |
258 |
}
|
258 |
259 |
} else
|
259 |
|
$statistics = $this->_getProjectStatistics($locale);
|
|
260 |
$statistics = $this->_getProjectStatistics($locale, $allFunders);
|
260 |
261 |
return $statistics;
|
261 |
262 |
}
|
262 |
263 |
|
... | ... | |
1035 |
1036 |
$organizations = $this->_quickSearchOrganizations($keyword, $limit, $locale);
|
1036 |
1037 |
return $organizations;
|
1037 |
1038 |
}
|
1038 |
|
|
|
1039 |
|
1039 |
1040 |
// Retrieve publication statistics.
|
1040 |
1041 |
// $locale the locale to use
|
|
1042 |
// $allFunders get all fields for funders
|
1041 |
1043 |
// return statistics (object)
|
1042 |
|
private function _getPublicationStatistics($locale) {
|
1043 |
|
try {
|
|
1044 |
private function _getPublicationStatistics($locale, $allFunders=false) {
|
|
1045 |
try {
|
1044 |
1046 |
$time = microtime(TRUE);
|
1045 |
1047 |
$query = self :: PUBLICATION_QUERY;
|
1046 |
1048 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
... | ... | |
1055 |
1057 |
if ($document->loadXML($response->body) == FALSE)
|
1056 |
1058 |
throw new Exception('invalid XML response');
|
1057 |
1059 |
$xpath = new DOMXPath($document);
|
1058 |
|
/* $statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'project', 'year', 'accessMode', 'datasource', 'community'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'CONTEXT'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
|
1059 |
|
'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE, self :: PUBLICATION_CONTEXT));
|
1060 |
|
|
1061 |
|
*/
|
1062 |
|
$statistics = $this->createStatistics($xpath,
|
|
1060 |
$statistics=null;
|
|
1061 |
if($allFunders){
|
|
1062 |
$statistics = $this->createStatistics($xpath,
|
1063 |
1063 |
array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'year', 'accessMode', 'datasource', 'community'),
|
1064 |
1064 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'),
|
1065 |
1065 |
array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
|
1066 |
1066 |
'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'),
|
1067 |
1067 |
array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, 'resultcollectedfromdatasourceid' , self :: PUBLICATION_CONTEXT));
|
|
1068 |
}else{
|
|
1069 |
$statistics = $this->createStatistics($xpath,
|
|
1070 |
array('type', 'languageFilter', 'funder', 'year', 'accessMode', 'datasource', 'community'),
|
|
1071 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'),
|
|
1072 |
array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
|
|
1073 |
'NO_FUNDER_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'),
|
|
1074 |
array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, 'resultcollectedfromdatasourceid' , self :: PUBLICATION_CONTEXT));
|
1068 |
1075 |
|
|
1076 |
}
|
1069 |
1077 |
JLog :: add('Retrieved publication statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1070 |
1078 |
return $statistics;
|
1071 |
1079 |
} catch (Exception $e) {
|
... | ... | |
1074 |
1082 |
}
|
1075 |
1083 |
}
|
1076 |
1084 |
|
|
1085 |
|
1077 |
1086 |
// Retrieve dataset statistics.
|
1078 |
1087 |
// $locale the locale to use
|
1079 |
1088 |
// return statistics (object)
|
1080 |
|
private function _getDatasetStatistics($locale) {
|
|
1089 |
private function _getDatasetStatistics($locale, $allFunders=false) {
|
1081 |
1090 |
try {
|
1082 |
1091 |
$time = microtime(TRUE);
|
1083 |
1092 |
$query = self :: DATASET_QUERY;
|
... | ... | |
1091 |
1100 |
if ($document->loadXML($response->body) == FALSE)
|
1092 |
1101 |
throw new Exception('invalid XML response');
|
1093 |
1102 |
$xpath = new DOMXPath($document);
|
1094 |
|
$statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
|
|
1103 |
$statistics=null;
|
|
1104 |
if($allFunders){
|
|
1105 |
$statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
|
|
1106 |
}else{
|
|
1107 |
$statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
|
|
1108 |
}
|
1095 |
1109 |
JLog :: add('Retrieved dataset statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1096 |
1110 |
return $statistics;
|
1097 |
1111 |
} catch (Exception $e) {
|
... | ... | |
1103 |
1117 |
// Retrieve project statistics.
|
1104 |
1118 |
// $locale the locale to use
|
1105 |
1119 |
// return statistics (object)
|
1106 |
|
private function _getProjectStatistics($locale) {
|
|
1120 |
private function _getProjectStatistics($locale, $allFunders) {
|
1107 |
1121 |
try {
|
1108 |
1122 |
$time = microtime(TRUE);
|
1109 |
1123 |
$query = self :: PROJECT_QUERY;
|
1110 |
1124 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1111 |
1125 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1126 |
//if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
1112 |
1127 |
throw new Exception('no HTTP response');
|
1113 |
1128 |
if ($response->code != self :: HTTP_OK)
|
1114 |
1129 |
throw new Exception('HTTP response code ' . $response->code);
|
... | ... | |
1116 |
1131 |
$document->recover = TRUE;
|
1117 |
1132 |
if ($document->loadXML($response->body) == FALSE)
|
1118 |
1133 |
throw new Exception('invalid XML response');
|
|
1134 |
$statistics=null;
|
1119 |
1135 |
$xpath = new DOMXPath($document);
|
1120 |
|
$statistics = $this->createStatistics($xpath,
|
|
1136 |
if( $allFunders){
|
|
1137 |
$statistics = $this->createStatistics($xpath,
|
1121 |
1138 |
array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'),
|
1122 |
1139 |
array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'),
|
1123 |
1140 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'),
|
1124 |
1141 |
array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
|
|
1142 |
}else{
|
|
1143 |
$statistics = $this->createStatistics($xpath,
|
|
1144 |
array('funder', 'startYear', 'endYear', 'sc39'),
|
|
1145 |
array('FUNDER', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'),
|
|
1146 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'),
|
|
1147 |
array(self :: PROJECT_FUNDER, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
|
|
1148 |
}
|
1125 |
1149 |
JLog :: add('Retrieved project statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1126 |
1150 |
return $statistics;
|
1127 |
1151 |
} catch (Exception $e) {
|
... | ... | |
1329 |
1353 |
$query .= ($types == NULL) ? '' : (' and (' . $types . ')');
|
1330 |
1354 |
$query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
|
1331 |
1355 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
|
1332 |
|
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
1356 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){
|
|
1357 |
$temp='';
|
|
1358 |
foreach(split(',',$funder) as $id){
|
|
1359 |
if(!empty($id)){
|
|
1360 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
}
|
|
1364 |
$query .= (' and (' . substr($temp, 0, -3). ')');
|
|
1365 |
}else{
|
|
1366 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
1367 |
}
|
|
1368 |
//$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
1333 |
1369 |
$query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
|
1334 |
1370 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
|
1335 |
1371 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
|
... | ... | |
1341 |
1377 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1342 |
1378 |
$completeQuery='search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1343 |
1379 |
if($isRefine){
|
1344 |
|
$completeQuery='search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale);
|
|
1380 |
$completeQuery='search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION) . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale);
|
1345 |
1381 |
}
|
1346 |
1382 |
//if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
1347 |
1383 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
... | ... | |
1358 |
1394 |
$result->totalDatasets = 0;
|
1359 |
1395 |
$result->publications = $this->parsePublications($xpath);
|
1360 |
1396 |
$result->statistics = $isRefine? $this->createStatisticsForPublications($xpath):NULL;
|
|
1397 |
$result->statistics = self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1361 |
1398 |
//$this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'project', 'year', 'accessMode', 'datasource'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND','NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self::PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE));
|
1362 |
1399 |
JLog :: add('Simple search retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', articles: ' . ($articles ? 'true' : 'false') . ', books: ' . ($books ? 'true' : 'false') . ', theses: ' . ($theses ? 'true' : 'false') . ', reports: ' . ($reports ? 'true' : 'false') . ', type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1363 |
1400 |
return $result;
|
... | ... | |
1435 |
1472 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: DATASET_ACCESS_MODE . ' exact "' . $accessMode . '")');
|
1436 |
1473 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: DATASET_DATASOURCE . ' exact "' . $datasource . '")');
|
1437 |
1474 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1438 |
|
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . '&fields=' . self :: DATASET_FUNDER . '&fields=' . self :: DATASET_FUNDING_STREAM . '&fields=' . self :: DATASET_SCIENTIFIC_AREA .'&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2. '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
|
|
1475 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::DATASET) . '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
|
1439 |
1476 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1440 |
1477 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
1441 |
1478 |
throw new Exception('no HTTP response');
|
... | ... | |
1450 |
1487 |
$result->totalDatasets = $this->parseTotalResults($xpath);
|
1451 |
1488 |
$result->datasets = $this->parseDatasets($xpath);
|
1452 |
1489 |
$result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL;
|
|
1490 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1453 |
1491 |
//createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('DATASET_TYPE', 'DATASET_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
|
1454 |
1492 |
JLog :: add('Simple search retrieved ' . count($result->datasets) . ' datasets in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1455 |
1493 |
return $result;
|
... | ... | |
1484 |
1522 |
$query .= ($endYear == NULL) ? '' : (' and (' . self :: PROJECT_END_YEAR . ' exact ' . $endYear . ')');
|
1485 |
1523 |
$query .= ($sc39 === NULL) ? '' : (' and (' . self :: PROJECT_SC39 . ' exact ' . ($sc39 ? 'true' : 'false') . ')');
|
1486 |
1524 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1487 |
|
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA .'&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
|
|
1525 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PROJECT) . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
|
1488 |
1526 |
:'search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1489 |
1527 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
1490 |
1528 |
throw new Exception('no HTTP response');
|
... | ... | |
1499 |
1537 |
$result->totalProjects = $this->parseTotalResults($xpath);
|
1500 |
1538 |
$result->projects = $this->parseProjects($xpath);
|
1501 |
1539 |
$result->statistics = $isRefine?$this->createStatisticsForProjects($xpath,''):NULL;
|
|
1540 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1502 |
1541 |
//createStatistics($xpath, array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'), array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
|
1503 |
1542 |
JLog :: add('Simple search retrieved ' . count($result->projects) . ' projects in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', start year: ' . (($startYear == NULL) ? 'null' : $startYear) . ', end year: ' . (($endYear == NULL) ? 'null' : $endYear) . ', SC-39: ' . (($sc39 === NULL) ? 'null' : ($sc39 ? 'true' : 'false')) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1504 |
1543 |
return $result;
|
... | ... | |
1739 |
1778 |
$query = self :: PUBLICATION_QUERY;
|
1740 |
1779 |
$query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
|
1741 |
1780 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
|
1742 |
|
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
1781 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){
|
|
1782 |
$temp='';
|
|
1783 |
foreach(split(',',$funder) as $id){
|
|
1784 |
if(!empty($id)){
|
|
1785 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
|
|
1786 |
}
|
|
1787 |
|
|
1788 |
}
|
|
1789 |
$query .= (' and (' . substr($temp, 0, -3). ')');
|
|
1790 |
}else{
|
|
1791 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
1792 |
}
|
1743 |
1793 |
$query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
|
1744 |
1794 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
|
1745 |
1795 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
|
... | ... | |
1750 |
1800 |
$query .= ($author == NULL) ? '' : (' and (' . self :: PUBLICATION_AUTHOR_ID . ' exact "' . $author . '")');
|
1751 |
1801 |
$query .= ($community == NULL) ? '' : (' and (' . self :: PUBLICATION_CONTEXT . ' exact "' . $community . '")');
|
1752 |
1802 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1753 |
|
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2.'&fields=' . self :: PUBLICATION_PROJECT . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT ). '&locale=' . str_replace('-', '_', $locale):
|
|
1803 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION).'&fields=' . self :: PUBLICATION_PROJECT . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT ). '&locale=' . str_replace('-', '_', $locale):
|
1754 |
1804 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1755 |
1805 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
1756 |
1806 |
throw new Exception('no HTTP response');
|
... | ... | |
1765 |
1815 |
$result->totalPublications = $this->parseTotalResults($xpath);
|
1766 |
1816 |
$result->publications = $this->parsePublications($xpath);
|
1767 |
1817 |
$result->statistics = $isRefine?$this->createStatisticsForPublications($xpath):NULL;
|
|
1818 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1768 |
1819 |
//$this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'project', 'year', 'accessMode', 'datasource', 'community'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL_2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITY'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL_2_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self::PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE, self :: PUBLICATION_CONTEXT));
|
1769 |
1820 |
$result->totalDatasets = 0;
|
1770 |
1821 |
JLog :: add('Browse retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', community: ' . (($community == NULL) ? 'null' : $community) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . ')', JLog :: INFO, self :: LOG);
|
... | ... | |
1773 |
1824 |
JLog :: add('Error performing publication browse (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', community: ' . (($community == NULL) ? 'null' : $community) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG);
|
1774 |
1825 |
return NULL;
|
1775 |
1826 |
}
|
1776 |
|
}
|
1777 |
|
public function browsePublicationsRaw($query) {
|
|
1827 |
}
|
|
1828 |
public static function pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter){
|
|
1829 |
return self::_pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter);
|
|
1830 |
}
|
|
1831 |
private static function _pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter=''){
|
|
1832 |
if($statistics==NULL){
|
|
1833 |
return NULL;
|
|
1834 |
}
|
|
1835 |
if($fundingStreamLevel1!=NULL){
|
|
1836 |
$newData= array();
|
|
1837 |
foreach ($statistics["fundingStreamLevel2".$filter]->data as $data){
|
|
1838 |
if(strpos($data->id,$fundingStreamLevel1)!==FALSE){
|
|
1839 |
$newData[$data->id]=$data;
|
|
1840 |
}
|
|
1841 |
}
|
|
1842 |
$statistics["fundingStreamLevel2".$filter]->data=$newData;
|
|
1843 |
}
|
|
1844 |
if($fundingStream!=NULL){
|
|
1845 |
$newData= array();
|
|
1846 |
foreach ($statistics["fundingStreamLevel1".$filter]->data as $data){
|
|
1847 |
if(strpos($data->id,$fundingStream)!==FALSE){
|
|
1848 |
$newData[$data->id]=$data;
|
|
1849 |
}
|
|
1850 |
}
|
|
1851 |
$statistics["fundingStreamLevel1".$filter]->data=$newData;
|
|
1852 |
}
|
|
1853 |
if($funder!=NULL){
|
|
1854 |
$newData= array();
|
|
1855 |
if(strpos($funder, ',') !== FALSE){
|
|
1856 |
foreach ($statistics["fundingStream".$filter]->data as $data){
|
|
1857 |
foreach(split(',',$funder) as $id){
|
|
1858 |
if(!empty($id) && (strpos($data->id,$id)!==FALSE)){
|
|
1859 |
$newData[$data->id]=$data;
|
|
1860 |
}
|
|
1861 |
}
|
|
1862 |
}
|
|
1863 |
}else{
|
|
1864 |
foreach ($statistics["fundingStream".$filter]->data as $data){
|
|
1865 |
if(strpos($data->id,$funder)!==FALSE){
|
|
1866 |
$newData[$data->id]=$data;
|
|
1867 |
}
|
|
1868 |
}
|
|
1869 |
}
|
|
1870 |
$statistics["fundingStream".$filter]->data=$newData;
|
|
1871 |
|
|
1872 |
}
|
|
1873 |
return $statistics;
|
|
1874 |
}
|
|
1875 |
//Reduces the Funding Fields
|
|
1876 |
//$funder filter for funder
|
|
1877 |
//$fundingStream filter for funding stream
|
|
1878 |
//$fundingStreamLevel1 filter for fundingStreamLevel1
|
|
1879 |
//$fundingStreamLevel2 filter for fundingStreamLevel2
|
|
1880 |
private static function _getFundingFields($funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $type){
|
|
1881 |
$field = self::_getFundingFieldsPerType($type);
|
|
1882 |
$f = array();
|
|
1883 |
$f[0]=true;
|
|
1884 |
for($i=1;$i<4;$i++){
|
|
1885 |
$f[$i]=false;
|
|
1886 |
}
|
|
1887 |
if($fundingStreamLevel2 !== null && !empty($fundingStreamLevel2)){
|
|
1888 |
$f[3]=true;
|
|
1889 |
}if($fundingStreamLevel1 !== NULL && strlen($fundingStreamLevel1)>0){
|
|
1890 |
$f[2]=true;
|
|
1891 |
$f[3]=true;
|
|
1892 |
} if($fundingStream !== NULL && strlen($fundingStream)>0){
|
|
1893 |
$f[1]=true;
|
|
1894 |
$f[2]=true;
|
|
1895 |
} if($funder !== NULL && strlen($funder)>0){
|
|
1896 |
$f[0]=true;
|
|
1897 |
$f[1]=true;
|
|
1898 |
}
|
|
1899 |
$returnedFields='';
|
|
1900 |
$none=true;
|
|
1901 |
for($i=0;$i<4;$i++){
|
|
1902 |
if($f[$i]){
|
|
1903 |
$returnedFields.=($f[$i])?$field[$i]:'';
|
|
1904 |
$none=false;
|
|
1905 |
}
|
|
1906 |
}
|
|
1907 |
$returnedFields=($none)?$field[0].$field[1]:$returnedFields;
|
|
1908 |
return $returnedFields;
|
|
1909 |
}
|
|
1910 |
|
|
1911 |
private function _getFundingFieldsPerType($type){
|
|
1912 |
$field=array();
|
|
1913 |
switch ($type) {
|
|
1914 |
case self::PUBLICATION:
|
|
1915 |
$field[3]='&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2;
|
|
1916 |
$field[2]='&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA;
|
|
1917 |
$field[1]='&fields=' . self :: PUBLICATION_FUNDING_STREAM;
|
|
1918 |
$field[0]='&fields=' . self :: PUBLICATION_FUNDER;
|
|
1919 |
break;
|
|
1920 |
case self::DATASET:
|
|
1921 |
$field[3]='&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2;
|
|
1922 |
$field[2]='&fields=' . self :: DATASET_SCIENTIFIC_AREA;
|
|
1923 |
$field[1]='&fields=' . self :: DATASET_FUNDING_STREAM;
|
|
1924 |
$field[0]='&fields=' . self :: DATASET_FUNDER;
|
|
1925 |
break;
|
|
1926 |
case self::PROJECT:
|
|
1927 |
$field[3]='&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2;
|
|
1928 |
$field[2]='&fields=' . self :: PROJECT_SCIENTIFIC_AREA;
|
|
1929 |
$field[1]='&fields=' . self :: PROJECT_FUNDING_STREAM;
|
|
1930 |
$field[0]='&fields=' . self :: PROJECT_FUNDER;
|
|
1931 |
break;
|
|
1932 |
}
|
|
1933 |
|
|
1934 |
return $field;
|
|
1935 |
}
|
|
1936 |
public static function browsePublicationsRaw($query) {
|
1778 |
1937 |
try {
|
1779 |
1938 |
$time = microtime(TRUE);
|
1780 |
1939 |
|
... | ... | |
1836 |
1995 |
$query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT . ' exact "' . $project . '")');
|
1837 |
1996 |
$query .= ($author == NULL) ? '' : (' and (' . self :: DATASET_AUTHOR_ID . ' exact "' . $author . '")');
|
1838 |
1997 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1839 |
|
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . '&fields=' . self :: DATASET_FUNDER . '&fields=' . self :: DATASET_FUNDING_STREAM . '&fields=' . self :: DATASET_SCIENTIFIC_AREA . '&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
|
|
1998 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::DATASET) .'&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
|
1840 |
1999 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1841 |
2000 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
1842 |
2001 |
throw new Exception('no HTTP response');
|
... | ... | |
1851 |
2010 |
$result->totalDatasets = $this->parseTotalResults($xpath);
|
1852 |
2011 |
$result->datasets = $this->parseDatasets($xpath);
|
1853 |
2012 |
$result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL;
|
|
2013 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1854 |
2014 |
//createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('DATASET_TYPE', 'DATASET_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
|
1855 |
2015 |
JLog :: add('Browse retrieved ' . count($result->datasets) . ' datasets in ' . (microtime(TRUE) - $time) . ' s (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . ')', JLog :: INFO, self :: LOG);
|
1856 |
2016 |
return $result;
|
... | ... | |
1875 |
2035 |
try {
|
1876 |
2036 |
$time = microtime(TRUE);
|
1877 |
2037 |
$query = self :: PROJECT_QUERY;
|
1878 |
|
$query .= ($funder == NULL) ? '' : (' and (' . self :: PROJECT_FUNDER . ' exact "' . $funder . '")');
|
|
2038 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){
|
|
2039 |
$temp='';
|
|
2040 |
foreach(split(',',$funder) as $id){
|
|
2041 |
if(!empty($id)){
|
|
2042 |
$temp.='(' . self :: PROJECT_FUNDER . ' exact "' . $id . '") and';
|
|
2043 |
}
|
|
2044 |
|
|
2045 |
}
|
|
2046 |
$query .= (' and (' . substr($temp, 0, -3). ')');
|
|
2047 |
}else{
|
|
2048 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PROJECT_FUNDER . ' exact "' . $funder . '")');
|
|
2049 |
}
|
1879 |
2050 |
$query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PROJECT_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
|
1880 |
2051 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PROJECT_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
|
1881 |
2052 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PROJECT_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
|
... | ... | |
1883 |
2054 |
$query .= ($endYear == NULL) ? '' : (' and (' . self :: PROJECT_END_YEAR . ' exact ' . $endYear . ')');
|
1884 |
2055 |
$query .= ($sc39 === NULL) ? '' : (' and (' . self :: PROJECT_SC39 . ' exact ' . ($sc39 ? 'true' : 'false') . ')');
|
1885 |
2056 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
1886 |
|
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA . '&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2. '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
|
|
2057 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PROJECT) . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
|
1887 |
2058 |
:'search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
1888 |
2059 |
if (($response = $this->performGet($completeQuery)) == NULL)
|
1889 |
2060 |
throw new Exception('no HTTP response');
|
... | ... | |
1898 |
2069 |
$result->totalProjects = $this->parseTotalResults($xpath);
|
1899 |
2070 |
$result->projects = $this->parseProjects($xpath);
|
1900 |
2071 |
$result->statistics = $isRefine? $this->createStatisticsForProjects($xpath):NULL;
|
|
2072 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
1901 |
2073 |
//createStatistics($xpath, array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'), array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
|
1902 |
2074 |
JLog :: add('Browse retrieved ' . count($result->projects) . ' projects in ' . (microtime(TRUE) - $time) . ' s (funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', start year: ' . (($startYear == NULL) ? 'null' : $startYear) . ', end year: ' . (($endYear == NULL) ? 'null' : $endYear) . ', SC-39: ' . (($sc39 === NULL) ? 'null' : ($sc39 ? 'true' : 'false')) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
1903 |
2075 |
return $result;
|
... | ... | |
2223 |
2395 |
}, $datasources)) . ')');
|
2224 |
2396 |
$query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
|
2225 |
2397 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
|
2226 |
|
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
2398 |
//$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
2399 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){
|
|
2400 |
$temp='';
|
|
2401 |
foreach(split(',',$funder) as $id){
|
|
2402 |
if(!empty($id)){
|
|
2403 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
|
|
2404 |
}
|
|
2405 |
|
|
2406 |
}
|
|
2407 |
$query .= (' and (' . substr($temp, 0, -3). ')');
|
|
2408 |
}else{
|
|
2409 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
|
|
2410 |
}
|
2227 |
2411 |
$query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
|
2228 |
2412 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
|
2229 |
2413 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
|
... | ... | |
2231 |
2415 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")');
|
2232 |
2416 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: PUBLICATION_DATASOURCE . ' exact "' . $datasource . '")');
|
2233 |
2417 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
|
2234 |
|
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2. '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
2418 |
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION). '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
2235 |
2419 |
throw new Exception('no HTTP response');
|
2236 |
2420 |
if ($response->code != self :: HTTP_OK)
|
2237 |
2421 |
throw new Exception('HTTP response code ' . $response->code);
|
... | ... | |
2244 |
2428 |
$result->totalPublications = $this->parseTotalResults($xpath);
|
2245 |
2429 |
$result->publications = $this->parsePublications($xpath);
|
2246 |
2430 |
$result->statistics =$this->createStatisticsForPublications($xpath,'Filter');
|
|
2431 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,"Filter");
|
2247 |
2432 |
//$this->createStatistics($xpath, array('typeFilter', 'languageFilter', 'funderFilter', 'fundingStreamFilter', 'scientificAreaFilter', 'yearFilter', 'accessModeFilter', 'datasourceFilter'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE));
|
2248 |
2433 |
JLog :: add('Advanced search retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], types: [' . implode(', ', $types) . '], languages: [' . implode(', ', $languages) . '], funders: [' . implode(', ', $funders) . '], funding streams: [' . implode(', ', $fundingStreams) . '], scientific areas: [' . implode(', ', $scientificAreas) . '], date: ' . $date . ', from month: ' . $fromMonth . ', from year: ' . $fromYear . ', to month: ' . $toMonth . ', to year: ' . $toYear . ', access modes: [' . implode(', ', $accessModes) . '], datasources: [' . implode(', ', $datasources) . '], type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
|
2249 |
2434 |
return $result;
|
in refine area of browse/ search pages: when filter by funder show 'also funded by' filter and use only the next level of funding streams