Revision 45946
Added by Argiro Kokogiannaki over 7 years ago
search.php | ||
---|---|---|
58 | 58 |
const RESULT_QUERY = '(oaftype exact result)'; |
59 | 59 |
const RESULT_ID = 'objIdentifier'; |
60 | 60 |
const PUBLICATION_QUERY = '(oaftype exact result) and (resulttypeid exact publication)'; |
61 |
const PUBLICATION_TYPE = 'instancetypenameid';
|
|
62 |
const PUBLICATION_LANGUAGE = 'resultlanguageid';
|
|
63 |
const PUBLICATION_CONTEXT = 'communityid';
|
|
64 |
const PUBLICATION_FUNDER = 'relfunderid';
|
|
61 |
const PUBLICATION_TYPE = 'instancetypename'; |
|
62 |
const PUBLICATION_LANGUAGE = 'resultlanguagename';
|
|
63 |
const PUBLICATION_CONTEXT = 'community'; |
|
64 |
const PUBLICATION_FUNDER = 'relfunder'; |
|
65 | 65 |
const PUBLICATION_FUNDING_STREAM = 'relfundinglevel0_id'; |
66 | 66 |
const PUBLICATION_SCIENTIFIC_AREA = 'relfundinglevel1_id'; |
67 | 67 |
const PUBLICATION_FUNDING_STREAM_LEVEL2 = 'relfundinglevel2_id'; |
68 | 68 |
const PUBLICATION_YEAR = 'resultacceptanceyear'; |
69 | 69 |
const PUBLICATION_ACCESS_MODE = 'resultbestlicense'; |
70 |
const PUBLICATION_DATASOURCE = 'resulthostingdatasourceid'; |
|
71 |
const RESULT_DATASOURCE = 'collectedfromdatasourceid'; |
|
72 |
const PUBLICATION_PROJECT = 'relprojectid'; |
|
70 |
const RESULT_HOSTING_DATASOURCE = 'resulthostingdatasource'; |
|
71 |
const RESULT_HOSTING_DATASOURCE_ID = 'resulthostingdatasourceid'; |
|
72 |
const RESULT_COLLECTED_FROM_DATASOURCE = 'collectedfrom'; |
|
73 |
const RESULT_COLLECTED_FROM_DATASOURCE_ID = 'collectedfromdatasourceid'; |
|
74 |
const PUBLICATION_PROJECT = 'relproject'; |
|
75 |
const PUBLICATION_PROJECT_ID = 'relprojectid'; |
|
73 | 76 |
const PUBLICATION_AUTHOR_ID = 'relpersonid'; |
74 | 77 |
const PUBLICATION_ARTICLE = '0001'; |
75 | 78 |
const PUBLICATION_PREPRINT = '0016'; |
... | ... | |
88 | 91 |
const PUBLICATION_DATE = 'resultdateofacceptance'; |
89 | 92 |
const PUBLICATION_ID = 'objIdentifier'; |
90 | 93 |
const DATASET_QUERY = '(oaftype exact result) and (resulttypeid exact dataset)'; |
91 |
const DATASET_TYPE = 'instancetypenameid';
|
|
92 |
const DATASET_LANGUAGE = 'resultlanguageid';
|
|
93 |
const DATASET_FUNDER = 'relfunderid';
|
|
94 |
const DATASET_TYPE = 'instancetypename'; |
|
95 |
const DATASET_LANGUAGE = 'resultlanguagename';
|
|
96 |
const DATASET_FUNDER = 'relfunder'; |
|
94 | 97 |
const DATASET_FUNDING_STREAM = 'relfundinglevel0_id'; |
95 | 98 |
const DATASET_SCIENTIFIC_AREA = 'relfundinglevel1_id'; |
96 | 99 |
const DATASET_FUNDING_STREAM_LEVEL2 = 'relfundinglevel2_id'; |
97 | 100 |
const DATASET_YEAR = 'resultacceptanceyear'; |
98 | 101 |
const DATASET_ACCESS_MODE = 'resultbestlicense'; |
99 |
const DATASET_DATASOURCE = 'resulthostingdatasourceid';
|
|
100 |
const DATASET_PROJECT = 'relprojectid'; |
|
102 |
const DATASET_PROJECT = 'relproject';
|
|
103 |
const DATASET_PROJECT_ID = 'relprojectid';
|
|
101 | 104 |
const DATASET_AUTHOR_ID = 'relpersonid'; |
102 | 105 |
const DATASET_ID = 'objIdentifier'; |
103 | 106 |
const PROJECT_QUERY = '(oaftype exact project)'; |
104 | 107 |
const PROJECT = 'project'; |
105 |
const PROJECT_FUNDER = 'funderid';
|
|
108 |
const PROJECT_FUNDER = 'funder'; |
|
106 | 109 |
const PROJECT_FUNDING_STREAM = 'fundinglevel0_id'; |
107 | 110 |
const PROJECT_SCIENTIFIC_AREA = 'fundinglevel1_id'; |
108 | 111 |
const PROJECT_FUNDING_STREAM_LEVEL2 = 'fundinglevel2_id'; |
... | ... | |
117 | 120 |
const PROJECT_ID = 'objIdentifier'; |
118 | 121 |
const PROJECT_CODE = 'projectcode'; |
119 | 122 |
const PERSON_QUERY = '(oaftype exact person)'; |
120 |
const PERSON_COUNTRY = 'personcountryid'; |
|
123 |
// const PERSON_COUNTRY = 'personcountryid';
|
|
121 | 124 |
const PERSON_LAST_NAME = 'personsecondnames'; |
122 | 125 |
const PERSON_FIRST_NAME = 'personfirstname'; |
123 | 126 |
const PERSON_FULL_NAME = 'personfullname'; |
124 | 127 |
const PERSON_ID = 'objIdentifier'; |
125 | 128 |
const ORGANIZATION_QUERY = '(oaftype exact organization)'; |
126 | 129 |
const ORGANIZATION_QUERY_COMPATIBILITY = 'oaftype exact organization and |
127 |
(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or
|
|
128 |
reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or
|
|
129 |
reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy
|
|
130 |
or relprojectid=*)';
|
|
131 |
const ORGANIZATION_COUNTRY = 'organizationcountryid';
|
|
130 |
(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or |
|
131 |
reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or |
|
132 |
reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy |
|
133 |
or relproject=*)'; |
|
134 |
const ORGANIZATION_COUNTRY = 'organizationcountryname';
|
|
132 | 135 |
const ORGANIZATION_LEGAL_BODY = 'organizationeclegalbody'; |
133 | 136 |
const ORGANIZATION_LEGAL_PERSON = 'organizationeclegalperson'; |
134 | 137 |
const ORGANIZATION_NON_PROFIT = 'organizationecnonprofit'; |
... | ... | |
143 | 146 |
// const DATASOURCE_QUERY = '(oaftype exact datasource) and (datasourcecompatibilityid <> "UNKNOWN") and (datasourcecompatibilityid <> "hostedBy")'; |
144 | 147 |
const DATASOURCE_QUERY = '(oaftype exact datasource) and (datasourcecompatibilityid <> "UNKNOWN")'; |
145 | 148 |
const DATASOURCE_QUERY_COMPATIBILITY = '(oaftype exact datasource)'; |
146 |
const DATASOURCE_TYPE = 'datasourcetypeuiid';
|
|
149 |
const DATASOURCE_TYPE = 'datasourcetypeuiname';
|
|
147 | 150 |
const DATASOURCE_LANGUAGE = 'datasourceodlanguages'; |
148 | 151 |
const DATASOURCE_CONTENT = 'datasourceodcontenttypes'; |
149 |
const DATASOURCE_COMPATIBILITY = 'datasourcecompatibilityid';
|
|
152 |
const DATASOURCE_COMPATIBILITY = 'datasourcecompatibilityname';
|
|
150 | 153 |
const DATASOURCE_NAME = 'datasourceofficialname'; |
151 | 154 |
const DATASOURCE_ENGLISH_NAME = 'datasourceenglishname'; |
152 | 155 |
const DATASOURCE_SUBJECT = 'datasourceodsubjects'; |
... | ... | |
173 | 176 |
private $http; |
174 | 177 |
|
175 | 178 |
// Construct a new OpenAireModelSearch. |
176 |
// $configuration the configuration to use
|
|
179 |
// $configuration the configuration to use |
|
177 | 180 |
public function __construct($configuration = array()) { |
178 | 181 |
parent :: __construct($configuration); |
179 | 182 |
$parameters = JComponentHelper :: getParams('com_openaire'); |
... | ... | |
686 | 689 |
// $fundingStream the ID of the funding stream to use as filter or NULL for no funding stream filtering |
687 | 690 |
// $scientificArea the ID of the scientific area to use as filter or NULL for no scientific area filtering |
688 | 691 |
// $startYear the start year to use as filter or NULL for no start year filtering |
689 |
// $endYear the end year to use as filter or NULL for no end year filtering
|
|
692 |
// $endYear the end year to use as filter or NULL for no end year filtering |
|
690 | 693 |
// $accessMode the ID of the SC-39 status to use as filter or NULL for no SC-39 status filtering |
691 | 694 |
// $page the page of results to retrieve |
692 | 695 |
// $size the size of the page of results to retrieve |
... | ... | |
710 | 713 |
|
711 | 714 |
// Perform an advanced search for people using cache if enabled. |
712 | 715 |
// $keywords the keywords to search for (array) |
713 |
// $fields the fields to match keywords with (array - possible values are LAST_NAME, FIRST_NAME and FULL_NAME)
|
|
716 |
// $fields the fields to match keywords with (array - possible values are LAST_NAME, FIRST_NAME and FULL_NAME) |
|
714 | 717 |
// $constraints the constraints to apply to keywords (array - possible values are ALL and ANY) |
715 | 718 |
// $countries the IDs of the countries to search for |
716 | 719 |
// $country the ID of the coutnry to use as filter or NULL for no country filtering |
... | ... | |
743 | 746 |
// $page the page of results to retrieve |
744 | 747 |
// $size the size of the page of results to retrieve |
745 | 748 |
// $locale the locale to use |
746 |
// return a result (object) containing people and statistics
|
|
749 |
// return a result (object) containing people and statistics |
|
747 | 750 |
public function advancedSearchOrganizations($keywords, $fields, $constraints, $countries, $types, $country, $type, $page, $size, $locale) { |
748 | 751 |
if ($this->cache->getCaching()) { |
749 | 752 |
$cacheId = self :: ADVANCED_SEARCH_ORGANIZATIONS_CACHE_ID . '.' . implode('.', $keywords) . '.' . implode('.', $fields) . '.' . implode('.', $constraints) . '.' . implode('.', $countries) . '.' . implode('.', $types) . $country . '.' . $type . '.' . $page . '.' . $size . '.' . $locale; |
... | ... | |
1060 | 1063 |
$organizations = $this->_quickSearchOrganizations($keyword, $limit, $locale); |
1061 | 1064 |
return $organizations; |
1062 | 1065 |
} |
1063 |
|
|
1066 |
|
|
1064 | 1067 |
// Retrieve publication statistics. |
1065 | 1068 |
// $locale the locale to use |
1066 | 1069 |
// $allFunders get all fields for funders |
... | ... | |
1070 | 1073 |
$time = microtime(TRUE); |
1071 | 1074 |
$query = self :: PUBLICATION_QUERY; |
1072 | 1075 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1073 |
/* if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_PROJECT . '&query=' . urlencode($query) . '&locale=' . c('-', '_', $locale))) == NULL)
|
|
1074 |
*/
|
|
1075 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields='. self :: RESULT_DATASOURCE.'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&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_CONTEXT . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1076 |
/* if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&fields=' . self :: PUBLICATION_PROJECT . '&query=' . urlencode($query) . '&locale=' . c('-', '_', $locale))) == NULL)
|
|
1077 |
*/ |
|
1078 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields='. self :: RESULT_COLLECTED_FROM_DATASOURCE.'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_CONTEXT . '&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 :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1076 | 1079 |
throw new Exception('no HTTP response'); |
1077 | 1080 |
if ($response->code != self :: HTTP_OK) |
1078 | 1081 |
throw new Exception('HTTP response code ' . $response->code); |
... | ... | |
1083 | 1086 |
$xpath = new DOMXPath($document); |
1084 | 1087 |
$statistics=null; |
1085 | 1088 |
if($allFunders){ |
1086 |
$statistics = $this->createStatistics($xpath,
|
|
1089 |
$statistics = $this->createStatistics($xpath, |
|
1087 | 1090 |
array('type', 'language', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'year', 'accessMode', 'datasource', 'community'), |
1088 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'),
|
|
1091 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'), |
|
1089 | 1092 |
array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', |
1090 |
'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'),
|
|
1091 |
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, self :: RESULT_DATASOURCE , self :: PUBLICATION_CONTEXT)); |
|
1093 |
'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'), |
|
1094 |
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, self :: RESULT_COLLECTED_FROM_DATASOURCE , self :: PUBLICATION_CONTEXT));
|
|
1092 | 1095 |
}else{ |
1093 |
$statistics = $this->createStatistics($xpath,
|
|
1096 |
$statistics = $this->createStatistics($xpath, |
|
1094 | 1097 |
array('type', 'language', 'funder', 'year', 'accessMode', 'datasource', 'community'), |
1095 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'),
|
|
1098 |
array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'), |
|
1096 | 1099 |
array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', |
1097 |
'NO_FUNDER_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'),
|
|
1098 |
array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: RESULT_DATASOURCE , self :: PUBLICATION_CONTEXT)); |
|
1099 |
|
|
1100 |
}
|
|
1100 |
'NO_FUNDER_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'), |
|
1101 |
array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: RESULT_COLLECTED_FROM_DATASOURCE , self :: PUBLICATION_CONTEXT));
|
|
1102 |
|
|
1103 |
} |
|
1101 | 1104 |
JLog :: add('Retrieved publication statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
1102 | 1105 |
return $statistics; |
1103 | 1106 |
} catch (Exception $e) { |
... | ... | |
1106 | 1109 |
} |
1107 | 1110 |
} |
1108 | 1111 |
|
1109 |
|
|
1112 |
|
|
1110 | 1113 |
// Retrieve dataset statistics. |
1111 | 1114 |
// $locale the locale to use |
1112 | 1115 |
// return statistics (object) |
... | ... | |
1115 | 1118 |
$time = microtime(TRUE); |
1116 | 1119 |
$query = self :: DATASET_QUERY; |
1117 | 1120 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1118 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&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_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1121 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&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_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1119 | 1122 |
throw new Exception('no HTTP response'); |
1120 | 1123 |
if ($response->code != self :: HTTP_OK) |
1121 | 1124 |
throw new Exception('HTTP response code ' . $response->code); |
... | ... | |
1126 | 1129 |
$xpath = new DOMXPath($document); |
1127 | 1130 |
$statistics=null; |
1128 | 1131 |
if($allFunders){ |
1129 |
$statistics = $this->createStatistics($xpath, array('type', 'language', '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));
|
|
1132 |
$statistics = $this->createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
1130 | 1133 |
}else{ |
1131 |
$statistics = $this->createStatistics($xpath, array('type', 'language', '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));
|
|
1132 |
}
|
|
1134 |
$statistics = $this->createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
1135 |
} |
|
1133 | 1136 |
JLog :: add('Retrieved dataset statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
1134 | 1137 |
return $statistics; |
1135 | 1138 |
} catch (Exception $e) { |
... | ... | |
1158 | 1161 |
$statistics=null; |
1159 | 1162 |
$xpath = new DOMXPath($document); |
1160 | 1163 |
if( $allFunders){ |
1161 |
$statistics = $this->createStatistics($xpath,
|
|
1164 |
$statistics = $this->createStatistics($xpath, |
|
1162 | 1165 |
array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'), |
1163 |
array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'),
|
|
1164 |
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'),
|
|
1166 |
array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), |
|
1167 |
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'), |
|
1165 | 1168 |
array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39)); |
1166 | 1169 |
}else{ |
1167 |
$statistics = $this->createStatistics($xpath,
|
|
1170 |
$statistics = $this->createStatistics($xpath, |
|
1168 | 1171 |
array('funder', 'startYear', 'endYear', 'sc39'), |
1169 |
array('FUNDER', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'),
|
|
1170 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'),
|
|
1172 |
array('FUNDER', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), |
|
1173 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), |
|
1171 | 1174 |
array(self :: PROJECT_FUNDER, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39)); |
1172 | 1175 |
} |
1173 | 1176 |
JLog :: add('Retrieved project statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
... | ... | |
1182 | 1185 |
// $locale the locale to use |
1183 | 1186 |
// return statistics (object) |
1184 | 1187 |
private function _getPeopleStatistics($locale) { |
1185 |
try { |
|
1186 |
$time = microtime(TRUE); |
|
1187 |
$query = self :: PERSON_QUERY; |
|
1188 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
1189 |
if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PERSON_COUNTRY . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
1190 |
throw new Exception('no HTTP response'); |
|
1191 |
if ($response->code != self :: HTTP_OK) |
|
1192 |
throw new Exception('HTTP response code ' . $response->code); |
|
1193 |
$document = new DOMDocument(); |
|
1194 |
$document->recover = TRUE; |
|
1195 |
if ($document->loadXML($response->body) == FALSE) |
|
1196 |
throw new Exception('invalid XML response'); |
|
1197 |
$xpath = new DOMXPath($document); |
|
1198 |
$statistics = $this->createStatistics($xpath, array('country'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)); |
|
1199 |
JLog :: add('Retrieved people statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
1200 |
return $statistics; |
|
1201 |
} catch (Exception $e) { |
|
1202 |
JLog :: add('Error retrieving people statistics (locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
1203 |
return NULL; |
|
1204 |
} |
|
1188 |
$statistics = array(); |
|
1189 |
return $statistics; |
|
1190 |
// try { |
|
1191 |
// $time = microtime(TRUE); |
|
1192 |
// $query = self :: PERSON_QUERY; |
|
1193 |
// JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
1194 |
// if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PERSON_COUNTRY . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
1195 |
// throw new Exception('no HTTP response'); |
|
1196 |
// if ($response->code != self :: HTTP_OK) |
|
1197 |
// throw new Exception('HTTP response code ' . $response->code); |
|
1198 |
// $document = new DOMDocument(); |
|
1199 |
// $document->recover = TRUE; |
|
1200 |
// if ($document->loadXML($response->body) == FALSE) |
|
1201 |
// throw new Exception('invalid XML response'); |
|
1202 |
// $xpath = new DOMXPath($document); |
|
1203 |
// $statistics = $this->createStatistics($xpath, array('country'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)); |
|
1204 |
// JLog :: add('Retrieved people statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
1205 |
// |
|
1206 |
// return $statistics; |
|
1207 |
// } catch (Exception $e) { |
|
1208 |
// JLog :: add('Error retrieving people statistics (locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
1209 |
// return NULL; |
|
1210 |
// } |
|
1205 | 1211 |
} |
1206 | 1212 |
|
1207 | 1213 |
// Retrieve organization statistics. |
... | ... | |
1340 | 1346 |
// return a result (object) containing publications and statistics |
1341 | 1347 |
private function _searchPublications($keyword, $articles, $books, $theses, $reports, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $community, $page, $size, $locale, $project,$isRefine) { |
1342 | 1348 |
try { |
1343 |
$dois = explode(" ", preg_replace('/\s+/', ' ',$keyword));
|
|
1344 |
$unique_dois =array_unique($dois);
|
|
1349 |
$dois = explode(" ", preg_replace('/\s+/', ' ',$keyword)); |
|
1350 |
$unique_dois =array_unique($dois); |
|
1345 | 1351 |
$pattern1 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b#'; |
1346 | 1352 |
$pattern2 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])[[:graph:]])+)\b#'; |
1347 | 1353 |
if (preg_match($pattern1, $unique_dois[0]) || preg_match($pattern2, $unique_dois[0])) { |
1348 | 1354 |
$result= $this->_searchPublicationsWithDois($unique_dois,$page, $size, $locale,$isRefine); |
1349 | 1355 |
return $result; |
1350 |
}
|
|
1356 |
} |
|
1351 | 1357 |
$time = microtime(TRUE); |
1352 | 1358 |
$query = self :: PUBLICATION_QUERY; |
1353 | 1359 |
$query .= ($keyword == NULL) ? '' : ' and "' . str_replace('"', '\\"', $keyword) . '"'; |
... | ... | |
1379 | 1385 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")'); |
1380 | 1386 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){ |
1381 | 1387 |
$temp=''; |
1382 |
foreach(split(',',$funder) as $id){
|
|
1388 |
foreach(explode(',',$funder) as $id){
|
|
1383 | 1389 |
if(!empty($id)){ |
1384 | 1390 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and'; |
1385 | 1391 |
} |
1386 |
|
|
1392 |
|
|
1387 | 1393 |
} |
1388 | 1394 |
$query .= (' and (' . substr($temp, 0, -3). ')'); |
1389 | 1395 |
}else{ |
... | ... | |
1395 | 1401 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")'); |
1396 | 1402 |
$query .= ($year == NULL) ? '' : (' and (' . self :: PUBLICATION_YEAR . ' exact ' . $year . ')'); |
1397 | 1403 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
1398 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: PUBLICATION_DATASOURCE . ' exact "' . $datasource . '")');
|
|
1404 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '")');
|
|
1399 | 1405 |
$query .= ($community == NULL) ? '' : (' and (' . self :: PUBLICATION_CONTEXT . ' exact "' . $community . '")'); |
1400 | 1406 |
$query .= ($project == NULL) ? '' : (' and (' . self :: PUBLICATION_PROJECT . ' exact "' . $project . '")'); |
1401 | 1407 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1402 | 1408 |
$completeQuery='search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
1403 | 1409 |
if($isRefine){ |
1404 |
$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);
|
|
1410 |
$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 :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale);
|
|
1405 | 1411 |
} |
1406 |
//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)
|
|
1412 |
//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 :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
1407 | 1413 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1408 | 1414 |
throw new Exception('no HTTP response'); |
1409 | 1415 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
1419 | 1425 |
$result->publications = $this->parsePublications($xpath); |
1420 | 1426 |
$result->statistics = $isRefine? $this->createStatisticsForPublications($xpath):NULL; |
1421 | 1427 |
$result->statistics = self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,''); |
1422 |
//$this->createStatistics($xpath, array('type', 'language', '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));
|
|
1428 |
//$this->createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
1423 | 1429 |
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); |
1424 | 1430 |
return $result; |
1425 | 1431 |
} catch (Exception $e) { |
... | ... | |
1431 | 1437 |
} |
1432 | 1438 |
} |
1433 | 1439 |
private function _searchPublicationsWithDois($dois, $page, $size, $locale,$isRefine) { |
1434 |
try {
|
|
1440 |
try { |
|
1435 | 1441 |
$time = microtime(TRUE); |
1436 | 1442 |
$query = self :: PUBLICATION_QUERY; |
1437 | 1443 |
$query .= ' and ('; |
... | ... | |
1442 | 1448 |
if(count($dois)>0){ |
1443 | 1449 |
$query=substr($query, 0, -2); |
1444 | 1450 |
} |
1445 |
$query .= ')';
|
|
1451 |
$query .= ')'; |
|
1446 | 1452 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1447 |
$completeQuery=$isRefine?'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_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale)
|
|
1448 |
:'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
|
1453 |
$completeQuery=$isRefine?'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_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale)
|
|
1454 |
:'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1449 | 1455 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1450 | 1456 |
throw new Exception('no HTTP response'); |
1451 | 1457 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
1459 | 1465 |
$result->totalPublications = $this->parseTotalResults($xpath); |
1460 | 1466 |
$result->totalDatasets = 0; |
1461 | 1467 |
$result->publications = $this->parsePublications($xpath); |
1462 |
$result->statistics =$isRefine? $this->createStatistics($xpath, array('type', 'language', 'funder', 'fundingStream', 'scientificArea', 'project', 'year', 'accessMode', 'datasource'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', '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_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_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE)):NULL;
|
|
1468 |
$result->statistics =$isRefine? $this->createStatistics($xpath, array('type', 'language', 'funder', 'fundingStream', 'scientificArea', 'project', 'year', 'accessMode', 'datasource'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', '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_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_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: RESULT_HOSTING_DATASOURCE)):NULL;
|
|
1463 | 1469 |
JLog :: add('Simple search for DOIs retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (query: ' . $query. ')', JLog :: INFO, self :: LOG); |
1464 | 1470 |
return $result; |
1465 | 1471 |
} catch (Exception $e) { |
... | ... | |
1483 | 1489 |
// return a result (object) containing datasets and statistics |
1484 | 1490 |
private function _searchDatasets($keyword, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale, $isRefine) { |
1485 | 1491 |
try { |
1486 |
$dois = explode(" ", preg_replace('/\s+/', ' ',$keyword));
|
|
1487 |
$unique_dois =array_unique($dois);
|
|
1492 |
$dois = explode(" ", preg_replace('/\s+/', ' ',$keyword)); |
|
1493 |
$unique_dois =array_unique($dois); |
|
1488 | 1494 |
$pattern1 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b#'; |
1489 | 1495 |
$pattern2 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])[[:graph:]])+)\b#'; |
1490 | 1496 |
if (preg_match($pattern1, $unique_dois[0]) || preg_match($pattern2, $unique_dois[0])) { |
1491 | 1497 |
$result= $this->_searchDatasetsWithDois($unique_dois,$page, $size, $locale,$isRefine); |
1492 | 1498 |
return $result; |
1493 |
}
|
|
1499 |
} |
|
1494 | 1500 |
$time = microtime(TRUE); |
1495 | 1501 |
$query = self :: DATASET_QUERY; |
1496 | 1502 |
$query .= ($keyword == NULL) ? '' : ' and "' . str_replace('"', '\\"', $keyword) . '"'; |
... | ... | |
1502 | 1508 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: DATASET_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")'); |
1503 | 1509 |
$query .= ($year == NULL) ? '' : (' and (' . self :: DATASET_YEAR . ' exact ' . $year . ')'); |
1504 | 1510 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: DATASET_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
1505 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: DATASET_DATASOURCE . ' exact "' . $datasource . '")');
|
|
1511 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '")');
|
|
1506 | 1512 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1507 |
$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):
|
|
1513 |
$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 :: RESULT_HOSTING_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
|
|
1508 | 1514 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
1509 | 1515 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1510 | 1516 |
throw new Exception('no HTTP response'); |
... | ... | |
1520 | 1526 |
$result->datasets = $this->parseDatasets($xpath); |
1521 | 1527 |
$result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL; |
1522 | 1528 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,''); |
1523 |
//createStatistics($xpath, array('type', 'language', '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));
|
|
1529 |
//createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
1524 | 1530 |
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); |
1525 | 1531 |
return $result; |
1526 | 1532 |
} catch (Exception $e) { |
... | ... | |
1530 | 1536 |
} |
1531 | 1537 |
|
1532 | 1538 |
private function _searchDatasetsWithDois($dois, $page, $size, $locale,$isRefine) { |
1533 |
try {
|
|
1539 |
try { |
|
1534 | 1540 |
$time = microtime(TRUE); |
1535 | 1541 |
$query = self :: DATASET_QUERY; |
1536 | 1542 |
$query .= ' and ('; |
... | ... | |
1541 | 1547 |
if(count($dois)>0){ |
1542 | 1548 |
$query=substr($query, 0, -2); |
1543 | 1549 |
} |
1544 |
$query .= ')';
|
|
1550 |
$query .= ')'; |
|
1545 | 1551 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1546 |
$completeQuery=$isRefine?'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_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale)
|
|
1547 |
:'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
|
|
1552 |
$completeQuery=$isRefine?'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_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale)
|
|
1553 |
:'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1548 | 1554 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1549 | 1555 |
throw new Exception('no HTTP response'); |
1550 | 1556 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
1560 | 1566 |
$result->datasets = $this->parsePublications($xpath); |
1561 | 1567 |
$result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL; |
1562 | 1568 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,''); |
1563 |
//createStatistics($xpath, array('type', 'language', '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));
|
|
1569 |
//createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
1564 | 1570 |
JLog :: add('Simple search for DOIs retrieved ' . count($result->datasets) . ' datasets in ' . (microtime(TRUE) - $time) . ' s (query: ' . $query. ')', JLog :: INFO, self :: LOG); |
1565 | 1571 |
return $result; |
1566 | 1572 |
} catch (Exception $e) { |
... | ... | |
1630 | 1636 |
$time = microtime(TRUE); |
1631 | 1637 |
$query = self :: PERSON_QUERY; |
1632 | 1638 |
$query .= ($keyword == NULL) ? '' : ' and "' . str_replace('"', '\\"', $keyword) . '"'; |
1633 |
$query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
1639 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")');
|
|
1634 | 1640 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1635 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
1636 |
:'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1641 |
// $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
1642 |
// :'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1643 |
$completeQuery='search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1637 | 1644 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1638 | 1645 |
throw new Exception('no HTTP response'); |
1639 | 1646 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
1646 | 1653 |
$result = new JObject(); |
1647 | 1654 |
$result->totalPeople = $this->parseTotalResults($xpath); |
1648 | 1655 |
$result->people = $this->parsePeople($xpath); |
1649 |
$result->statistics = $isRefine?$this->createStatistics($xpath, array('country'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)):NULL;
|
|
1656 |
$result->statistics = $isRefine? array():NULL;
|
|
1650 | 1657 |
JLog :: add('Simple search retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
1651 | 1658 |
return $result; |
1652 | 1659 |
} catch (Exception $e) { |
... | ... | |
1849 | 1856 |
$query = self :: PUBLICATION_QUERY; |
1850 | 1857 |
$query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")'); |
1851 | 1858 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")'); |
1852 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){
|
|
1859 |
if($funder != NULL && (strpos($funder, '---') !== FALSE)){
|
|
1853 | 1860 |
$temp=''; |
1854 |
foreach(split(',',$funder) as $id){
|
|
1861 |
foreach(explode('---',$funder) as $id){
|
|
1855 | 1862 |
if(!empty($id)){ |
1856 | 1863 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and'; |
1857 | 1864 |
} |
1858 |
|
|
1865 |
|
|
1859 | 1866 |
} |
1860 |
$query .= (' and (' . substr($temp, 0, -3). ')');
|
|
1867 |
$query .= (' and (' . substr($temp, 0, -4). ')');
|
|
1861 | 1868 |
}else{ |
1862 | 1869 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")'); |
1863 | 1870 |
} |
... | ... | |
1866 | 1873 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")'); |
1867 | 1874 |
$query .= ($year == NULL) ? '' : (' and (' . self :: PUBLICATION_YEAR . ' exact ' . $year . ')'); |
1868 | 1875 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
1869 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: PUBLICATION_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
1870 |
$query .= ($project == NULL) ? '' : (' and (' . self :: PUBLICATION_PROJECT . ' exact "' . $project . '")'); |
|
1876 |
// $query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
1877 |
$datasource_id_array = explode("||", $datasource); |
|
1878 |
if(sizeof($datasource_id_array) > 1 ){ |
|
1879 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
1880 |
}else{ |
|
1881 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE_ID . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE_ID . ' exact "' . $datasource . '") )'); |
|
1882 |
} |
|
1883 |
// $query .= ($project == NULL) ? '' : (' and (' . self :: PUBLICATION_PROJECT . ' exact "' . $project . '")'); |
|
1884 |
$project_id_array = explode("||", $project); |
|
1885 |
if(sizeof($project_id_array) > 1 ){ |
|
1886 |
$query .= ($project == NULL) ? '' : (' and (' . self :: PUBLICATION_PROJECT . ' exact "' . $project . '")'); |
|
1887 |
}else{ |
|
1888 |
$query .= ($project == NULL) ? '' : (' and (' . self :: PUBLICATION_PROJECT_ID . ' exact "' . $project . '")'); |
|
1889 |
} |
|
1871 | 1890 |
$query .= ($author == NULL) ? '' : (' and (' . self :: PUBLICATION_AUTHOR_ID . ' exact "' . $author . '")'); |
1872 | 1891 |
$query .= ($community == NULL) ? '' : (' and (' . self :: PUBLICATION_CONTEXT . ' exact "' . $community . '")'); |
1873 | 1892 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
1874 |
$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):
|
|
1893 |
$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 :: RESULT_HOSTING_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT ). '&locale=' . str_replace('-', '_', $locale):
|
|
1875 | 1894 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
1876 | 1895 |
if (($response = $this->performGet($completeQuery)) == NULL) |
1877 | 1896 |
throw new Exception('no HTTP response'); |
... | ... | |
1887 | 1906 |
$result->publications = $this->parsePublications($xpath); |
1888 | 1907 |
$result->statistics = $isRefine?$this->createStatisticsForPublications($xpath):NULL; |
1889 | 1908 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,''); |
1890 |
//$this->createStatistics($xpath, array('type', 'language', '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));
|
|
1909 |
//$this->createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE, self :: PUBLICATION_CONTEXT));
|
|
1891 | 1910 |
$result->totalDatasets = 0; |
1892 | 1911 |
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); |
1893 | 1912 |
return $result; |
... | ... | |
1904 | 1923 |
return NULL; |
1905 | 1924 |
} |
1906 | 1925 |
if($fundingStreamLevel1!=NULL){ |
1907 |
$newData= array();
|
|
1926 |
$newData= array(); |
|
1908 | 1927 |
foreach ($statistics["fundingStreamLevel2".$filter]->data as $data){ |
1909 | 1928 |
if(strpos($data->id,$fundingStreamLevel1)!==FALSE){ |
1910 | 1929 |
$newData[$data->id]=$data; |
1911 |
}
|
|
1930 |
} |
|
1912 | 1931 |
} |
1913 | 1932 |
$statistics["fundingStreamLevel2".$filter]->data=$newData; |
1914 | 1933 |
} |
1915 | 1934 |
if($fundingStream!=NULL){ |
1916 |
$newData= array();
|
|
1935 |
$newData= array(); |
|
1917 | 1936 |
foreach ($statistics["fundingStreamLevel1".$filter]->data as $data){ |
1918 | 1937 |
if(strpos($data->id,$fundingStream)!==FALSE){ |
1919 | 1938 |
$newData[$data->id]=$data; |
1920 |
}
|
|
1939 |
} |
|
1921 | 1940 |
} |
1922 | 1941 |
$statistics["fundingStreamLevel1".$filter]->data=$newData; |
1923 |
}
|
|
1942 |
} |
|
1924 | 1943 |
if($funder!=NULL){ |
1925 |
$newData= array();
|
|
1926 |
if(strpos($funder, ',') !== FALSE){
|
|
1927 |
foreach ($statistics["fundingStream".$filter]->data as $data){
|
|
1928 |
foreach(split(',',$funder) as $id){
|
|
1929 |
if(!empty($id) && (strpos($data->id,$id)!==FALSE)){
|
|
1930 |
$newData[$data->id]=$data;
|
|
1944 |
$newData= array(); |
|
1945 |
if(strpos($funder, '---') !== FALSE){
|
|
1946 |
foreach ($statistics["fundingStream".$filter]->data as $data){ |
|
1947 |
foreach(explode('---',$funder) as $id){
|
|
1948 |
if(!empty($id) && (strpos($data->id,explode("||",$id)[0])!==FALSE)){
|
|
1949 |
$newData[$data->id]=$data; |
|
1931 | 1950 |
} |
1932 | 1951 |
} |
1933 | 1952 |
} |
1934 | 1953 |
}else{ |
1935 | 1954 |
foreach ($statistics["fundingStream".$filter]->data as $data){ |
1936 |
if(strpos($data->id,$funder)!==FALSE){ |
|
1955 |
$funder_id= explode("||",$funder)[0]; |
|
1956 |
if(strpos($data->id,$funder_id)!==FALSE){ |
|
1937 | 1957 |
$newData[$data->id]=$data; |
1938 |
}
|
|
1958 |
} |
|
1939 | 1959 |
} |
1940 | 1960 |
} |
1941 | 1961 |
$statistics["fundingStream".$filter]->data=$newData; |
1942 |
|
|
1962 |
|
|
1943 | 1963 |
} |
1944 | 1964 |
return $statistics; |
1945 | 1965 |
} |
1946 |
//Reduces the Funding Fields
|
|
1966 |
//Reduces the Funding Fields |
|
1947 | 1967 |
//$funder filter for funder |
1948 | 1968 |
//$fundingStream filter for funding stream |
1949 | 1969 |
//$fundingStreamLevel1 filter for fundingStreamLevel1 |
... | ... | |
1954 | 1974 |
$f[0]=true; |
1955 | 1975 |
for($i=1;$i<4;$i++){ |
1956 | 1976 |
$f[$i]=false; |
1957 |
}
|
|
1977 |
} |
|
1958 | 1978 |
if($fundingStreamLevel2 !== null && !empty($fundingStreamLevel2)){ |
1959 | 1979 |
$f[3]=true; |
1960 | 1980 |
}if($fundingStreamLevel1 !== NULL && strlen($fundingStreamLevel1)>0){ |
1961 | 1981 |
$f[2]=true; |
1962 |
$f[3]=true;
|
|
1982 |
$f[3]=true; |
|
1963 | 1983 |
} if($fundingStream !== NULL && strlen($fundingStream)>0){ |
1964 | 1984 |
$f[1]=true; |
1965 | 1985 |
$f[2]=true; |
... | ... | |
1973 | 1993 |
if($f[$i]){ |
1974 | 1994 |
$returnedFields.=($f[$i])?$field[$i]:''; |
1975 | 1995 |
$none=false; |
1976 |
}
|
|
1996 |
} |
|
1977 | 1997 |
} |
1978 |
$returnedFields=($none)?$field[0].$field[1]:$returnedFields;
|
|
1979 |
return $returnedFields;
|
|
1998 |
$returnedFields=($none)?$field[0].$field[1]:$returnedFields; |
|
1999 |
return $returnedFields; |
|
1980 | 2000 |
} |
1981 | 2001 |
|
1982 | 2002 |
private function _getFundingFieldsPerType($type){ |
... | ... | |
2001 | 2021 |
$field[0]='&fields=' . self :: PROJECT_FUNDER; |
2002 | 2022 |
break; |
2003 | 2023 |
} |
2004 |
|
|
2024 |
|
|
2005 | 2025 |
return $field; |
2006 | 2026 |
} |
2007 | 2027 |
public function browsePublicationsRaw($query) { |
2008 | 2028 |
try { |
2009 | 2029 |
$time = microtime(TRUE); |
2010 |
|
|
2030 |
|
|
2011 | 2031 |
if (($response = $this->performGet($query)) == NULL) |
2012 | 2032 |
throw new Exception('no HTTP response'); |
2013 | 2033 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
2022 | 2042 |
public function browseProjectsRaw($query) { |
2023 | 2043 |
try { |
2024 | 2044 |
$time = microtime(TRUE); |
2025 |
|
|
2045 |
|
|
2026 | 2046 |
if (($response = $this->performGet(str_replace(' ', '+', $query))) == NULL) |
2027 | 2047 |
throw new Exception('no HTTP response'); |
2028 | 2048 |
if ($response->code != self :: HTTP_OK) |
2029 |
throw new Exception('HTTP response code ' . $response->code);
|
|
2049 |
throw new Exception('HTTP response code ' . $response->code); |
|
2030 | 2050 |
JLog :: add('Browse projects raw for query:'.$query.' in ' . (microtime(TRUE) - $time) , JLog :: INFO, self :: LOG); |
2031 | 2051 |
return $response; |
2032 | 2052 |
} catch (Exception $e) { |
... | ... | |
2061 | 2081 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: DATASET_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")'); |
2062 | 2082 |
$query .= ($year == NULL) ? '' : (' and (' . self :: DATASET_YEAR . ' exact ' . $year . ')'); |
2063 | 2083 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: DATASET_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
2064 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: DATASET_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
2065 |
//$query .= ($datasource == NULL) ? '' : (' and (' . self :: DATASET_DATASOURCE . ' exact "' . $datasource . '")'); |
|
2066 |
$query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT . ' exact "' . $project . '")'); |
|
2084 |
|
|
2085 |
// $query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
2086 |
$datasource_id_array = explode("||", $datasource); |
|
2087 |
if(sizeof($datasource_id_array) > 1 ){ |
|
2088 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE . ' exact "' . $datasource . '") )'); |
|
2089 |
}else{ |
|
2090 |
$query .= ($datasource == NULL) ? '' : (' and ((' . self :: RESULT_HOSTING_DATASOURCE_ID . ' exact "' . $datasource . '") or (' . self :: RESULT_COLLECTED_FROM_DATASOURCE_ID . ' exact "' . $datasource . '") )'); |
|
2091 |
} |
|
2092 |
// $query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT . ' exact "' . $project . '")'); |
|
2093 |
$project_id_array = explode("||", $project); |
|
2094 |
if(sizeof($project_id_array) > 1 ){ |
|
2095 |
$query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT . ' exact "' . $project . '")'); |
|
2096 |
}else{ |
|
2097 |
$query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT_ID . ' exact "' . $project . '")'); |
|
2098 |
} |
|
2067 | 2099 |
$query .= ($author == NULL) ? '' : (' and (' . self :: DATASET_AUTHOR_ID . ' exact "' . $author . '")'); |
2068 | 2100 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
2069 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&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):
|
|
2101 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&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 :: RESULT_HOSTING_DATASOURCE ). '&locale=' . str_replace('-', '_', $locale):
|
|
2070 | 2102 |
'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
2071 | 2103 |
if (($response = $this->performGet($completeQuery)) == NULL) |
2072 | 2104 |
throw new Exception('no HTTP response'); |
... | ... | |
2081 | 2113 |
$result->totalDatasets = $this->parseTotalResults($xpath); |
2082 | 2114 |
$result->datasets = $this->parseDatasets($xpath); |
2083 | 2115 |
$result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL; |
2084 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
|
|
2085 |
//createStatistics($xpath, array('type', 'language', '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));
|
|
2116 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,''); |
|
2117 |
//createStatistics($xpath, array('type', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
2086 | 2118 |
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); |
2087 | 2119 |
return $result; |
2088 | 2120 |
} catch (Exception $e) { |
... | ... | |
2108 | 2140 |
$query = self :: PROJECT_QUERY; |
2109 | 2141 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){ |
2110 | 2142 |
$temp=''; |
2111 |
foreach(split(',',$funder) as $id){
|
|
2143 |
foreach(explode(',',$funder) as $id){
|
|
2112 | 2144 |
if(!empty($id)){ |
2113 | 2145 |
$temp.='(' . self :: PROJECT_FUNDER . ' exact "' . $id . '") and'; |
2114 | 2146 |
} |
2115 |
|
|
2147 |
|
|
2116 | 2148 |
} |
2117 | 2149 |
$query .= (' and (' . substr($temp, 0, -3). ')'); |
2118 | 2150 |
}else{ |
... | ... | |
2160 | 2192 |
try { |
2161 | 2193 |
$time = microtime(TRUE); |
2162 | 2194 |
$query = self :: PERSON_QUERY; |
2163 |
$query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
2195 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")');
|
|
2164 | 2196 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
2165 |
$completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
2166 |
:'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
2197 |
// $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
2198 |
// :'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
2199 |
$completeQuery='search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
2167 | 2200 |
if (($response = $this->performGet($completeQuery)) == NULL) |
2168 | 2201 |
throw new Exception('no HTTP response'); |
2169 | 2202 |
if ($response->code != self :: HTTP_OK) |
... | ... | |
2176 | 2209 |
$result = new JObject(); |
2177 | 2210 |
$result->totalPeople = $this->parseTotalResults($xpath); |
2178 | 2211 |
$result->people = $this->parsePeople($xpath); |
2179 |
$result->statistics =$isRefine? $this->createStatistics($xpath, array('country'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)):NULL;
|
|
2212 |
$result->statistics =$result->statistics = $isRefine? array():NULL;
|
|
2180 | 2213 |
JLog :: add('Browse retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
2181 | 2214 |
return $result; |
2182 | 2215 |
} catch (Exception $e) { |
... | ... | |
2243 | 2276 |
$result->statistics['type']->id = 'type'; |
2244 | 2277 |
$result->statistics['type']->title = JText :: _('TYPE'); |
2245 | 2278 |
$result->statistics['type']->error = JText :: _('NO_TYPE_STATISTICS_FOUND'); |
2246 |
$result->statistics['type']->data = array();
|
|
2279 |
$result->statistics['type']->data = array(); |
|
2247 | 2280 |
$legalBody = $this->parseStatistics($xpath, self :: ORGANIZATION_LEGAL_BODY); |
2248 | 2281 |
if (($legalBody != NULL) && array_key_exists('true', $legalBody)) { |
2249 | 2282 |
$result->statistics['type']->data['legalBody'] = new JObject(); |
... | ... | |
2460 | 2493 |
$query .= ($accessModes == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($accessMode) use ($field) { |
2461 | 2494 |
return '(' . $field . ' exact "' . $accessMode . '")'; |
2462 | 2495 |
}, $accessModes)) . ')'); |
2463 |
$field = self :: PUBLICATION_DATASOURCE;
|
|
2496 |
$field = self :: RESULT_HOSTING_DATASOURCE;
|
|
2464 | 2497 |
$query .= ($datasources == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($datasource) use ($field) { |
2465 | 2498 |
return '(' . $field . ' exact "' . $datasource . '")'; |
2466 | 2499 |
}, $datasources)) . ')'); |
... | ... | |
2469 | 2502 |
//$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")'); |
2470 | 2503 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){ |
2471 | 2504 |
$temp=''; |
2472 |
foreach(split(',',$funder) as $id){
|
|
2505 |
foreach(explode(',',$funder) as $id){
|
|
2473 | 2506 |
if(!empty($id)){ |
2474 | 2507 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and'; |
2475 | 2508 |
} |
2476 |
|
|
2509 |
|
|
2477 | 2510 |
} |
2478 | 2511 |
$query .= (' and (' . substr($temp, 0, -3). ')'); |
2479 | 2512 |
}else{ |
... | ... | |
2484 | 2517 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")'); |
2485 | 2518 |
$query .= ($year == NULL) ? '' : (' and (' . self :: PUBLICATION_YEAR . ' exact "' . $year . '")'); |
2486 | 2519 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
2487 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: PUBLICATION_DATASOURCE . ' exact "' . $datasource . '")');
|
|
2520 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '")');
|
|
2488 | 2521 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
2489 |
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)
|
|
2522 |
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 :: RESULT_HOSTING_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
2490 | 2523 |
throw new Exception('no HTTP response'); |
2491 | 2524 |
if ($response->code != self :: HTTP_OK) |
2492 | 2525 |
throw new Exception('HTTP response code ' . $response->code); |
... | ... | |
2500 | 2533 |
$result->publications = $this->parsePublications($xpath); |
2501 | 2534 |
$result->statistics =$this->createStatisticsForPublications($xpath,'Filter'); |
2502 | 2535 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,"Filter"); |
2503 |
//$this->createStatistics($xpath, array('typeFilter', 'language', '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));
|
|
2536 |
//$this->createStatistics($xpath, array('typeFilter', 'language', '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 :: RESULT_HOSTING_DATASOURCE));
|
|
2504 | 2537 |
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); |
2505 | 2538 |
return $result; |
2506 | 2539 |
} catch (Exception $e) { |
... | ... | |
2697 | 2730 |
return '(' . (($field == NULL) ? '' : ($field . ' = ')) . '"' . str_replace('"', '\\"', $keyword) . '")'; |
2698 | 2731 |
}, $tokens)) . ')'); |
2699 | 2732 |
} |
2700 |
$field = self :: PERSON_COUNTRY; |
|
2701 |
$query .= ($countries == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($country) use ($field) { |
|
2702 |
return '(' . $field . ' exact "' . $country . '")'; |
|
2703 |
}, $countries)) . ')'); |
|
2704 |
$query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
2733 |
// $field = self :: PERSON_COUNTRY;
|
|
2734 |
// $query .= ($countries == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($country) use ($field) {
|
|
2735 |
// return '(' . $field . ' exact "' . $country . '")';
|
|
2736 |
// }, $countries)) . ')');
|
|
2737 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")');
|
|
2705 | 2738 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
2706 |
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale))) == NULL)
|
|
2739 |
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
2707 | 2740 |
throw new Exception('no HTTP response'); |
2708 | 2741 |
if ($response->code != self :: HTTP_OK) |
2709 | 2742 |
throw new Exception('HTTP response code ' . $response->code); |
... | ... | |
2715 | 2748 |
$result = new JObject(); |
2716 | 2749 |
$result->totalPeople = $this->parseTotalResults($xpath); |
2717 | 2750 |
$result->people = $this->parsePeople($xpath); |
2718 |
$result->statistics = $this->createStatistics($xpath, array('countryFilter'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)); |
|
2751 |
$result->statistics = NULL; //$this->createStatistics($xpath, array('countryFilter'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY));
|
|
2719 | 2752 |
JLog :: add('Advanced search retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], countries: [' . implode(', ', $countries) . '], country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
2720 | 2753 |
return $result; |
2721 | 2754 |
} catch (Exception $e) { |
... | ... | |
3037 | 3070 |
$query .= ')'; |
3038 | 3071 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
3039 | 3072 |
if (($response = $this->performGet('search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&size=10000&locale=' . str_replace('-', '_', $locale))) == NULL) |
3040 |
throw new Exception('no HTTP response');
|
|
3073 |
throw new Exception('no HTTP response'); |
|
3041 | 3074 |
if ($response->code != self :: HTTP_OK) |
3042 | 3075 |
throw new Exception('HTTP response code ' . $response->code); |
3043 | 3076 |
$document = new DOMDocument(); |
... | ... | |
3119 | 3152 |
return NULL; |
3120 | 3153 |
} |
3121 | 3154 |
} |
3122 |
// Retrieve projects by code id. |
|
3123 |
// $id the project grant agreement code |
|
3124 |
// $locale the locale to use |
|
3125 |
// return projects or NULL if no such project exists |
|
3126 |
private function _getProjectByCodeId($id, $locale) { |
|
3127 |
try { |
|
3128 |
$time = microtime(TRUE); |
|
3129 |
$query = self :: PROJECT_QUERY . ' and '; |
|
3130 |
// (oaftype=project) and (projectcode_nt exact 731011) |
|
3131 |
$query.=' ( projectcode_nt exact "' . $id . '")'; |
|
3132 |
|
|
3133 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
3134 |
if (($response = $this->performGet('search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
3135 |
throw new Exception('no HTTP response'); |
|
3136 |
if ($response->code != self :: HTTP_OK) |
|
3137 |
throw new Exception('HTTP response code ' . $response->code); |
|
3138 |
$document = new DOMDocument(); |
|
3139 |
$document->recover = TRUE; |
|
3140 |
if ($document->loadXML($response->body) == FALSE) |
|
3141 |
throw new Exception('invalid XML response'); |
|
3142 |
$xpath = new DOMXPath($document); |
|
3143 |
$projects = $this->parseProject($xpath, $locale); |
|
3144 |
JLog :: add('Retrieved projects in ' . (microtime(TRUE) - $time) . ' s (id: ' .$id . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
3145 |
return $projects; |
|
3146 |
} catch (Exception $e) { |
|
3147 |
JLog :: add('Error retrieving projects (id: ' .$id. ', locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
3148 |
return NULL; |
|
3149 |
} |
|
3150 |
} |
|
3155 |
|
|
3151 | 3156 |
// Retrieve datasets by identifier. |
3152 | 3157 |
// $ids the datasets identifiers |
3153 | 3158 |
// $locale the locale to use |
... | ... | |
3395 | 3400 |
private function _quickSearchProjects($keyword, $funder, $limit, $locale) { |
3396 | 3401 |
try { |
3397 | 3402 |
$time = microtime(TRUE); |
3398 |
$query = self :: PROJECT_QUERY . ' and ((' . self :: PROJECT_TITLE . ' = "' . $keyword . '") or (' . self :: PROJECT_ACRONYM . ' = "' . $keyword . '") or (' . self :: PROJECT_CODE . ' = "' . $keyword . '")) and (' . self :: PROJECT_FUNDER . ' exact ' . $funder . ')';
|
|
3403 |
$query = self :: PROJECT_QUERY . ' and ((' . self :: PROJECT_TITLE . ' = "' . $keyword . '") or (' . self :: PROJECT_ACRONYM . ' = "' . $keyword . '") or (' . self :: PROJECT_CODE . ' = "' . $keyword . '")) and (' . self :: PROJECT_FUNDER . ' exact "' . $funder . '")';
|
|
3399 | 3404 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
3400 | 3405 |
if (($response = $this->performGet('search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&size=' . $limit . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
3401 | 3406 |
throw new Exception('no HTTP response'); |
... | ... | |
3423 | 3428 |
private function _quickSearchOrganizations($keyword, $limit, $locale) { |
3424 | 3429 |
try { |
3425 | 3430 |
$time = microtime(TRUE); |
3426 |
$query = self :: ORGANIZATION_QUERY . ' and ((' . self :: ORGANIZATION_NAME . ' all "' . $keyword . '") or (' . self :: ORGANIZATION_SHORT_NAME . ' all "' . $keyword . '")) and collectedfromdatasourcename exact "OpenDOAR" ';
|
|
3431 |
$query = self :: ORGANIZATION_QUERY . ' and ((' . self :: ORGANIZATION_NAME . ' all "' . $keyword . '") or (' . self :: ORGANIZATION_SHORT_NAME . ' all "' . $keyword . '")) and ' . self :: RESULT_COLLECTED_FROM_DATASOURCE . ' exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR" ';
|
|
3427 | 3432 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
3428 | 3433 |
if (($response = $this->performGet('search?action=search&sTransformer=organizations_openaire&query=' . urlencode($query) . '&size=' . $limit . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
3429 | 3434 |
throw new Exception('no HTTP response'); |
... | ... | |
3497 | 3502 |
|
3498 | 3503 |
$statistic->name = trim($nameNode->nodeValue); |
3499 | 3504 |
$statistic->name= str_replace("::", JText :: _('FUNDER_SEPARATOR'), $statistic->name); |
3500 |
/* if ($category === self :: PUBLICATION_PROJECT) {
|
|
3505 |
/* if ($category === self :: PUBLICATION_PROJECT) { |
|
3501 | 3506 |
$project =OpenAireModelSearch :: getProject($statistic->name, 'en-GB'); |
3502 | 3507 |
if($project!==null){ |
3503 | 3508 |
$statistic->name = $project->title; |
... | ... | |
3557 | 3562 |
foreach($idNodes as $idNode){ |
3558 | 3563 |
if (in_array(trim($idNode->nodeValue), $ids)) { |
3559 | 3564 |
$publication->id =trim($idNode->nodeValue); |
3560 |
}
|
|
3565 |
} |
|
3561 | 3566 |
} |
3562 | 3567 |
$publication->source = 'openaire'; |
3563 | 3568 |
$publication->url = NULL; |
... | ... | |
3670 | 3675 |
// Parse publications from a search service XML response. |
3671 | 3676 |
// xpath the DOMXPath to parse |
3672 | 3677 |
// return publications (array) |
3673 |
private function parsePublications($xpath) {
|
|
3678 |
private function parsePublications($xpath) { |
|
3674 | 3679 |
if (($resultNodes = $xpath->query('/response/results/result')) == FALSE) |
3675 | 3680 |
throw new Exception('error parsing publications'); |
3676 | 3681 |
$publications = array(); |
... | ... | |
3704 | 3709 |
if (($pidNodes = $xpath->query('./field[@name = "pid"]', $resultNode)) == FALSE) |
3705 | 3710 |
throw new Exception('error parsing publication'); |
3706 | 3711 |
if (($accessModeNodes = $xpath->query('./field[@name = "bestlicense"]/@value', $resultNode)) == FALSE) |
3707 |
throw new Exception('error parsing publication');
|
|
3712 |
throw new Exception('error parsing publication'); |
|
3708 | 3713 |
$publication = new JObject(); |
3709 | 3714 |
$publication->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
3710 | 3715 |
$publication->source = 'openaire'; |
... | ... | |
3712 | 3717 |
if (($source = trim($sourceNode->nodeValue)) != NULL){ |
3713 | 3718 |
$publication->source_source = $source; |
3714 | 3719 |
} |
3715 |
}
|
|
3720 |
} |
|
3716 | 3721 |
$publication->url = NULL; |
3717 | 3722 |
$publication->accessMode =(($accessModeNode = $accessModeNodes->item(0)) == NULL) ? NULL : trim($accessModeNode->nodeValue); |
3718 | 3723 |
$publication->datasources = array(); |
... | ... | |
3723 | 3728 |
$publication->language = (($languageNode = $languageNodes->item(0)) == NULL) ? NULL : trim($languageNode->nodeValue); |
3724 | 3729 |
$publication->projects = array(); |
3725 | 3730 |
$publication->subjects = array(); |
3726 |
$publication->related = array();
|
|
3731 |
$publication->related = array(); |
|
3727 | 3732 |
$publication->embargoEndDate = (($embargoEndDateNode = $embargoEndDateNodes->item(0)) == NULL) ? NULL : strtotime(trim($embargoEndDateNode->nodeValue)); |
3728 | 3733 |
$publication->description = (($descriptionNode = $descriptionNodes->item(0)) == NULL) ? NULL : trim($descriptionNode->nodeValue); |
3729 | 3734 |
$publication->pids = array(); |
... | ... | |
3825 | 3830 |
$project->acronym = (($acronymNode = $acronymNodes->item(0)) == NULL) ? NULL : ((trim($acronymNode->nodeValue) == self :: UNKNOWN) ? NULL : trim($acronymNode->nodeValue)); |
3826 | 3831 |
$project->title = (($titleNode = $titleNodes->item(0)) == NULL) ? NULL : trim($titleNode->nodeValue); |
3827 | 3832 |
$project->code = (($codeNode = $codeNodes->item(0)) == NULL) ? NULL : trim($codeNode->nodeValue); |
3828 |
$project -> funder = NULL;
|
|
3833 |
$project -> funder = NULL; |
|
3829 | 3834 |
if (($fundingNode = $fundingNodes->item(0)) == NULL) |
3830 | 3835 |
; |
3831 | 3836 |
else { |
3832 | 3837 |
if (($funderNodes = $xpath->query('./field[@name = "funder"]/@value', $fundingNode)) == FALSE) |
3833 |
throw new Exception('error parsing project');
|
|
3838 |
throw new Exception('error parsing project'); |
|
3834 | 3839 |
$project -> funder = (($funderNode = $funderNodes->item(0)) == NULL) ? NULL : trim($funderNode->nodeValue); |
3835 | 3840 |
if (($funderShortNameNodes = $xpath->query('./field[@name = "fundershortname"]/@value', $fundingNode)) == FALSE) |
3836 |
throw new Exception('error parsing project');
|
|
3841 |
throw new Exception('error parsing project'); |
|
3837 | 3842 |
$project -> funderShortName = (($funderShortNameNode = $funderShortNameNodes->item(0)) == NULL) ? NULL : trim($funderShortNameNode->nodeValue); |
3838 | 3843 |
} |
3839 | 3844 |
if (($project->id != NULL) || ($project->acronym != NULL) || ($project->title != NULL) || ($project->code != NULL)) |
... | ... | |
3939 | 3944 |
$project->code = (($codeNode = $codeNodes->item(0)) == NULL) ? NULL : trim($codeNode->nodeValue); |
3940 | 3945 |
if (($project->id != NULL) || ($project->acronym != NULL) || ($project->title != NULL) || ($project->code != NULL)) |
3941 | 3946 |
$dataset->projects[] = $project; |
3942 |
$project -> funder = NULL;
|
|
3947 |
$project -> funder = NULL; |
|
3943 | 3948 |
if (($fundingNode = $fundingNodes->item(0)) == NULL) |
3944 | 3949 |
; |
3945 | 3950 |
else { |
3946 | 3951 |
if (($funderNodes = $xpath->query('./field[@name = "funder"]/@value', $fundingNode)) == FALSE) |
3947 |
throw new Exception('error parsing datasets');
|
|
3952 |
throw new Exception('error parsing datasets'); |
|
3948 | 3953 |
$project -> funder = (($funderNode = $funderNodes->item(0)) == NULL) ? NULL : trim($funderNode->nodeValue); |
3949 | 3954 |
if (($funderShortNameNodes = $xpath->query('./field[@name = "fundershortname"]/@value', $fundingNode)) == FALSE) |
3950 |
throw new Exception('error parsing datasets');
|
|
3955 |
throw new Exception('error parsing datasets'); |
|
3951 | 3956 |
$project -> funderShortName = (($funderShortNameNode = $funderShortNameNodes->item(0)) == NULL) ? NULL : trim($funderShortNameNode->nodeValue); |
3952 | 3957 |
} |
3953 | 3958 |
} |
... | ... | |
3975 | 3980 |
throw new Exception('error parsing projects'); |
3976 | 3981 |
if (($sc39Nodes = $xpath->query('./field[@name = "ec_sc39"]/@value', $resultNode)) == FALSE) |
3977 | 3982 |
throw new Exception('error parsing projects'); |
3978 |
if (($funderNodes = $xpath->query('./field[@name = "funder"]/field[@name = "fundershortname"]/@value', $resultNode)) == FALSE)
|
|
3983 |
if (($funderNodes = $xpath->query('./field[@name = "funder"]/field[@name = "fundershortname"]/@value', $resultNode)) == FALSE) |
|
3979 | 3984 |
throw new Exception('error parsing projects'); |
3980 | 3985 |
if (($startYearNodes = $xpath->query('./field[@name = "startyear"]/@value', $resultNode)) == FALSE) |
3981 | 3986 |
throw new Exception('error parsing projects'); |
... | ... | |
4110 | 4115 |
foreach ($resultNodes as $resultNode) { |
4111 | 4116 |
if (($idNodes = $xpath->query('./field[@name = "datasourceId"]/@value', $resultNode)) == FALSE) |
4112 | 4117 |
throw new Exception('error parsing datasources'); |
4113 |
if (($typeNodes = $xpath->query('./field[@name = "datasourcetypeuiid"]/@value', $resultNode)) == FALSE)
|
|
4118 |
if (($typeNodes = $xpath->query('./field[@name = "datasourcetypename"]/@value', $resultNode)) == FALSE)
|
|
4114 | 4119 |
throw new Exception('error parsing datasources'); |
4115 | 4120 |
if (($typeIdNodes = $xpath->query('./field[@name = "datasourcetypeuiid"]/@value_original', $resultNode)) == FALSE) |
4116 | 4121 |
throw new Exception('error parsing datasources'); |
... | ... | |
4275 | 4280 |
$publication->relatedPublications = array(); |
4276 | 4281 |
$publication->relatedDatasets = array(); |
4277 | 4282 |
$publication->externalPublications = array(); |
4278 |
$publication->bioentities = array();
|
|
4283 |
$publication->bioentities = array(); |
|
4279 | 4284 |
$publication->externalDatasets = array(); |
4280 | 4285 |
$publication->contexts = array(); |
4281 | 4286 |
$publication->citations = array(); |
... | ... | |
4409 | 4414 |
} |
4410 | 4415 |
foreach ($sourceNodes as $sourceNode) { |
4411 | 4416 |
if (($source = trim($sourceNode->nodeValue)) != NULL) |
4412 |
$publication->sources[] = $source;
|
|
4417 |
$publication->sources[] = $source; |
|
4413 | 4418 |
} |
4414 | 4419 |
foreach ($projectNodes as $projectNode) { |
4415 | 4420 |
if (($idNodes = $xpath->query('./field[@name = "projectId"]/@value', $projectNode)) == FALSE) |
... | ... | |
4465 | 4470 |
throw new Exception('error parsing project'); |
4466 | 4471 |
if (($funding2Nodes = $xpath->query('./field[@name = "funding_level_2"]', $fundingNode)) == FALSE) |
4467 | 4472 |
throw new Exception('error parsing project'); |
4468 |
|
|
4473 |
|
|
4469 | 4474 |
$project->funding->funder = (($funderNode = $funderNodes->item(0)) == NULL) ? NULL : trim($funderNode->nodeValue); |
4470 | 4475 |
$project->funding->funderShortName = (($funderShortNameNode = $funderShortNameNodes->item(0)) == NULL) ? NULL : trim($funderShortNameNode->nodeValue); |
4471 |
|
|
4476 |
|
|
4472 | 4477 |
if (($funding0Node = $funding0Nodes->item(0)) == NULL) |
4473 | 4478 |
; |
4474 | 4479 |
else { |
... | ... | |
4514 | 4519 |
$publication->pids[] = $pid; |
4515 | 4520 |
} |
4516 | 4521 |
foreach ($similarNodes as $similarNode) { |
4517 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypeid"]/@value', $similarNode)) == FALSE)
|
|
4522 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypename"]/@value', $similarNode)) == FALSE)
|
|
4518 | 4523 |
throw new Exception('error parsing publication'); |
4519 | 4524 |
if (($typeNameNodes = $xpath->query('./field[@name = "resulttypename"]/@value', $similarNode)) == FALSE) |
4520 | 4525 |
throw new Exception('error parsing publication'); |
... | ... | |
4555 | 4560 |
} |
4556 | 4561 |
} |
4557 | 4562 |
foreach ($relatedNodes as $relatedNode) { |
4558 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypeid"]/@value', $relatedNode)) == FALSE)
|
|
4563 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypename"]/@value', $relatedNode)) == FALSE)
|
|
4559 | 4564 |
throw new Exception('error parsing publication'); |
4560 | 4565 |
if (($idNodes = $xpath->query('./field[@name = "resultid"]/@value', $relatedNode)) == FALSE) |
4561 | 4566 |
throw new Exception('error parsing publication'); |
... | ... | |
4628 | 4633 |
$externalEntity-> id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
4629 | 4634 |
$externalEntity-> url = (($urlNode = $urlNodes->item(0)) == NULL) ? NULL : trim($urlNode->nodeValue); |
4630 | 4635 |
$externalEntity-> title = (($labelNode = $labelNodes->item(0)) == NULL) ? NULL : trim($labelNode->nodeValue); |
4631 |
$externalEntity-> sitename = (($siteNameNode = $siteNameNodes->item(0)) == NULL) ? NULL : trim($siteNameNode->nodeValue);
|
|
4636 |
$externalEntity-> sitename = (($siteNameNode = $siteNameNodes->item(0)) == NULL) ? NULL : trim($siteNameNode->nodeValue); |
|
4632 | 4637 |
if (!isset($publication->bioentities[$externalEntity->sitename])){ |
4633 |
$bioentities = array();
|
|
4638 |
$bioentities = array(); |
|
4634 | 4639 |
$publication->bioentities[$externalEntity->sitename]=$bioentities; |
4635 | 4640 |
} |
4636 | 4641 |
$publication->bioentities[$externalEntity->sitename] []= $externalEntity; |
4637 |
|
|
4642 |
|
|
4638 | 4643 |
/* switch ((($typeNode = $typeNodes->item(0)) == NULL) ? NULL : trim($typeNode->nodeValue)) { |
4639 | 4644 |
case self :: PUBLICATION: |
4640 | 4645 |
$externalPublication = new JObject(); |
... | ... | |
4857 | 4862 |
foreach ($datasourceNodes as $datasourceNode) { |
4858 | 4863 |
if (($idNodes = $xpath->query('./field[@name = "hostedby"]/@value_original', $datasourceNode)) == FALSE) |
4859 | 4864 |
throw new Exception('error parsing dataset'); |
4860 |
if (($nameNodes = $xpath->query('./field[@name = "hostedby"]/@value', $datasourceNode)) == FALSE) |
|
4865 |
if (($nameNodes = $xpath->query('./field[@name = "hostedbyname"]/@value', $datasourceNode)) == FALSE)
|
|
4861 | 4866 |
throw new Exception('error parsing dataset'); |
4862 | 4867 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
4863 | 4868 |
throw new Exception('error parsing dataset'); |
... | ... | |
4886 | 4891 |
if (($idNodes = $xpath->query('./field[@name = "collectedfromid"]/@value', $collectedFromNode)) == FALSE) |
4887 | 4892 |
throw new Exception('error parsing dataset'); |
4888 | 4893 |
if (($nameNodes = $xpath->query('./field[@name = "collectedfromname"]/@value', $collectedFromNode)) == FALSE) |
4889 |
throw new Exception('error parsing dataset');
|
|
4894 |
throw new Exception('error parsing dataset'); |
|
4890 | 4895 |
$collectedFrom = new JObject(); |
4891 | 4896 |
$collectedFrom->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
4892 | 4897 |
$collectedFrom->name = (($nameNode = $nameNodes->item(0)) == NULL) ? NULL : trim($nameNode->nodeValue); |
... | ... | |
4953 | 4958 |
throw new Exception('error parsing project'); |
4954 | 4959 |
$project->funding->funder = (($funderNode = $funderNodes->item(0)) == NULL) ? NULL : trim($funderNode->nodeValue); |
4955 | 4960 |
$project->funding->funderShortName = (($funderShortNameNode = $funderShortNameNodes->item(0)) == NULL) ? NULL : trim($funderShortNameNode->nodeValue); |
4956 |
|
|
4961 |
|
|
4957 | 4962 |
if (($funding0Node = $funding0Nodes->item(0)) == NULL) |
4958 | 4963 |
; |
4959 | 4964 |
else { |
... | ... | |
5012 | 5017 |
$dataset->pids[] = $pid; |
5013 | 5018 |
} |
5014 | 5019 |
foreach ($relatedNodes as $relatedNode) { |
5015 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypeid"]/@value', $relatedNode)) == FALSE)
|
|
5020 |
if (($typeNodes = $xpath->query('./field[@name = "resulttypename"]/@value', $relatedNode)) == FALSE)
|
|
5016 | 5021 |
throw new Exception('error parsing publication'); |
5017 | 5022 |
if (($idNodes = $xpath->query('./field[@name = "resultid"]/@value', $relatedNode)) == FALSE) |
5018 | 5023 |
throw new Exception('error parsing publication'); |
... | ... | |
5384 | 5389 |
if($funder!=null){ |
5385 | 5390 |
$organization->allFunders [$funder->id]=$funder; |
5386 | 5391 |
$project->funders [$funder->id]=$funder; |
5387 |
|
|
5392 |
|
|
5388 | 5393 |
} |
5389 |
|
|
5394 |
|
|
5390 | 5395 |
} |
5391 | 5396 |
$project->funders=array_unique($project->funders); |
5392 | 5397 |
if (($project->id != NULL) || ($project->acronym != NULL) || ($project->title != NULL) || ($project->code != NULL)){ |
... | ... | |
5414 | 5419 |
throw new Exception('error parsing datasource'); |
5415 | 5420 |
if (($logoNodes = $xpath->query('./field[@name = "logourl"]/@value', $resultNode)) == FALSE) |
5416 | 5421 |
throw new Exception('error parsing datasource'); |
5417 |
if (($typeNodes = $xpath->query('./field[@name = "datasourcetypeuiid"]/@value', $resultNode)) == FALSE)
|
|
5422 |
if (($typeNodes = $xpath->query('./field[@name = "datasourcetypename"]/@value', $resultNode)) == FALSE)
|
|
5418 | 5423 |
throw new Exception('error pasrsing datasource'); |
5419 | 5424 |
if (($itemsNodes = $xpath->query('./field[@name = "odnumberofitems"]/@value', $resultNode)) == FALSE) |
5420 | 5425 |
throw new Exception('error parsing datasource'); |
... | ... | |
5449 | 5454 |
$datasource->compatibility = (($compatibilityNode = $compatibilityNodes->item(0)) == NULL) ? NULL : trim($compatibilityNode->nodeValue); |
5450 | 5455 |
$datasource->oaiPmh = (($oaiPmhNode = $oaiPmhNodes->item(0)) == NULL) ? NULL : trim($oaiPmhNode->nodeValue); |
5451 | 5456 |
$datasource->description = (($descriptionNode = $descriptionNodes->item(0)) == NULL) ? NULL : trim($descriptionNode->nodeValue); |
5452 |
$datasource->originalId = (($originalIdNode = $originalIdNodes->item(0)) == NULL) ? NULL : trim($originalIdNode->nodeValue);
|
|
5457 |
$datasource->originalId = (($originalIdNode = $originalIdNodes->item(0)) == NULL) ? NULL : trim($originalIdNode->nodeValue); |
|
5453 | 5458 |
return $datasource; |
5454 | 5459 |
} |
5455 |
private function createStatisticsForPublications($xpath,$filter =''){
|
|
5456 |
return $this->createStatistics($xpath,
|
|
5457 |
array('funder'.$filter, 'fundingStream'.$filter, 'fundingStreamLevel1'.$filter, 'fundingStreamLevel2'.$filter, 'project'.$filter, 'year'.$filter, 'accessMode'.$filter, 'type'.$filter, 'language'.$filter,'datasource'.$filter, 'community'.$filter),
|
|
5458 |
array( 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL_2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'DATASOURCE', 'COMMUNITY', 'COMMUNITY'),
|
|
5459 |
array( '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_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND'),
|
|
5460 |
array(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_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_DATASOURCE, self :: PUBLICATION_CONTEXT));
|
|
5460 |
private function createStatisticsForPublications($xpath,$filter =''){ |
|
5461 |
return $this->createStatistics($xpath, |
|
5462 |
array('funder'.$filter, 'fundingStream'.$filter, 'fundingStreamLevel1'.$filter, 'fundingStreamLevel2'.$filter, 'project'.$filter, 'year'.$filter, 'accessMode'.$filter, 'type'.$filter, 'language'.$filter,'datasource'.$filter, 'community'.$filter), |
|
5463 |
array( 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL_2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'DATASOURCE', 'COMMUNITY', 'COMMUNITY'), |
|
5464 |
array( '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_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND'), |
|
5465 |
array(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_TYPE, self :: PUBLICATION_LANGUAGE, self :: RESULT_HOSTING_DATASOURCE, self :: PUBLICATION_CONTEXT));
|
|
5461 | 5466 |
} |
5462 |
private function createStatisticsForDatasets($xpath){
|
|
5463 |
return $this->createStatistics($xpath,
|
|
5464 |
array('funder', 'fundingStream', 'fundingStreamLevel1', 'fundingStreamLevel2', 'year', 'accessMode','type', 'language', 'datasource'),
|
|
5465 |
array( 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE','TYPE', 'LANGUAGE', 'DATASOURCE'),
|
|
5467 |
private function createStatisticsForDatasets($xpath){ |
|
5468 |
return $this->createStatistics($xpath, |
|
5469 |
array('funder', 'fundingStream', 'fundingStreamLevel1', 'fundingStreamLevel2', 'year', 'accessMode','type', 'language', 'datasource'), |
|
5470 |
array( 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE','TYPE', 'LANGUAGE', 'DATASOURCE'), |
|
5466 | 5471 |
array( 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND','NO_TYPE_STATISTICS_FOUND', 'NO_LANGUAGE_STATISTICS_FOUND', 'NO_STATISTICS_FOUND'), |
5467 |
array( self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self::DATASET_FUNDING_STREAM_LEVEL2, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE,self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_DATASOURCE));
|
|
5472 |
array( self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self::DATASET_FUNDING_STREAM_LEVEL2, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE,self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: RESULT_HOSTING_DATASOURCE));
|
|
5468 | 5473 |
|
5469 |
}
|
|
5470 |
private function createStatisticsForProjects($xpath, $filter =''){
|
|
5471 |
return $this-> createStatistics($xpath,
|
|
5472 |
array('funder'.$filter, 'fundingStream'.$filter, 'fundingStreamLevel1'.$filter, 'fundingStreamLevel2'.$filter , 'startYear'.$filter, 'endYear'.$filter, 'sc39'.$filter),
|
|
5473 |
array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'),
|
|
5474 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'),
|
|
5474 |
} |
|
5475 |
private function createStatisticsForProjects($xpath, $filter =''){ |
|
5476 |
return $this-> createStatistics($xpath, |
|
5477 |
array('funder'.$filter, 'fundingStream'.$filter, 'fundingStreamLevel1'.$filter, 'fundingStreamLevel2'.$filter , 'startYear'.$filter, 'endYear'.$filter, 'sc39'.$filter), |
|
5478 |
array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), |
|
5479 |
array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), |
|
5475 | 5480 |
array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self::PROJECT_FUNDING_STREAM_LEVEL2, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39)); |
5476 |
|
|
5477 |
}
|
|
5481 |
|
|
5482 |
} |
|
5478 | 5483 |
private function _validateResultsSize($size=10){ |
5479 | 5484 |
if($size > 50){ |
5480 | 5485 |
$size = 10; |
5481 | 5486 |
} |
5482 | 5487 |
return $size; |
5483 | 5488 |
} |
5484 |
|
|
5489 |
|
|
5485 | 5490 |
} |
Also available in: Unified diff
Commiting changes for new refine fields #2337