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