Adding components for landing pages of project + publication and the services
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43062 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
aaadb79301
commit
0a78e4e143
|
@ -0,0 +1,15 @@
|
|||
export class ProjectInfo {
|
||||
acronym: string;
|
||||
title: string;
|
||||
callIdentifier: string;
|
||||
funder: string;
|
||||
funding: string;
|
||||
contractNum: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
openAccessMandate: string;
|
||||
specialClause39: string;
|
||||
organizations: string[];
|
||||
url: string;
|
||||
urlInfo: string;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
export class PublicationInfo {
|
||||
title: string;
|
||||
authors: string[];
|
||||
date: string;
|
||||
types: string[];
|
||||
downloadFrom: Map<string, string[]>;
|
||||
bioentities: Map<string, Map<string, string>>;
|
||||
identifiers: Map<string, string>;
|
||||
publisher: string;
|
||||
journal: string;
|
||||
languages: string[];
|
||||
subjects: string[];
|
||||
classifiedSubjects: Map<string, string[]>;
|
||||
description: string;
|
||||
bestlicense: string;
|
||||
collectedFrom: Map<string, string>;
|
||||
fundedByProjects: Map<string, string[]>;
|
||||
relatedResearchData: Map<string, string[]>;//{ [key: string]: string }[];
|
||||
similarPublications: Map<string, string[]>;//{ [key: string]: string }[];
|
||||
references: { [key: string]: string }[];
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { RouteParams } from '@angular/router-deprecated';
|
||||
import {ProjectService} from '../../services/project.service';
|
||||
import {ProjectInfo} from '../../entities/projectInfo';
|
||||
|
||||
@Component({
|
||||
selector: 'project',
|
||||
template: `
|
||||
|
||||
<div *ngIf="projectInfo != null">
|
||||
<h2>{{projectInfo.acronym}}</h2>
|
||||
<p>
|
||||
<span>Title</span>
|
||||
<span>{{projectInfo.title}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Funding</span>
|
||||
<span>{{projectInfo.funding}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Call</span>
|
||||
<span>{{projectInfo.callIdentifier}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Contract (GA) number</span>
|
||||
<span>{{projectInfo.contractNum}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Start Date</span>
|
||||
<span>{{projectInfo.startDate}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>End Date</span>
|
||||
<span>{{projectInfo.endDate}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Open Access mandate</span>
|
||||
<span>{{projectInfo.openAccessMandate}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Special Clause 39</span>
|
||||
<span>{{projectInfo.specialClause39}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>Organizations</span>
|
||||
<span>{{projectInfo.organizations}}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>More information</span>
|
||||
<span><a target="_blank" href="{{projectInfo.url}}">{{projectInfo.urlInfo}}</a></span>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, ProjectService]
|
||||
})
|
||||
export class ProjectComponent {
|
||||
constructor (private _projectService: ProjectService,
|
||||
private _routeParams: RouteParams) {
|
||||
console.info('project constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
ngOnInit() {
|
||||
console.info('project init');
|
||||
this.getProjectInfo();
|
||||
}
|
||||
|
||||
results : String[];
|
||||
orcidresults : String[];
|
||||
resultsNum : number ;
|
||||
|
||||
projectInfo: ProjectInfo;
|
||||
params: RouteParams;
|
||||
|
||||
getProjectInfo () {
|
||||
console.info("inside getProjectInfo of component");
|
||||
|
||||
this._projectService.getProjectInfo(this.params.get('projectId')).subscribe(
|
||||
data => {
|
||||
this.projectInfo = data;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {JSONP_PROVIDERS} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {PublicationService} from '../../services/publication.service';
|
||||
import {PublicationInfo} from '../../entities/publicationInfo';
|
||||
|
||||
import { RouteParams} from '@angular/router-deprecated';
|
||||
|
||||
@Component({
|
||||
selector: 'publication',
|
||||
//directives: [...ROUTER_DIRECTIVES],
|
||||
template: `
|
||||
|
||||
<div *ngIf="publicationInfo != null">
|
||||
|
||||
<h2>{{publicationInfo.title}}</h2>
|
||||
|
||||
<p>
|
||||
{{publicationInfo.authors}} ({{publicationInfo.date}})
|
||||
</p>
|
||||
<div class="row" *ngIf="publicationInfo.publisher != undefined && publicationInfo.publisher != ''">
|
||||
<!--span>Publisher:</span>
|
||||
<span>{{publicationInfo.publisher}}</span-->
|
||||
<div class="col-md-1"> Publisher: </div>
|
||||
<span>{{publicationInfo.publisher}}</span>
|
||||
<!--div class="col-md-11"> {{publicationInfo.publisher}} </div-->
|
||||
</div>
|
||||
<div class="row" *ngIf="publicationInfo.journal != undefined && publicationInfo.journal != ''">
|
||||
<!--span>Journal:</span>
|
||||
<span>{{publicationInfo.journal}}</span-->
|
||||
<div class="col-md-1"> Journal: </div>
|
||||
<span>{{publicationInfo.journal}}</span>
|
||||
<!--div class="col-md-11"> {{publicationInfo.journal}} </div-->
|
||||
</div>
|
||||
<div class="row" *ngIf="publicationInfo.languages != undefined && publicationInfo.languages != 'Undetermined' && publicationInfo.languages != ''">
|
||||
<!--span>Languages:</span>
|
||||
<span>{{publicationInfo.languages}}</span-->
|
||||
<div class="col-md-1"> Languages: </div>
|
||||
<span>{{publicationInfo.languages}}</span>
|
||||
<!--div class="col-md-11"> {{publicationInfo.languages}} </div-->
|
||||
</div>
|
||||
<div class="row" *ngIf="publicationInfo.types != undefined">
|
||||
<div class="col-md-1"> Types: </div>
|
||||
<span>{{publicationInfo.types}}</span>
|
||||
</div>
|
||||
<div class="row" *ngIf="publicationInfo.subjects != undefined">
|
||||
<!--span>Subjects:</span>
|
||||
<span>{{publicationInfo.subjects}}</span-->
|
||||
<div class="col-md-1"> Subjects: </div>
|
||||
<span> {{publicationInfo.subjects}} </span>
|
||||
</div>
|
||||
<div class="row" *ngIf="publicationInfo.identifiers != undefined">
|
||||
<div class="col-md-1">Identifiers:</div>
|
||||
<span *ngFor="let key of publicationInfo.identifiers.keys()">
|
||||
{{key}}: {{publicationInfo.identifiers.get(key)}}
|
||||
</span>
|
||||
</div>
|
||||
<div >
|
||||
<!--div class="col-md-12"-->
|
||||
{{publicationInfo.description}}
|
||||
<!--/div-->
|
||||
</div>
|
||||
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#citationsTab">References</a></li>
|
||||
<li><a data-toggle="tab" href="#dataTab">Related Research Data</a></li>
|
||||
<li><a data-toggle="tab" href="#similarTab">Similar Publications</a></li>
|
||||
<li><a data-toggle="tab" href="#bioentitiesTab">Bioentities</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="citationsTab" class="tab-pane fade in active">
|
||||
<h3>REFERENCES</h3>
|
||||
|
||||
<div *ngFor="let item of publicationInfo.references">
|
||||
<p *ngIf="item['url'] != undefined">
|
||||
<a class="custom-external" href="{{item['url']}}" target="_blank">
|
||||
{{item['text']}}
|
||||
</a>
|
||||
</p>
|
||||
<p *ngIf="item['url'] == undefined">
|
||||
{{item['text']}}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="dataTab" class="tab-pane fade">
|
||||
<h3>dataTab</h3>
|
||||
|
||||
<!--div *ngFor="let key of publicationInfo.relatedResearchData.keys()">
|
||||
<span *ngIf="key != undefined">
|
||||
<a class="custom-external" href="{{key}}" target="_blank">
|
||||
{{publicationInfo.relatedResearchData.get(key)[0]}}
|
||||
</a>
|
||||
</span>
|
||||
<span>
|
||||
({{publicationInfo.relatedResearchData.get(key)[1]}})
|
||||
</span>
|
||||
<span class="badge">{{publicationInfo.relatedResearchData.get(key)[2]}}</span>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<table id="inferredTable" class="display inferredTable dataTable no-footer" role="grid">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="sorting" tabindex="0" aria-controls="inferredTable" rowspan="1" colspan="1" aria-label="Title: activate to sort column ascending">Title</th>
|
||||
<th class="sorting_desc" tabindex="0" aria-controls="inferredTable" rowspan="1" colspan="1" style="width: 93px;" aria-sort="descending" aria-label="Trust: activate to sort column ascending">Trust</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let key of publicationInfo.relatedResearchData.keys()" role="row">
|
||||
<td *ngIf="key != undefined">
|
||||
<a class="custom-external" href="{{key}}" target="_blank">
|
||||
{{publicationInfo.relatedResearchData.get(key)[0]}}
|
||||
</a>
|
||||
({{publicationInfo.relatedResearchData.get(key)[1]}})
|
||||
</td>
|
||||
<!--td class="badge">{{publicationInfo.relatedResearchData.get(key)[2]}}</td-->
|
||||
<td class="progress">
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="29" aria-valuemin="0" aria-valuemax="100" [style.width] = "publicationInfo.relatedResearchData.get(key)[2]">
|
||||
{{publicationInfo.relatedResearchData.get(key)[2]}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="similarTab" class="tab-pane fade">
|
||||
<h3>similarTab</h3>
|
||||
<p>Some content in similarTab.</p>
|
||||
</div>
|
||||
<div id="bioentitiesTab" class="tab-pane fade">
|
||||
<p> YO men </p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--p>
|
||||
<span>Identifiers:</span>
|
||||
<span *ngFor="let key of publicationInfo.identifiers.keys()">
|
||||
{{key}}:
|
||||
<span *ngFor="let value of publicationInfo.identifiers.values()">{{value}}</span>
|
||||
,
|
||||
</span>
|
||||
</p-->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
`,
|
||||
providers:[JSONP_PROVIDERS, PublicationService]
|
||||
})
|
||||
export class PublicationComponent {
|
||||
constructor (private _publicationService: PublicationService, private _routeParams: RouteParams) {
|
||||
console.info('publication constructor');
|
||||
this.params = _routeParams;
|
||||
}
|
||||
ngOnInit() {
|
||||
console.info('publication init');
|
||||
this.getPublicationInfo();
|
||||
}
|
||||
|
||||
results : String[];
|
||||
orcidresults : String[];
|
||||
resultsNum : number ;
|
||||
|
||||
publicationInfo: PublicationInfo;
|
||||
params: RouteParams;
|
||||
|
||||
getPublicationInfo() {
|
||||
console.info("inside getPublicationInfo of component");
|
||||
|
||||
this._publicationService.getPublicationInfo(this.params.get("articleId")).subscribe(
|
||||
data => {
|
||||
this.publicationInfo = data;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {ProjectInfo} from '../entities/projectInfo';
|
||||
|
||||
@Injectable()
|
||||
export class ProjectService {
|
||||
|
||||
constructor(private http: Http) {}
|
||||
|
||||
projectInfo: ProjectInfo;
|
||||
|
||||
getProjectInfo (id: string):any {
|
||||
console.info("getProjectInfo in service");
|
||||
|
||||
//let url = 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
let url = 'http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/projects/'+id;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => [res['result']['metadata']['oaf:entity']['oaf:project'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:project']['fundingtree'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']])
|
||||
.map(res => this.parseProjectInfo(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');
|
||||
}
|
||||
|
||||
parseProjectInfo (data: any):any {
|
||||
this.projectInfo = new ProjectInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
this.projectInfo.acronym = data[0].acronym;
|
||||
this.projectInfo.title = data[0].title;
|
||||
this.projectInfo.callIdentifier = data[0].callidentifier;
|
||||
this.projectInfo.contractNum = data[0].code;
|
||||
this.projectInfo.startDate = data[0].startdate;
|
||||
this.projectInfo.endDate = data[0].enddate;
|
||||
this.projectInfo.openAccessMandate = data[0].oamandatepublications;
|
||||
this.projectInfo.specialClause39 = data[0].ecsc39;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
if(data[1]['funder'] != null) {
|
||||
this.projectInfo.funder = data[1]['funder'].shortname;
|
||||
}
|
||||
|
||||
let funding;
|
||||
this.projectInfo.funding = "";
|
||||
|
||||
if(data[1]['funding_level_2'] != null) {
|
||||
funding = data[1]['funding_level_2'].id;
|
||||
} else if(data[1]['funding_level_1'] != null) {
|
||||
funding = data[1]['funding_level_1'].id;
|
||||
} else if(data[1]['funding_level_0'] != null) {
|
||||
funding = data[1]['funding_level_0'].id;
|
||||
}
|
||||
|
||||
if(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
for(let i=1; i<funding.length; i++) {
|
||||
if(this.projectInfo.funding != "") {
|
||||
this.projectInfo.funding += " | ";
|
||||
}
|
||||
this.projectInfo.funding += funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
this.projectInfo.organizations = new Array<string>();
|
||||
|
||||
if(data[2].hasOwnProperty("legalshortname")) {
|
||||
this.projectInfo.organizations[0] = data[2].legalshortname;
|
||||
} else if(data[2].hasOwnProperty("legalname")) {
|
||||
this.projectInfo.organizations[0] = data[2].legalname;
|
||||
} else {
|
||||
for(let i=0; i<data[2].length; i++) {
|
||||
if(data[2][i].hasOwnProperty("legalshortname")) {
|
||||
this.projectInfo.organizations[i] = data[2][i].legalshortname;
|
||||
} else if(data[2][i].hasOwnProperty("legalname")) {
|
||||
this.projectInfo.organizations[i] = data[2][i].legalname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.projectInfo.funder == "EC") {
|
||||
this.projectInfo.url = "http://cordis.europa.eu/projects/"+this.projectInfo.contractNum;
|
||||
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
|
||||
}
|
||||
|
||||
return this.projectInfo;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,449 @@
|
|||
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;
|
||||
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']['oaf:result']['children']['instance']))
|
||||
.map(res => [res['result']['metadata']['oaf:entity']['oaf:result'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['title'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['children'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['pid'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['journal'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['language'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['subject'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['bestlicense'],
|
||||
res['result']['metadata']['oaf:entity']['oaf:result']['collectedfrom'],
|
||||
res['result']['metadata']['oaf:entity']['extraInfo']['citations']['citation']
|
||||
])
|
||||
.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;
|
||||
this.publicationInfo.description = data[0].description;
|
||||
}
|
||||
|
||||
if(data[1] != null) {
|
||||
this.publicationInfo.title = data[1].content;
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let mydata;
|
||||
let funding;
|
||||
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<string>();
|
||||
}
|
||||
this.publicationInfo.authors[mydata.ranking-1] = mydata.fullname;
|
||||
} else if(mydata['to'].class == "isProducedBy") {
|
||||
if(this.publicationInfo.fundedByProjects == undefined) {
|
||||
this.publicationInfo.fundedByProjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
this.publicationInfo.fundedByProjects.set(mydata.code, new Array<string>());
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[0] = mydata.acronym;
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[1] = mydata.title;
|
||||
if(mydata.hasOwnProperty("funding")) {
|
||||
if(mydata['funding'].hasOwnProperty("funder")) {
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[2] = mydata['funding']['funder'].shortname;
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[3] = mydata['funding']['funder'].name;
|
||||
}
|
||||
if(mydata['funding'].hasOwnProperty("funding_level_2")) {
|
||||
funding = mydata['funding']['funding_level_2'].content;
|
||||
//this.publicationInfo.fundedByProjects.get(mydata.code)[4] = mydata['funding']['funding_level_2'].content;
|
||||
} else if(mydata['funding'].hasOwnProperty("funding_level_1")) {
|
||||
funding = mydata['funding']['funding_level_1'].content;
|
||||
//this.publicationInfo.fundedByProjects.get(mydata.code)[4] = mydata['funding']['funding_level_1'].content;
|
||||
} else if(mydata['funding'].hasOwnProperty("funding_level_0")) {
|
||||
funding = mydata['funding']['funding_level_0'].content;
|
||||
//this.publicationInfo.fundedByProjects.get(mydata.code)[4] = mydata['funding']['funding_level_0'].content;
|
||||
}
|
||||
|
||||
if(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[4] = funding[1];
|
||||
|
||||
for(let i=2; i<funding.length; i++) {
|
||||
this.publicationInfo.fundedByProjects.get(mydata.code)[4] += " | " + funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(mydata['to'].class == "isRelatedTo") {
|
||||
if(this.publicationInfo.relatedResearchData == undefined) {
|
||||
this.publicationInfo.relatedResearchData = new Map<string, string[]>();//Array<{}>();
|
||||
}
|
||||
/*
|
||||
this.publicationInfo.relatedResearchData[counter] = {};
|
||||
this.publicationInfo.relatedResearchData[counter]['title'] = mydata['title'].content;
|
||||
this.publicationInfo.relatedResearchData[counter]['year'] = mydata.dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.relatedResearchData[counter]['trust'] = Math.round(mydata.trust*100)+"%";
|
||||
let link = "https://beta.openaire.eu/search/publication?articleId=";
|
||||
this.publicationInfo.relatedResearchData[counter]['link'] = link+mydata['to'].content;
|
||||
|
||||
counter++;
|
||||
*/
|
||||
|
||||
let url = "https://beta.openaire.eu/search/publication?articleId="+mydata['to'].content;
|
||||
this.publicationInfo.relatedResearchData.set(url, new Array<string>());
|
||||
this.publicationInfo.relatedResearchData.get(url)[0] = mydata['title'].content;
|
||||
this.publicationInfo.relatedResearchData.get(url)[1] = mydata.dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.relatedResearchData.get(url)[2] = Math.round(mydata.trust*100)+"%";
|
||||
|
||||
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
if(this.publicationInfo.similarPublications == undefined) {
|
||||
this.publicationInfo.similarPublications = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
let url = "https://beta.openaire.eu/search/publication?articleId="+mydata['to'].content;
|
||||
this.publicationInfo.similarPublications.set(url, new Array<string>());
|
||||
this.publicationInfo.similarPublications.get(url)[0] = mydata['title'].content;
|
||||
this.publicationInfo.similarPublications.get(url)[1] = mydata.dateofacceptance.substring(0,4);
|
||||
this.publicationInfo.similarPublications.get(url)[2] = Math.round(mydata.trust*100)+"%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for(let i in this.publicationInfo.relatedResearchData) {
|
||||
// for(let key in this.publicationInfo.relatedResearchData[i]) {
|
||||
// console.info(key+" : "+this.publicationInfo.relatedResearchData[i][key]);
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, 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 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(!this.publicationInfo.downloadFrom.has(mydata.id)) {
|
||||
this.publicationInfo.downloadFrom.set(mydata.id, new Array<string>());
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("licence")) {
|
||||
this.publicationInfo.downloadFrom.get(mydata.id)[0] = mydata['licence'].classid;
|
||||
}
|
||||
if(mydata.hasOwnProperty("hostedby")) {
|
||||
this.publicationInfo.downloadFrom.get(mydata.id)[1] = mydata['hostedby'].name;
|
||||
}
|
||||
if(mydata.hasOwnProperty("webresource")) {
|
||||
this.publicationInfo.downloadFrom.get(mydata.id)[2] = mydata['webresource'].url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
this.publicationInfo.identifiers = new Map<string, string>();
|
||||
|
||||
if(data[4].hasOwnProperty("classname")) {
|
||||
this.publicationInfo.identifiers.set(data[4].classname, data[4].content);
|
||||
} else {
|
||||
for(let i=0; i<data[4].length; i++) {
|
||||
this.publicationInfo.identifiers.set(data[4][i].classname, data[4][i].content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
this.publicationInfo.journal = data[5].content;
|
||||
//console.info(this.publicationInfo.journal);
|
||||
}
|
||||
|
||||
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.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 Map<string, 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.set(mydata.name, link+mydata.id);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.publicationInfo.journal != null
|
||||
&& this.publicationInfo.identifiers != null
|
||||
&& this.publicationInfo.identifiers.has("doi")) {
|
||||
|
||||
if( this.publicationInfo.downloadFrom == null) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
let doi = this.publicationInfo.identifiers.get("doi");
|
||||
if(!this.publicationInfo.downloadFrom.has(doi)) {
|
||||
this.publicationInfo.downloadFrom.set(doi, new Array<string>());
|
||||
}
|
||||
|
||||
this.publicationInfo.downloadFrom.get(doi)[0] = "";
|
||||
this.publicationInfo.downloadFrom.get(doi)[1] = this.publicationInfo.publisher+"/ "+this.publicationInfo.journal;
|
||||
this.publicationInfo.downloadFrom.get(doi)[2] = "http://dx.doi.org/"+doi;
|
||||
}
|
||||
|
||||
if(data[10] != null) {
|
||||
this.publicationInfo.references = /*{};*/new Array<{[key: string]: 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] = {};
|
||||
this.publicationInfo.references[mydata.position-1]['text'] = mydata.rawText;
|
||||
this.publicationInfo.references[mydata.position-1]['url'] = url;
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
/*for(let i in this.publicationInfo.relatedResearchData) {
|
||||
for(let key in this.publicationInfo.relatedResearchData[i]) {
|
||||
console.info(key+" : "+this.publicationInfo.relatedResearchData[i][key]);
|
||||
}
|
||||
}*/
|
||||
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("\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("\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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue