709 lines
37 KiB
TypeScript
709 lines
37 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {Http, Response} from '@angular/http';
|
|
import {Observable} from 'rxjs/Observable';
|
|
import {PublicationInfo} from '../entities/publicationInfo';
|
|
|
|
@Injectable()
|
|
export class PublicationService {
|
|
|
|
constructor(private http: Http) {}
|
|
|
|
publicationInfo: PublicationInfo;
|
|
|
|
getPublicationInfo (id: string):any {
|
|
console.info("getPublicationInfo in service");
|
|
|
|
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
|
//let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
|
let url = 'http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/publications/'+id;
|
|
|
|
return this.http.get(url)
|
|
.map(res => <any> res.json())
|
|
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
|
.map(res => res['result']['metadata']['oaf:entity'])
|
|
.map(res => [res['oaf:result'],
|
|
res['oaf:result']['title'],
|
|
res['oaf:result']['rels']['rel'],
|
|
res['oaf:result']['children'],
|
|
res['oaf:result']['pid'],
|
|
res['oaf:result']['journal'],
|
|
res['oaf:result']['language'],
|
|
res['oaf:result']['subject'],
|
|
res['oaf:result']['bestlicense'],
|
|
res['oaf:result']['collectedfrom'],
|
|
(res['extraInfo']!= undefined && res['extraInfo']['citations']!= undefined)? res['extraInfo']['citations']['citation']:null,
|
|
res['oaf:result']['context']
|
|
])
|
|
.map(res => this.parsePublicationInfo(res));
|
|
|
|
}
|
|
|
|
private handleError (error: Response) {
|
|
// in a real world app, we may send the error to some remote logging infrastructure
|
|
// instead of just logging it to the console
|
|
console.error(error);
|
|
return Observable.throw(error || 'Server error');
|
|
}
|
|
|
|
parsePublicationInfo (data: any):any {
|
|
this.publicationInfo = new PublicationInfo();
|
|
|
|
if(data[0] != null) {
|
|
this.publicationInfo.date = data[0].dateofacceptance.substring(0,4);
|
|
this.publicationInfo.publisher = data[0].publisher;
|
|
if(!Array.isArray(data[0].description)) {
|
|
this.publicationInfo.description = data[0].description;
|
|
} else {
|
|
this.publicationInfo.description = data[0].description[0];
|
|
}
|
|
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
|
}
|
|
|
|
if(data[1] != null) {
|
|
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
|
|
|
if(Array.isArray(data[1])) {
|
|
this.publicationInfo.title['name'] = data[1][0].content;
|
|
} else {
|
|
this.publicationInfo.title['name'] = data[1].content;
|
|
}
|
|
}
|
|
|
|
if(data[2] != null) {
|
|
let mydata;
|
|
let counter = 0;
|
|
let length = data[2].length!=undefined ? data[2].length : 1;
|
|
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[2][i] : data[2];
|
|
if(mydata.hasOwnProperty("to")) {
|
|
if(mydata['to'].class == "hasAuthor") {
|
|
if(this.publicationInfo.authors == undefined) {
|
|
this.publicationInfo.authors = new Array<{"name": string, "url": string}>();
|
|
}
|
|
|
|
this.publicationInfo.authors[mydata.ranking-1] = {"name": "", "url": ""};
|
|
this.publicationInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
|
|
this.publicationInfo.authors[mydata.ranking-1]['url'] = "https://beta.openaire.eu/search/person?personId="+mydata['to'].content;
|
|
} else if(mydata['to'].class == "isProducedBy") {
|
|
if(this.publicationInfo.fundedByProjects == undefined) {
|
|
this.publicationInfo.fundedByProjects = new Array<
|
|
{ "url": string, "acronym": string, "title": string,
|
|
"funderShortname": string, "funderName": string,
|
|
"funding": string, "new": boolean
|
|
}>();
|
|
}
|
|
|
|
counter = this.publicationInfo.fundedByProjects.length;
|
|
|
|
this.publicationInfo.fundedByProjects[counter] = {
|
|
"url": "", "acronym": "", "title": "",
|
|
"funderShortname": "", "funderName": "",
|
|
"funding": "", "new": false
|
|
}
|
|
|
|
this.publicationInfo.fundedByProjects[counter]['url'] =
|
|
"http://localhost:3000/project?projectId="+mydata['to'].content;
|
|
this.publicationInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
|
|
this.publicationInfo.fundedByProjects[counter]['title'] = mydata.title;
|
|
|
|
if(mydata.hasOwnProperty("funding")) {
|
|
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
|
|
|
|
for(let j=0; j<length1; j++) {
|
|
let funding;
|
|
let mydata1 = length1 > 1 ? mydata['funding'][j] : mydata['funding'];
|
|
|
|
if(mydata1.hasOwnProperty("funder")) {
|
|
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
|
this.publicationInfo.fundedByProjects[counter]['funderName'] = mydata1['funder'].name;
|
|
}
|
|
|
|
if(mydata1.hasOwnProperty("funding_level_2")) {
|
|
funding = mydata1['funding_level_2'].content;
|
|
} else if(mydata1.hasOwnProperty("funding_level_1")) {
|
|
funding = mydata1['funding_level_1'].content;
|
|
} else if(mydata1.hasOwnProperty("funding_level_0")) {
|
|
funding = mydata1['funding_level_0'].content;
|
|
}
|
|
|
|
if(funding != undefined) {
|
|
funding = funding.split("::");
|
|
|
|
if(this.publicationInfo.fundedByProjects[counter]['funding'] != "") {
|
|
this.publicationInfo.fundedByProjects[counter]['funding'] += ", "+funding[1];
|
|
} else {
|
|
this.publicationInfo.fundedByProjects[counter]['funding'] = funding[1];
|
|
}
|
|
for(let i=2; i<funding.length; i++) {
|
|
this.publicationInfo.fundedByProjects[counter]['funding'] += " | " + funding[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if(mydata['to'].class == "isRelatedTo") {
|
|
/* if(mydata['resulttype'].classname == "publication") {
|
|
if(this.publicationInfo.relatedPublications == undefined) {
|
|
this.publicationInfo.relatedPublications = new Array<{
|
|
"name": string, "url": string, "date": string, "trust": string}>();
|
|
}
|
|
|
|
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
|
counter = this.publicationInfo.relatedPublications.length;
|
|
|
|
this.publicationInfo.relatedPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
|
|
|
this.publicationInfo.relatedPublications[counter]['url'] = url;
|
|
this.publicationInfo.relatedPublications[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.relatedPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
|
this.publicationInfo.relatedPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
} else {
|
|
if(this.publicationInfo.relatedResearchData == undefined) {
|
|
this.publicationInfo.relatedResearchData = new Array<{
|
|
"name": string, "url": string, "date": string, "trust": string}>();
|
|
}
|
|
|
|
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
|
counter = this.publicationInfo.relatedResearchData.length;
|
|
|
|
this.publicationInfo.relatedResearchData[counter] = {"name": "", "url": "", "date": "", "trust": ""}
|
|
|
|
this.publicationInfo.relatedResearchData[counter]['url'] = url;
|
|
this.publicationInfo.relatedResearchData[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.relatedResearchData[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
|
this.publicationInfo.relatedResearchData[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
}*/
|
|
if(this.publicationInfo.relatedResearchResults == undefined) {
|
|
this.publicationInfo.relatedResearchResults = new Array<{
|
|
"name": string, "url": string, "date": string,
|
|
"trust": string, "class": string}>();
|
|
}
|
|
|
|
counter = this.publicationInfo.relatedResearchResults.length;
|
|
this.publicationInfo.relatedResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
|
|
|
let url;
|
|
if(mydata['resulttype'].classname == "publication") {
|
|
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
|
this.publicationInfo.relatedResearchResults[counter]['class'] = "publication";
|
|
} else {
|
|
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
|
this.publicationInfo.relatedResearchResults[counter]['class'] = "dataset";
|
|
}
|
|
|
|
this.publicationInfo.relatedResearchResults[counter]['url'] = url;
|
|
this.publicationInfo.relatedResearchResults[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
|
this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
|
|
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
|
|
/*if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "publication") {
|
|
if(this.publicationInfo.similarPublications == undefined) {
|
|
this.publicationInfo.similarPublications = new Array<
|
|
{ "name": string, "url": string, "date": string, "trust": string}>();
|
|
}
|
|
|
|
let url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
|
let counter = this.publicationInfo.similarPublications.length;
|
|
|
|
this.publicationInfo.similarPublications[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
|
this.publicationInfo.similarPublications[counter]['url'] = url;
|
|
this.publicationInfo.similarPublications[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.similarPublications[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
|
this.publicationInfo.similarPublications[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
} else if(mydata.hasOwnProperty('resulttype') && mydata['resulttype'].classname == "dataset") {
|
|
if(this.publicationInfo.similarDatasets == undefined) {
|
|
this.publicationInfo.similarDatasets = new Array<
|
|
{ "name": string, "url": string, "date": string, "trust": string}>();
|
|
}
|
|
|
|
let url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
|
let counter = this.publicationInfo.similarDatasets.length;
|
|
|
|
this.publicationInfo.similarDatasets[counter] = {"name": "", "url": "", "date": "", "trust": ""};
|
|
this.publicationInfo.similarDatasets[counter]['url'] = url;
|
|
this.publicationInfo.similarDatasets[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.similarDatasets[counter]['date'] = mydata.dateofacceptance.substring(0,4);
|
|
this.publicationInfo.similarDatasets[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
}*/
|
|
|
|
if(this.publicationInfo.similarResearchResults == undefined) {
|
|
this.publicationInfo.similarResearchResults = new Array<{
|
|
"name": string, "url": string, "date": string,
|
|
"trust": string, "class": string}>();
|
|
}
|
|
|
|
counter = this.publicationInfo.similarResearchResults.length;
|
|
this.publicationInfo.similarResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
|
|
|
|
let url;
|
|
if(mydata['resulttype'].classname == "publication") {
|
|
url = "http://localhost:3000/publication?articleId="+mydata['to'].content;
|
|
this.publicationInfo.similarResearchResults[counter]['class'] = "publication";
|
|
} else {
|
|
url = "http://localhost:3000/dataset?datasetId="+mydata['to'].content;
|
|
this.publicationInfo.similarResearchResults[counter]['class'] = "dataset";
|
|
}
|
|
|
|
this.publicationInfo.similarResearchResults[counter]['url'] = url;
|
|
this.publicationInfo.similarResearchResults[counter]['name'] = mydata['title'].content;
|
|
this.publicationInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
|
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
|
}
|
|
}
|
|
}
|
|
|
|
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
|
|
return (item != undefined);
|
|
});
|
|
}
|
|
|
|
if(data[3] != null) {
|
|
if(data[3].hasOwnProperty("instance")) {
|
|
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
|
this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[]}>();
|
|
|
|
this.publicationInfo.types = new Array<string>();
|
|
|
|
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
|
|
|
let types = new Set<string>();
|
|
let counter = 0;
|
|
let counter1 = 0;
|
|
let counter2 = 0;
|
|
let mydata;
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[3]['instance'][i] : data[3]['instance'];
|
|
|
|
if(mydata.hasOwnProperty("instancetype")) {
|
|
if(!types.has(mydata['instancetype'].classname)) {
|
|
this.publicationInfo.types[counter] = mydata['instancetype'].classname;
|
|
types.add(mydata['instancetype'].classname);
|
|
counter++;
|
|
}
|
|
}
|
|
|
|
if(mydata.hasOwnProperty("webresource")) {
|
|
let url;
|
|
if(mydata['webresource'].length == undefined) {
|
|
url = mydata['webresource'].url;
|
|
} else{
|
|
url = mydata['webresource'][0].url;
|
|
}
|
|
|
|
if(mydata.hasOwnProperty("hostedby")) {
|
|
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
|
|
if(!this.publicationInfo.downloadFrom.has(mydata['hostedby'].name)) {
|
|
this.publicationInfo.downloadFrom.set(mydata['hostedby'].name, {"url": null, "accessMode": null});
|
|
}
|
|
|
|
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] == null) {
|
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] = new Array<string>();
|
|
}
|
|
|
|
counter2 = this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'].length;
|
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'][counter2] = url;
|
|
|
|
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] == null) {
|
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] = new Array<string>();
|
|
}
|
|
|
|
if(mydata.hasOwnProperty("licence")) {
|
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
|
|
} else {
|
|
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
|
|
}
|
|
} else {
|
|
if(data[0] != null && data[0].hasOwnProperty("source")) {
|
|
let key: string;
|
|
if(Array.isArray(data[0].source)) {
|
|
if(!this.publicationInfo.publishedIn.has(data[0]['source'][counter1])) {
|
|
key = data[0]['source'][counter1];
|
|
}
|
|
} else {
|
|
if(!this.publicationInfo.publishedIn.has(data[0]['source'])) {
|
|
key = data[0]['source'];
|
|
}
|
|
}
|
|
|
|
this.publicationInfo.publishedIn.set(key, {"url": null, "accessMode": null});
|
|
|
|
if(this.publicationInfo.publishedIn.get(key)['url'] == null) {
|
|
this.publicationInfo.publishedIn.get(key)['url'] = new Array<string>();
|
|
}
|
|
|
|
counter2 = this.publicationInfo.publishedIn.get(key)['url'].length;
|
|
this.publicationInfo.publishedIn.get(key)['url'][counter2] = url;
|
|
|
|
if(this.publicationInfo.publishedIn.get(key)['accessMode'] == null) {
|
|
this.publicationInfo.publishedIn.get(key)['accessMode'] = new Array<string>();
|
|
}
|
|
|
|
if(mydata.hasOwnProperty("licence")) {
|
|
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
|
|
} else {
|
|
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = "";
|
|
}
|
|
counter1++;
|
|
}
|
|
}
|
|
if(this.publicationInfo.title != undefined) {
|
|
if(this.publicationInfo.title['url'] == "") {
|
|
this.publicationInfo.title['url'] = url;
|
|
}
|
|
|
|
switch (this.publicationInfo.title['accessMode']) {
|
|
case undefined:
|
|
this.publicationInfo.title['accessMode'] = mydata['accessMode'].classid;
|
|
this.publicationInfo.title['url'] = url;
|
|
break;
|
|
case "CLOSED":
|
|
if(mydata['licence'].classid == "OPEN" ||
|
|
mydata['licence'].classid == "EMBARGO" ||
|
|
mydata['licence'].classid == "RESTRICTED") {
|
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
|
this.publicationInfo.title['url'] = url;
|
|
}
|
|
break;
|
|
case "RESTRICTED":
|
|
if(mydata['licence'].classid == "OPEN" ||
|
|
mydata['licence'].classid == "EMBARGO") {
|
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
|
this.publicationInfo.title['url'] = url;
|
|
}
|
|
break;
|
|
case "EMBARGO":
|
|
if(mydata['licence'].classid == "OPEN") {
|
|
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
|
|
this.publicationInfo.title['url'] = url;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(data[3].hasOwnProperty("externalreference")) {
|
|
this.publicationInfo.bioentities = new Map<string, Map<string, string>>();
|
|
|
|
let length = data[3]['externalreference'].length!=undefined ? data[3]['externalreference'].length : 1;
|
|
|
|
let mydata;
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[3]['externalreference'][i] : data[3]['externalreference'];
|
|
|
|
if(!this.publicationInfo.bioentities.has(mydata.sitename)) {
|
|
this.publicationInfo.bioentities.set(mydata.sitename, new Map<string, string>());
|
|
}
|
|
this.publicationInfo.bioentities.get(mydata.sitename).set(mydata.refidentifier, mydata.url);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(data[4] != null) {
|
|
let counter = 0;
|
|
this.publicationInfo.identifiers = new Map<string, string[]>();
|
|
|
|
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
|
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
|
if(!this.publicationInfo.identifiers.has(data[4].classname)) {
|
|
this.publicationInfo.identifiers.set(data[4].classname, new Array<string>());
|
|
}
|
|
counter = this.publicationInfo.identifiers.get(data[4].classname).length;
|
|
this.publicationInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
|
|
}
|
|
} else {
|
|
for(let i=0; i<data[4].length; i++) {
|
|
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
|
if(!this.publicationInfo.identifiers.has(data[4][i].classname)) {
|
|
this.publicationInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
|
}
|
|
counter = this.publicationInfo.identifiers.get(data[4][i].classname).length;
|
|
this.publicationInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(data[5] != null) {
|
|
this.publicationInfo.journal = {"journal": "", "issn": "", "lissn": ""}
|
|
|
|
this.publicationInfo.journal['journal'] = data[5].content;
|
|
this.publicationInfo.journal['issn'] = data[5].issn;
|
|
this.publicationInfo.journal['lissn'] = data[5].lissn;
|
|
}
|
|
|
|
if(data[6] != null) {
|
|
this.publicationInfo.languages = new Array<string>();
|
|
|
|
if(data[6].hasOwnProperty("classname")) {
|
|
this.publicationInfo.languages[0] = data[6].classname;
|
|
} else {
|
|
for(let i=0; i<data[6].length; i++) {
|
|
this.publicationInfo.languages[i] = data[6][i].classname;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(data[7] != null) {
|
|
this.publicationInfo.classifiedSubjects = new Map<string, string[]>();
|
|
this.publicationInfo.subjects = new Array<string>();
|
|
|
|
let mydata;
|
|
let length = data[7].length!=undefined ? data[7].length : 1;
|
|
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[7][i] : data[7];
|
|
|
|
if(mydata.classid != "") {
|
|
if(mydata.inferred == true) {
|
|
if(!this.publicationInfo.classifiedSubjects.has(mydata.classid)) {
|
|
this.publicationInfo.classifiedSubjects.set(mydata.classid, new Array<string>());
|
|
}
|
|
|
|
let counter = this.publicationInfo.classifiedSubjects.get(mydata.classid).length;
|
|
this.publicationInfo.classifiedSubjects.get(mydata.classid)[counter] = mydata.content;
|
|
} else {
|
|
let counter = this.publicationInfo.subjects.length;
|
|
this.publicationInfo.subjects[counter] = mydata.content;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(data[8] != null) {
|
|
this.publicationInfo.bestlicense = data[8].classid;
|
|
}
|
|
|
|
if(data[9] != null) {
|
|
this.publicationInfo.collectedFrom = new Array<{"name": string, "url": string}>();
|
|
|
|
let mydata;
|
|
let length = data[9].length!=undefined ? data[9].length : 1;
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[9][i] : data[9];
|
|
let link = "https://beta.openaire.eu/search/dataprovider?datasourceId=";
|
|
this.publicationInfo.collectedFrom[i] = {"name": "", "url": ""};
|
|
this.publicationInfo.collectedFrom[i]['name'] = mydata.name;
|
|
this.publicationInfo.collectedFrom[i]['url'] = link+mydata.id;
|
|
}
|
|
}
|
|
|
|
if(this.publicationInfo.publisher != null
|
|
&& this.publicationInfo.identifiers != null
|
|
&& this.publicationInfo.identifiers.has('doi')) {
|
|
|
|
if( this.publicationInfo.downloadFrom == null) {
|
|
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[]}>();
|
|
}
|
|
|
|
let key: string;
|
|
if(this.publicationInfo.journal != null) {
|
|
key = this.publicationInfo.publisher + "/ "+this.publicationInfo.journal
|
|
} else {
|
|
key = this.publicationInfo.publisher;
|
|
}
|
|
this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null});
|
|
|
|
let url = "http://dx.doi.org/"+this.publicationInfo.identifiers.get("doi")[0];
|
|
|
|
this.publicationInfo.downloadFrom.get(key)['url'] = new Array<string>();
|
|
this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array<string>();
|
|
|
|
this.publicationInfo.downloadFrom.get(key)['url'][0] = url;
|
|
this.publicationInfo.downloadFrom.get(key)['accessMode'][0] = "";
|
|
|
|
if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") {
|
|
this.publicationInfo.title['url'] = url;
|
|
}
|
|
}
|
|
|
|
if(data[10] != null) {
|
|
this.publicationInfo.references = new Array<{"name": string, "url": string}>();
|
|
|
|
let mydata;
|
|
let length = data[10].length!=undefined ? data[10].length : 1;
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[10][i] : data[10];
|
|
|
|
let url;
|
|
if(mydata.hasOwnProperty("id")) {
|
|
let mydata1;
|
|
let length1 = mydata['id'].length!=undefined ? mydata['id'].length : 1;
|
|
for(let j=0; j<length1; j++) {
|
|
mydata1 = length1 > 1 ? mydata['id'][j] : mydata['id'];
|
|
|
|
if(mydata1.type == "pmid") {
|
|
url = "http://www.ncbi.nlm.nih.gov/pubmed/"+mydata1.value;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.publicationInfo.references[mydata.position-1] = { "name": "", "url": ""};
|
|
this.publicationInfo.references[mydata.position-1]['name'] = mydata.rawText;
|
|
this.publicationInfo.references[mydata.position-1]['url'] = url;
|
|
}
|
|
}
|
|
|
|
if(data[11] != null) {
|
|
this.publicationInfo.contexts = new Array<
|
|
{ "labelContext": string, "labelCategory": string, "labelConcept": string}>();
|
|
|
|
let position = 0;
|
|
let labels = "";
|
|
let mydata;
|
|
let length = data[11].length!=undefined ? data[11].length : 1;
|
|
for(let i=0; i<length; i++) {
|
|
mydata = length > 1 ? data[11][i] : data[11];
|
|
|
|
if(mydata.hasOwnProperty("type") && mydata['type'] == "community") {
|
|
if(mydata.hasOwnProperty("category")) {
|
|
if(mydata['category'].hasOwnProperty("concept")) {
|
|
let mydata1;
|
|
let length1 = mydata['category']['concept'].length!=undefined ? mydata['category']['concept'].length : 1;
|
|
for(let j=0; j<length1; j++) {
|
|
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
|
|
|
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
|
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
|
this.publicationInfo.contexts[position]['labelConcept'] = mydata1.label;
|
|
|
|
position++;
|
|
}
|
|
} else {
|
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
|
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
|
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
|
}
|
|
} else {
|
|
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": ""};
|
|
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
|
|
this.publicationInfo.contexts[position]['labelCategory'] = null;
|
|
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//this.printPublicationInfo();
|
|
return this.publicationInfo;
|
|
|
|
}
|
|
|
|
printPublicationInfo() {
|
|
console.info("DATE: "+this.publicationInfo.date);
|
|
console.info("PUBLISHER: "+this.publicationInfo.publisher);
|
|
console.info("DESCRIPTION: "+this.publicationInfo.description);
|
|
|
|
console.info("TITLE: "+this.publicationInfo.title);
|
|
|
|
console.info("AUTHORS: "+this.publicationInfo.authors);
|
|
console.info("\nFUNDED BY PROJECTS:");
|
|
if(this.publicationInfo.fundedByProjects != undefined) {
|
|
this.publicationInfo.fundedByProjects.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
/*
|
|
console.info("\nRELATED RESEARCH DATA:");
|
|
if(this.publicationInfo.relatedResearchData != undefined) {
|
|
this.publicationInfo.relatedResearchData.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
|
|
console.info("\nSIMILAR PUBLICATIONS:");
|
|
if(this.publicationInfo.similarPublications != undefined) {
|
|
this.publicationInfo.similarPublications.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
*/
|
|
console.info("TYPES: "+this.publicationInfo.types);
|
|
console.info("\nDOWNLOAD FROM:");
|
|
if(this.publicationInfo.downloadFrom != undefined) {
|
|
this.publicationInfo.downloadFrom.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
console.info("\nBIOENTITIES:");
|
|
if(this.publicationInfo.bioentities != undefined) {
|
|
this.publicationInfo.bioentities.forEach(function (value, key, map) {
|
|
value.forEach(function (value1, key1, map1) {
|
|
console.info(key + " = " + key1 + " = " + value1);
|
|
})
|
|
})
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
|
|
console.info("\nIDENTIFIERS:");
|
|
if(this.publicationInfo.identifiers != undefined) {
|
|
this.publicationInfo.identifiers.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
|
|
console.info("JOURNAL: "+this.publicationInfo.journal);
|
|
|
|
|
|
console.info("LANGUAGES: "+this.publicationInfo.languages);
|
|
|
|
|
|
console.info("SUBJECTS: "+this.publicationInfo.subjects);
|
|
console.info("\nCLASSIFIED OBJECTS:");
|
|
if(this.publicationInfo.classifiedSubjects != undefined) {
|
|
this.publicationInfo.classifiedSubjects.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
|
|
console.info("BEST LICENSE: "+this.publicationInfo.bestlicense);
|
|
|
|
console.info("\nCOLLECTED FROM:");
|
|
if(this.publicationInfo.collectedFrom != undefined) {
|
|
this.publicationInfo.collectedFrom.forEach(function (value, key, map) {
|
|
console.info(key + " = " + value);
|
|
});
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
console.info("\n");
|
|
|
|
console.info("\nREFERENCES:");
|
|
if(this.publicationInfo.references != undefined) {
|
|
for(let i in this.publicationInfo.references) {
|
|
for(let key in this.publicationInfo.references[i]) {
|
|
console.info(key+" : "+this.publicationInfo.references[i][key]);
|
|
}
|
|
}
|
|
} else {
|
|
console.info("undefined");
|
|
}
|
|
}
|
|
|
|
}
|