1
|
import {Injectable} from '@angular/core';
|
2
|
import {Http, Response} from '@angular/http';
|
3
|
import {Observable} from 'rxjs/Observable';
|
4
|
import {PublicationInfo} from '../utils/entities/publicationInfo';
|
5
|
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
6
|
import 'rxjs/add/observable/of';
|
7
|
import 'rxjs/add/operator/do';
|
8
|
import 'rxjs/add/operator/share';
|
9
|
import { CacheService } from '../shared/cache.service';
|
10
|
@Injectable()
|
11
|
export class PublicationService {
|
12
|
|
13
|
constructor(private http: Http, public _cache: CacheService) {}
|
14
|
|
15
|
publicationInfo: PublicationInfo;
|
16
|
|
17
|
getPublicationInfo (id: string):any {
|
18
|
console.info("getPublicationInfo in service");
|
19
|
let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
|
20
|
let key = url;
|
21
|
if (this._cache.has(key)) {
|
22
|
return Observable.of(this._cache.get(key));
|
23
|
}
|
24
|
return this.http.get(url)
|
25
|
.map(res => <any> res.json())
|
26
|
.map(res => res['result']['metadata']['oaf:entity'])
|
27
|
.map(res => [res['oaf:result'],
|
28
|
res['oaf:result']['title'],
|
29
|
res['oaf:result']['rels']['rel'],
|
30
|
res['oaf:result']['children'],
|
31
|
res['oaf:result']['pid'],
|
32
|
res['oaf:result']['journal'],
|
33
|
res['oaf:result']['language'],
|
34
|
res['oaf:result']['subject'],
|
35
|
res['oaf:result']['bestlicense'],
|
36
|
res['oaf:result']['collectedfrom'],
|
37
|
(res['extraInfo']!= undefined && res['extraInfo']['citations']!= undefined)? res['extraInfo']['citations']['citation']:null,
|
38
|
res['oaf:result']['context']
|
39
|
])
|
40
|
.map(res => this.parsePublicationInfo(res))
|
41
|
.do(res => {
|
42
|
this._cache.set(key, res);
|
43
|
});
|
44
|
}
|
45
|
|
46
|
private handleError (error: Response) {
|
47
|
// in a real world app, we may send the error to some remote logging infrastructure
|
48
|
// instead of just logging it to the console
|
49
|
console.error(error);
|
50
|
return Observable.throw(error || 'Server error');
|
51
|
}
|
52
|
|
53
|
parsePublicationInfo (data: any):any {
|
54
|
this.publicationInfo = new PublicationInfo();
|
55
|
|
56
|
if(data[0] != null) {
|
57
|
this.publicationInfo.date = data[0].dateofacceptance.substring(0,4);
|
58
|
this.publicationInfo.publisher = data[0].publisher;
|
59
|
if(!Array.isArray(data[0].description)) {
|
60
|
this.publicationInfo.description = data[0].description;
|
61
|
} else {
|
62
|
this.publicationInfo.description = data[0].description[0];
|
63
|
}
|
64
|
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
65
|
}
|
66
|
|
67
|
if(data[1] != null) {
|
68
|
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
69
|
|
70
|
if(Array.isArray(data[1])) {
|
71
|
this.publicationInfo.title['name'] = data[1][0].content;
|
72
|
} else {
|
73
|
this.publicationInfo.title['name'] = data[1].content;
|
74
|
}
|
75
|
}
|
76
|
|
77
|
if(data[2] != null) {
|
78
|
let mydata;
|
79
|
let counter = 0;
|
80
|
let length = data[2].length!=undefined ? data[2].length : 1;
|
81
|
|
82
|
for(let i=0; i<length; i++) {
|
83
|
mydata = length > 1 ? data[2][i] : data[2];
|
84
|
if(mydata.hasOwnProperty("to")) {
|
85
|
if(mydata['to'].class == "hasAuthor") {
|
86
|
if(this.publicationInfo.authors == undefined) {
|
87
|
this.publicationInfo.authors = new Array<{"name": string, "url": string}>();
|
88
|
}
|
89
|
|
90
|
this.publicationInfo.authors[mydata.ranking-1] = {"name": "", "url": ""};
|
91
|
this.publicationInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
|
92
|
this.publicationInfo.authors[mydata.ranking-1]['url'] = OpenaireProperties.getsearchLinkToPerson() +mydata['to'].content;
|
93
|
} else if(mydata['to'].class == "isProducedBy") {
|
94
|
if(this.publicationInfo.fundedByProjects == undefined) {
|
95
|
this.publicationInfo.fundedByProjects = new Array<
|
96
|
{ "url": string, "acronym": string, "title": string,
|
97
|
"funderShortname": string, "funderName": string,
|
98
|
"funding": string, "code": string, "inline": boolean
|
99
|
}>();
|
100
|
}
|
101
|
|
102
|
counter = this.publicationInfo.fundedByProjects.length;
|
103
|
|
104
|
this.publicationInfo.fundedByProjects[counter] = {
|
105
|
"url": "", "acronym": "", "title": "",
|
106
|
"funderShortname": "", "funderName": "",
|
107
|
"funding": "", "code": "", "inline": false
|
108
|
}
|
109
|
|
110
|
this.publicationInfo.fundedByProjects[counter]['url'] =
|
111
|
OpenaireProperties.getsearchLinkToProject() + mydata['to'].content;
|
112
|
this.publicationInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
|
113
|
this.publicationInfo.fundedByProjects[counter]['title'] = mydata.title;
|
114
|
this.publicationInfo.fundedByProjects[counter]['code'] = mydata.code;
|
115
|
|
116
|
if(mydata.hasOwnProperty("funding")) {
|
117
|
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
|
118
|
|
119
|
for(let j=0; j<length1; j++) {
|
120
|
let funding;
|
121
|
let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding'];
|
122
|
|
123
|
if(mydata1.hasOwnProperty("funder")) {
|
124
|
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
125
|
this.publicationInfo.fundedByProjects[counter]['funderName'] = mydata1['funder'].name;
|
126
|
}
|
127
|
|
128
|
if(mydata1.hasOwnProperty("funding_level_2")) {
|
129
|
funding = mydata1['funding_level_2'].content;
|
130
|
} else if(mydata1.hasOwnProperty("funding_level_1")) {
|
131
|
funding = mydata1['funding_level_1'].content;
|
132
|
} else if(mydata1.hasOwnProperty("funding_level_0")) {
|
133
|
funding = mydata1['funding_level_0'].content;
|
134
|
}
|
135
|
|
136
|
if(funding != undefined) {
|
137
|
funding = funding.split("::");
|
138
|
|
139
|
if(this.publicationInfo.fundedByProjects[counter]['funding'] != "") {
|
140
|
this.publicationInfo.fundedByProjects[counter]['funding'] += ", "+funding[1];
|
141
|
} else {
|
142
|
this.publicationInfo.fundedByProjects[counter]['funding'] = funding[1];
|
143
|
}
|
144
|
for(let i=2; i<funding.length; i++) {
|
145
|
this.publicationInfo.fundedByProjects[counter]['funding'] += " | " + funding[i];
|
146
|
}
|
147
|
}
|
148
|
}
|
149
|
}
|
150
|
} else if(mydata['to'].class == "isRelatedTo") {
|
151
|
if(this.publicationInfo.relatedResearchResults == undefined) {
|
152
|
this.publicationInfo.relatedResearchResults = new Array<{
|
153
|
"name": string, "url": string, "date": string,
|
154
|
"trust": string, "class": string}>();
|
155
|
}
|
156
|
|
157
|
counter = this.publicationInfo.relatedResearchResults.length;
|
158
|
this.publicationInfo.relatedResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
159
|
|
160
|
let url;
|
161
|
if(mydata['resulttype'].classname == "publication") {
|
162
|
url = OpenaireProperties.getsearchLinkToPublication() + mydata['to'].content;
|
163
|
this.publicationInfo.relatedResearchResults[counter]['class'] = "publication";
|
164
|
} else {
|
165
|
url = OpenaireProperties.getsearchLinkToDataset() + mydata['to'].content;
|
166
|
this.publicationInfo.relatedResearchResults[counter]['class'] = "dataset";
|
167
|
}
|
168
|
|
169
|
this.publicationInfo.relatedResearchResults[counter]['url'] = url;
|
170
|
this.publicationInfo.relatedResearchResults[counter]['name'] = mydata['title'].content;
|
171
|
this.publicationInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
172
|
this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
173
|
|
174
|
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
|
175
|
if(this.publicationInfo.similarResearchResults == undefined) {
|
176
|
this.publicationInfo.similarResearchResults = new Array<{
|
177
|
"name": string, "url": string, "date": string,
|
178
|
"trust": string, "class": string}>();
|
179
|
}
|
180
|
|
181
|
counter = this.publicationInfo.similarResearchResults.length;
|
182
|
this.publicationInfo.similarResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
183
|
|
184
|
let url;
|
185
|
if(mydata['resulttype'].classname == "publication") {
|
186
|
url = OpenaireProperties.getsearchLinkToPublication() + mydata['to'].content;
|
187
|
this.publicationInfo.similarResearchResults[counter]['class'] = "publication";
|
188
|
} else {
|
189
|
url = OpenaireProperties.getsearchLinkToDataset() + mydata['to'].content;
|
190
|
this.publicationInfo.similarResearchResults[counter]['class'] = "dataset";
|
191
|
}
|
192
|
|
193
|
this.publicationInfo.similarResearchResults[counter]['url'] = url;
|
194
|
this.publicationInfo.similarResearchResults[counter]['name'] = mydata['title'].content;
|
195
|
this.publicationInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
196
|
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
197
|
}
|
198
|
}
|
199
|
}
|
200
|
|
201
|
if(this.publicationInfo.authors != undefined) {
|
202
|
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
|
203
|
return (item != undefined);
|
204
|
});
|
205
|
}
|
206
|
}
|
207
|
|
208
|
if(data[3] != null) {
|
209
|
if(data[3].hasOwnProperty("instance")) {
|
210
|
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
211
|
this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[]}>();
|
212
|
|
213
|
this.publicationInfo.types = new Array<string>();
|
214
|
|
215
|
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
216
|
|
217
|
let types = new Set<string>();
|
218
|
let counter = 0;
|
219
|
let counter1 = 0;
|
220
|
let counter2 = 0;
|
221
|
let mydata;
|
222
|
for(let i=0; i<length; i++) {
|
223
|
mydata = length > 1 ? data[3]['instance'][i] : data[3]['instance'];
|
224
|
|
225
|
if(mydata.hasOwnProperty("instancetype")) {
|
226
|
if(!types.has(mydata['instancetype'].classname)) {
|
227
|
this.publicationInfo.types[counter] = mydata['instancetype'].classname;
|
228
|
types.add(mydata['instancetype'].classname);
|
229
|
counter++;
|
230
|
}
|
231
|
}
|
232
|
|
233
|
if(mydata.hasOwnProperty("webresource")) {
|
234
|
let url;
|
235
|
if(mydata['webresource'].length == undefined) {
|
236
|
url = mydata['webresource'].url;
|
237
|
} else{
|
238
|
url = mydata['webresource'][0].url;
|
239
|
}
|
240
|
|
241
|
if(mydata.hasOwnProperty("hostedby")) {
|
242
|
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
|
243
|
if(!this.publicationInfo.downloadFrom.has(mydata['hostedby'].name)) {
|
244
|
this.publicationInfo.downloadFrom.set(mydata['hostedby'].name, {"url": null, "accessMode": null});
|
245
|
}
|
246
|
|
247
|
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] == null) {
|
248
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] = new Array<string>();
|
249
|
}
|
250
|
|
251
|
counter2 = this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'].length;
|
252
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'][counter2] = url;
|
253
|
|
254
|
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] == null) {
|
255
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] = new Array<string>();
|
256
|
}
|
257
|
|
258
|
if(mydata.hasOwnProperty("licence")) {
|
259
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
|
260
|
} else {
|
261
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
|
262
|
}
|
263
|
} else {
|
264
|
if(data[0] != null && data[0].hasOwnProperty("source")) {
|
265
|
let key: string;
|
266
|
if(Array.isArray(data[0].source)) {
|
267
|
if(!this.publicationInfo.publishedIn.has(data[0]['source'][counter1])) {
|
268
|
key = data[0]['source'][counter1];
|
269
|
}
|
270
|
} else {
|
271
|
if(!this.publicationInfo.publishedIn.has(data[0]['source'])) {
|
272
|
key = data[0]['source'];
|
273
|
}
|
274
|
}
|
275
|
|
276
|
this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null});
|
277
|
|
278
|
if(this.publicationInfo.publishedIn.get(key)['url'] == null) {
|
279
|
this.publicationInfo.publishedIn.get(key)['url'] = new Array<string>();
|
280
|
}
|
281
|
|
282
|
counter2 = this.publicationInfo.publishedIn.get(key)['url'].length;
|
283
|
this.publicationInfo.publishedIn.get(key)['url'][counter2] = url;
|
284
|
|
285
|
if(this.publicationInfo.publishedIn.get(key)['accessMode'] == null) {
|
286
|
this.publicationInfo.publishedIn.get(key)['accessMode'] = new Array<string>();
|
287
|
}
|
288
|
|
289
|
if(mydata.hasOwnProperty("licence")) {
|
290
|
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
|
291
|
} else {
|
292
|
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = "";
|
293
|
}
|
294
|
counter1++;
|
295
|
}
|
296
|
}
|
297
|
if(this.publicationInfo.title != undefined) {
|
298
|
if(this.publicationInfo.title['url'] == "") {
|
299
|
this.publicationInfo.title['url'] = url;
|
300
|
}
|
301
|
|
302
|
switch (this.publicationInfo.title['accessMode']) {
|
303
|
case undefined:
|
304
|
this.publicationInfo.title['accessMode'] = mydata['accessMode'].classid;
|
305
|
this.publicationInfo.title['url'] = url;
|
306
|
break;
|
307
|
case "CLOSED":
|
308
|
if(mydata['licence'].classid == "OPEN" ||
|
309
|
mydata['licence'].classid == "EMBARGO" ||
|
310
|
mydata['licence'].classid == "RESTRICTED") {
|
311
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
312
|
this.publicationInfo.title['url'] = url;
|
313
|
}
|
314
|
break;
|
315
|
case "RESTRICTED":
|
316
|
if(mydata['licence'].classid == "OPEN" ||
|
317
|
mydata['licence'].classid == "EMBARGO") {
|
318
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
319
|
this.publicationInfo.title['url'] = url;
|
320
|
}
|
321
|
break;
|
322
|
case "EMBARGO":
|
323
|
if(mydata['licence'].classid == "OPEN") {
|
324
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
325
|
this.publicationInfo.title['url'] = url;
|
326
|
}
|
327
|
break;
|
328
|
}
|
329
|
}
|
330
|
}
|
331
|
}
|
332
|
}
|
333
|
}
|
334
|
|
335
|
if(data[3].hasOwnProperty("externalreference")) {
|
336
|
let length = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'].length : 1;
|
337
|
|
338
|
let mydata;
|
339
|
for(let i=0; i<length; i++) {
|
340
|
mydata = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'][i] : data[3]['externalreference'];
|
341
|
|
342
|
if(mydata.hasOwnProperty("qualifier")) {
|
343
|
if(mydata['qualifier'].classid == "accessionNumber") {
|
344
|
|
345
|
if(this.publicationInfo.bioentities == undefined) {
|
346
|
this.publicationInfo.bioentities = new Map<string, Map<string, string>>();
|
347
|
}
|
348
|
|
349
|
if(!this.publicationInfo.bioentities.has(mydata.sitename)) {
|
350
|
this.publicationInfo.bioentities.set(mydata.sitename, new Map<string, string>());
|
351
|
}
|
352
|
this.publicationInfo.bioentities.get(mydata.sitename).set(mydata.refidentifier, mydata.url);
|
353
|
|
354
|
} else if(mydata['qualifier'].classid == "software") {
|
355
|
|
356
|
if(this.publicationInfo.software == undefined) {
|
357
|
this.publicationInfo.software = new Array<{"name": string, "url": string}>();
|
358
|
}
|
359
|
|
360
|
this.publicationInfo.software.push({"name": mydata.sitename, "url": mydata.url});
|
361
|
}
|
362
|
}
|
363
|
}
|
364
|
}
|
365
|
}
|
366
|
|
367
|
if(data[4] != null) {
|
368
|
let counter = 0;
|
369
|
this.publicationInfo.identifiers = new Map<string, string[]>();
|
370
|
|
371
|
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
372
|
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
373
|
if(!this.publicationInfo.identifiers.has(data[4].classname)) {
|
374
|
this.publicationInfo.identifiers.set(data[4].classname, new Array<string>());
|
375
|
}
|
376
|
counter = this.publicationInfo.identifiers.get(data[4].classname).length;
|
377
|
this.publicationInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
|
378
|
}
|
379
|
} else {
|
380
|
for(let i=0; i<data[4].length; i++) {
|
381
|
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
382
|
if(!this.publicationInfo.identifiers.has(data[4][i].classname)) {
|
383
|
this.publicationInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
384
|
}
|
385
|
counter = this.publicationInfo.identifiers.get(data[4][i].classname).length;
|
386
|
this.publicationInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
|
387
|
}
|
388
|
}
|
389
|
}
|
390
|
}
|
391
|
|
392
|
if(data[5] != null) {
|
393
|
this.publicationInfo.journal = {"journal": "", "issn": "", "lissn": ""}
|
394
|
|
395
|
this.publicationInfo.journal['journal'] = data[5].content;
|
396
|
this.publicationInfo.journal['issn'] = data[5].issn;
|
397
|
this.publicationInfo.journal['lissn'] = data[5].lissn;
|
398
|
}
|
399
|
|
400
|
if(data[6] != null) {
|
401
|
this.publicationInfo.languages = new Array<string>();
|
402
|
|
403
|
if(data[6].hasOwnProperty("classname")) {
|
404
|
this.publicationInfo.languages[0] = data[6].classname;
|
405
|
} else {
|
406
|
for(let i=0; i<data[6].length; i++) {
|
407
|
this.publicationInfo.languages[i] = data[6][i].classname;
|
408
|
}
|
409
|
}
|
410
|
}
|
411
|
|
412
|
if(data[7] != null) {
|
413
|
let mydata;
|
414
|
let length = data[7].length!=undefined ? data[7].length : 1;
|
415
|
|
416
|
for(let i=0; i<length; i++) {
|
417
|
mydata = length > 1 ? data[7][i] : data[7];
|
418
|
|
419
|
if(mydata.classid != "") {
|
420
|
if(mydata.inferred == true) {
|
421
|
if(this.publicationInfo.classifiedSubjects == undefined) {
|
422
|
this.publicationInfo.classifiedSubjects = new Map<string, string[]>();
|
423
|
}
|
424
|
|
425
|
if(!this.publicationInfo.classifiedSubjects.has(mydata.classname)) {
|
426
|
this.publicationInfo.classifiedSubjects.set(mydata.classname, new Array<string>());
|
427
|
}
|
428
|
|
429
|
this.publicationInfo.classifiedSubjects.get(mydata.classname).push(mydata.content);
|
430
|
} else {
|
431
|
if(mydata.classid == "keyword") {
|
432
|
if(this.publicationInfo.subjects == undefined) {
|
433
|
this.publicationInfo.subjects = new Array<string>();
|
434
|
}
|
435
|
|
436
|
this.publicationInfo.subjects.push(mydata.content);
|
437
|
} else {
|
438
|
if(this.publicationInfo.otherSubjects == undefined) {
|
439
|
this.publicationInfo.otherSubjects = new Map<string, string[]>();
|
440
|
}
|
441
|
|
442
|
if(!this.publicationInfo.otherSubjects.has(mydata.classname)) {
|
443
|
this.publicationInfo.otherSubjects.set(mydata.classname, new Array<string>());
|
444
|
}
|
445
|
this.publicationInfo.otherSubjects.get(mydata.classname).push(mydata.content);
|
446
|
}
|
447
|
}
|
448
|
}
|
449
|
}
|
450
|
}
|
451
|
|
452
|
if(data[8] != null) {
|
453
|
this.publicationInfo.bestlicense = data[8].classid;
|
454
|
}
|
455
|
|
456
|
if(data[9] != null) {
|
457
|
this.publicationInfo.collectedFrom = new Array<{"name": string, "url": string}>();
|
458
|
|
459
|
let mydata;
|
460
|
let length = data[9].length!=undefined ? data[9].length : 1;
|
461
|
for(let i=0; i<length; i++) {
|
462
|
mydata = length > 1 ? data[9][i] : data[9];
|
463
|
let link = OpenaireProperties.getsearchLinkToDataProvider();
|
464
|
this.publicationInfo.collectedFrom[i] = {"name": "", "url": ""};
|
465
|
this.publicationInfo.collectedFrom[i]['name'] = mydata.name;
|
466
|
this.publicationInfo.collectedFrom[i]['url'] = link+mydata.id;
|
467
|
}
|
468
|
}
|
469
|
|
470
|
if(this.publicationInfo.publisher != null
|
471
|
&& this.publicationInfo.identifiers != null
|
472
|
&& this.publicationInfo.identifiers.has('doi')) {
|
473
|
|
474
|
if( this.publicationInfo.downloadFrom == null) {
|
475
|
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
476
|
}
|
477
|
|
478
|
let key: string;
|
479
|
if(this.publicationInfo.journal != null) {
|
480
|
key = this.publicationInfo.publisher + "/ "+this.publicationInfo.journal['journal'];
|
481
|
} else {
|
482
|
key = this.publicationInfo.publisher;
|
483
|
}
|
484
|
this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null});
|
485
|
|
486
|
let url = OpenaireProperties.getDoiURL()+this.publicationInfo.identifiers.get("doi")[0];
|
487
|
|
488
|
this.publicationInfo.downloadFrom.get(key)['url'] = new Array<string>();
|
489
|
this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array<string>();
|
490
|
|
491
|
this.publicationInfo.downloadFrom.get(key)['url'][0] = url;
|
492
|
this.publicationInfo.downloadFrom.get(key)['accessMode'][0] = "";
|
493
|
|
494
|
if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") {
|
495
|
this.publicationInfo.title['url'] = url;
|
496
|
}
|
497
|
}
|
498
|
|
499
|
if(data[10] != null) {
|
500
|
this.publicationInfo.references = new Array<{"name": string, "url": string}>();
|
501
|
|
502
|
let mydata;
|
503
|
let length = data[10].length!=undefined ? data[10].length : 1;
|
504
|
for(let i=0; i<length; i++) {
|
505
|
mydata = length > 1 ? data[10][i] : data[10];
|
506
|
|
507
|
let url;
|
508
|
if(mydata.hasOwnProperty("id")) {
|
509
|
let mydata1;
|
510
|
let length1 = mydata['id'].length!=undefined ? mydata['id'].length : 1;
|
511
|
for(let j=0; j<length1; j++) {
|
512
|
mydata1 = length1 > 1 ? mydata['id'][j] : mydata['id'];
|
513
|
|
514
|
if(mydata1.type == "pmid") {
|
515
|
url = OpenaireProperties.getPmidURL()+mydata1.value;
|
516
|
}
|
517
|
}
|
518
|
}
|
519
|
|
520
|
this.publicationInfo.references[mydata.position-1] = { "name": "", "url": ""};
|
521
|
this.publicationInfo.references[mydata.position-1]['name'] = mydata.rawText;
|
522
|
this.publicationInfo.references[mydata.position-1]['url'] = url;
|
523
|
}
|
524
|
}
|
525
|
|
526
|
if(data[11] != null) {
|
527
|
this.publicationInfo.contexts = new Array<
|
528
|
{ "labelContext": string, "labelCategory": string, "labelConcept": string, inline:boolean}>();
|
529
|
|
530
|
let position = 0;
|
531
|
let labels = "";
|
532
|
let mydata;
|
533
|
let length = data[11].length!=undefined ? data[11].length : 1;
|
534
|
for(let i=0; i<length; i++) {
|
535
|
mydata = length > 1 ? data[11][i] : data[11];
|
536
|
|
537
|
if(mydata.hasOwnProperty("type") && mydata['type'] == "community") {
|
538
|
if(mydata.hasOwnProperty("category")) {
|
539
|
if(mydata['category'].hasOwnProperty("concept")) {
|
540
|
let mydata1;
|
541
|
let length1 = mydata['category']['concept'].length!=undefined ? mydata['category']['concept'].length : 1;
|
542
|
for(let j=0; j<length1; j++) {
|
543
|
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
|
544
|
|
545
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false };
|
546
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
547
|
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
548
|
this.publicationInfo.contexts[position]['labelConcept'] = mydata1.label;
|
549
|
|
550
|
position++;
|
551
|
}
|
552
|
} else {
|
553
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
554
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
555
|
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
556
|
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
557
|
}
|
558
|
} else {
|
559
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
560
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
561
|
this.publicationInfo.contexts[position]['labelCategory'] = null;
|
562
|
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
563
|
this.publicationInfo.contexts[position]['new'] = false;
|
564
|
}
|
565
|
}
|
566
|
}
|
567
|
}
|
568
|
|
569
|
//this.printPublicationInfo();
|
570
|
return this.publicationInfo;
|
571
|
|
572
|
}
|
573
|
|
574
|
printPublicationInfo() {
|
575
|
console.info("DATE: "+this.publicationInfo.date);
|
576
|
console.info("PUBLISHER: "+this.publicationInfo.publisher);
|
577
|
console.info("DESCRIPTION: "+this.publicationInfo.description);
|
578
|
|
579
|
console.info("TITLE: "+this.publicationInfo.title);
|
580
|
|
581
|
console.info("AUTHORS: "+this.publicationInfo.authors);
|
582
|
console.info("\nFUNDED BY PROJECTS:");
|
583
|
if(this.publicationInfo.fundedByProjects != undefined) {
|
584
|
this.publicationInfo.fundedByProjects.forEach(function (value, key, map) {
|
585
|
console.info(key + " = " + value);
|
586
|
});
|
587
|
} else {
|
588
|
console.info("undefined");
|
589
|
}
|
590
|
console.info("\n");
|
591
|
/*
|
592
|
console.info("\nRELATED RESEARCH DATA:");
|
593
|
if(this.publicationInfo.relatedResearchData != undefined) {
|
594
|
this.publicationInfo.relatedResearchData.forEach(function (value, key, map) {
|
595
|
console.info(key + " = " + value);
|
596
|
});
|
597
|
} else {
|
598
|
console.info("undefined");
|
599
|
}
|
600
|
console.info("\n");
|
601
|
|
602
|
console.info("\nSIMILAR PUBLICATIONS:");
|
603
|
if(this.publicationInfo.similarPublications != undefined) {
|
604
|
this.publicationInfo.similarPublications.forEach(function (value, key, map) {
|
605
|
console.info(key + " = " + value);
|
606
|
});
|
607
|
} else {
|
608
|
console.info("undefined");
|
609
|
}
|
610
|
console.info("\n");
|
611
|
*/
|
612
|
console.info("TYPES: "+this.publicationInfo.types);
|
613
|
console.info("\nDOWNLOAD FROM:");
|
614
|
if(this.publicationInfo.downloadFrom != undefined) {
|
615
|
this.publicationInfo.downloadFrom.forEach(function (value, key, map) {
|
616
|
console.info(key + " = " + value);
|
617
|
});
|
618
|
} else {
|
619
|
console.info("undefined");
|
620
|
}
|
621
|
console.info("\n");
|
622
|
console.info("\nBIOENTITIES:");
|
623
|
if(this.publicationInfo.bioentities != undefined) {
|
624
|
this.publicationInfo.bioentities.forEach(function (value, key, map) {
|
625
|
value.forEach(function (value1, key1, map1) {
|
626
|
console.info(key + " = " + key1 + " = " + value1);
|
627
|
})
|
628
|
})
|
629
|
} else {
|
630
|
console.info("undefined");
|
631
|
}
|
632
|
console.info("\n");
|
633
|
|
634
|
console.info("\nIDENTIFIERS:");
|
635
|
if(this.publicationInfo.identifiers != undefined) {
|
636
|
this.publicationInfo.identifiers.forEach(function (value, key, map) {
|
637
|
console.info(key + " = " + value);
|
638
|
});
|
639
|
} else {
|
640
|
console.info("undefined");
|
641
|
}
|
642
|
console.info("\n");
|
643
|
|
644
|
console.info("JOURNAL: "+this.publicationInfo.journal);
|
645
|
|
646
|
|
647
|
console.info("LANGUAGES: "+this.publicationInfo.languages);
|
648
|
|
649
|
|
650
|
console.info("SUBJECTS: "+this.publicationInfo.subjects);
|
651
|
console.info("\nCLASSIFIED OBJECTS:");
|
652
|
if(this.publicationInfo.classifiedSubjects != undefined) {
|
653
|
this.publicationInfo.classifiedSubjects.forEach(function (value, key, map) {
|
654
|
console.info(key + " = " + value);
|
655
|
});
|
656
|
} else {
|
657
|
console.info("undefined");
|
658
|
}
|
659
|
console.info("\n");
|
660
|
|
661
|
console.info("BEST LICENSE: "+this.publicationInfo.bestlicense);
|
662
|
|
663
|
console.info("\nCOLLECTED FROM:");
|
664
|
if(this.publicationInfo.collectedFrom != undefined) {
|
665
|
this.publicationInfo.collectedFrom.forEach(function (value, key, map) {
|
666
|
console.info(key + " = " + value);
|
667
|
});
|
668
|
} else {
|
669
|
console.info("undefined");
|
670
|
}
|
671
|
console.info("\n");
|
672
|
|
673
|
console.info("\nREFERENCES:");
|
674
|
if(this.publicationInfo.references != undefined) {
|
675
|
for(let i in this.publicationInfo.references) {
|
676
|
for(let key in this.publicationInfo.references[i]) {
|
677
|
console.info(key+" : "+this.publicationInfo.references[i][key]);
|
678
|
}
|
679
|
}
|
680
|
} else {
|
681
|
console.info("undefined");
|
682
|
}
|
683
|
}
|
684
|
|
685
|
}
|