Updating landing page of publication : parse context field (shown as related to) | linkify authors | linkify identifiers | change downloadFrom type | show additional classifications in subjects | add badges in tabs | view all in References tab

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@43244 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2016-07-15 13:17:14 +00:00
parent e12d5d0c14
commit a4a54ccdb8
3 changed files with 304 additions and 76 deletions

View File

@ -1,6 +1,6 @@
export class PublicationInfo {
title: string;
authors: string[];
authors: { [key: string]: string }[];
date: string;
types: string[];
downloadFrom: Map<string, string[]>;
@ -18,4 +18,5 @@ export class PublicationInfo {
relatedResearchData: Map<string, string[]>;//{ [key: string]: string }[];
similarPublications: Map<string, string[]>;//{ [key: string]: string }[];
references: { [key: string]: string }[];
contexts: { [key: string]: string }[];
}

View File

@ -6,9 +6,10 @@ import {PublicationInfo} from '../../entities/publicationInfo';
import { RouteParams} from '@angular/router-deprecated';
import { InlineClaimContextComponent} from '../../claimPages/inlineClaimContext/inlineClaimContext.component';
import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/inlineClaimProject.component';
//import {NgSwitch, ngSwitchCase, NgSwitchDefault} from '@angular/common';
@Component({
selector: 'publication',
//directives: [...ROUTER_DIRECTIVES],
template: `
<div >
@ -23,9 +24,36 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
<div class="row row-offcanvas row-offcanvas-right" >
<div class="col-xs-6 col-sm-9 sidebar-offcanvas" *ngIf="publicationInfo != null">
<p>
{{publicationInfo.authors}} ({{publicationInfo.date}})
</p>
<div>
<div *ngIf="publicationInfo.authors != undefined">
<div *ngIf="showAllAuthors">
<a class="text-muted" (click)="showAllAuthors = !showAllAuthors;">View less authors</a>
</div>
<span *ngFor="let item of publicationInfo.authors.slice(0,30)">
<a class="custom-external" href="{{item['url']}}" target="_blank">
{{item['name']}};
</a>
</span>
<span *ngIf="!showAllAuthors && publicationInfo.authors.length > 30"> ... </span>
<span *ngIf="showAllAuthors">
<span *ngFor="let item of publicationInfo.authors.slice(30)">
<a class="custom-external" href="{{item['url']}}" target="_blank">
{{item['name']}};
</a>
</span>
</span>
<span *ngIf="!showAllAuthors && publicationInfo.authors.length > 30">
<a class="text-muted" (click)="showAllAuthors = !showAllAuthors;">
view all {{publicationInfo.authors.length}} authors
</a>
</span>
<span *ngIf="showAllAuthors">
<a class="text-muted" (click)="showAllAuthors = !showAllAuthors;">View less authors</a>
</span>
</div>
<span *ngIf="publicationInfo.date != ''">({{publicationInfo.date}})</span>
</div>
<dl class="dl-horizontal">
<dt *ngIf="publicationInfo.publisher != undefined && publicationInfo.publisher != ''">Publisher: </dt>
@ -34,41 +62,141 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
<dd *ngIf="publicationInfo.journal != undefined && publicationInfo.journal != ''">{{publicationInfo.journal}}</dd>
<dt *ngIf="publicationInfo.languages != undefined && publicationInfo.languages != 'Undetermined' && publicationInfo.languages != ''"> Languages: </dt>
<dd *ngIf="publicationInfo.languages != undefined && publicationInfo.languages != 'Undetermined' && publicationInfo.languages != ''">{{publicationInfo.languages}}</dd>
<dt *ngIf="publicationInfo.types != undefined"> Types: </dt>
<dd *ngIf="publicationInfo.types != undefined">{{publicationInfo.types}}</dd>
<dt *ngIf="publicationInfo.types != undefined && publicationInfo.types.length > 0"> Types: </dt>
<dd *ngIf="publicationInfo.types != undefined && publicationInfo.types.length > 0">{{publicationInfo.types}}</dd>
<div *ngIf="publicationInfo.identifiers != undefined && publicationInfo.identifiers.size > 0">
<dt>Identifiers:</dt>
<dd>
<ul class="list-inline">
<li *ngFor="let key of publicationInfo.identifiers.keys()">
<!--a *ngIf="key == 'doi'" class="custom-external" href="http://dx.doi.org/{{key}}" target="_blank">
{{key}}: {{publicationInfo.identifiers.get(key)}}
</a>
<a *ngIf="key == 'pmc'" class="custom-external" href="http://europepmc.org/articles/{{key}}" target="_blank">
{{key}}: {{publicationInfo.identifiers.get(key)}}
</a>
<a *ngIf="key != 'pmc' && key != 'doi'" class="custom-external" href="http://europepmc.org/articles/{{key}}" target="_blank">
{{key}}: {{publicationInfo.identifiers.get(key)}}
</a-->
<div [ngSwitch]="key">
<template [ngSwitchWhen]="'doi'">
<a class="custom-external" href="http://dx.doi.org/{{publicationInfo.identifiers.get(key)}}" target="_blank">
{{key}}: {{publicationInfo.identifiers.get(key)}}
</a>
</template>
<template [ngSwitchWhen]="'pmc'">
<a class="custom-external" href="http://europepmc.org/articles/{{publicationInfo.identifiers.get(key)}}" target="_blank">
{{key}}: {{publicationInfo.identifiers.get(key)}}
</a>
</template>
<template ngSwitchDefault>{{key}}: {{publicationInfo.identifiers.get(key)}}</template>
</div>
</li>
</ul>
</dd>
</div>
<div *ngIf="publicationInfo.subjects != undefined">
<dt *ngIf="publicationInfo.subjects.length > 0 || publicationInfo.classifiedSubjects.size > 0">
Subjects:
</dt>
<dd>
<div *ngIf="publicationInfo.subjects.length > 0"> {{publicationInfo.subjects}} </div>
<div *ngIf="publicationInfo.subjects.length == 0 && publicationInfo.classifiedSubjects.size > 0"> - </div>
</dd>
<dd class="col-md-offset-1" *ngIf="publicationInfo.classifiedSubjects.size > 0">
<a (click)="showClassifiedSbj = !showClassifiedSbj;">
<div *ngIf="!showClassifiedSbj">
Show additional classifications
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</div>
<div *ngIf="showClassifiedSbj">
Hide additional classifications
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
</div>
</a>
<div class="well" *ngIf="showClassifiedSbj">
<div *ngFor="let key of publicationInfo.classifiedSubjects.keys()">
Classified by OpenAIRE into
<div>
{{key}}: {{publicationInfo.classifiedSubjects.get(key)}}
</div>
</div>
</div>
</dd>
</div>
<dt *ngIf="publicationInfo.subjects != undefined"> Subjects: </dt>
<dd *ngIf="publicationInfo.subjects != undefined"> {{publicationInfo.subjects}} </dd>
<dt *ngIf="publicationInfo.identifiers != undefined">Identifiers:</dt>
<dd>
<ul class="list-inline">
<li *ngFor="let key of publicationInfo.identifiers.keys()">
{{key}}: {{publicationInfo.identifiers.get(key)}} </li>
</ul>
</dd>
</dl>
<blockquote>
{{publicationInfo.description}}
</blockquote>
<blockquote *ngIf="publicationInfo.description != ''">
{{publicationInfo.description}}
</blockquote>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#citationsTab">References</a></li>
<li role="presentation"><a data-toggle="tab" href="#dataTab">Related Research Data</a></li>
<li role="presentation"><a data-toggle="tab" href="#similarTab">Similar Publications</a></li>
<li role="presentation" *ngIf="publicationInfo.bioentities != undefined"><a data-toggle="tab" href="#bioentitiesTab">Bioentities</a></li>
<li class="active">
<a data-toggle="tab" href="#citationsTab">
References
<span *ngIf="publicationInfo.references == undefined" class="badge">0</span>
<span *ngIf="publicationInfo.references != undefined" class="badge">
{{publicationInfo.references.length}}
</span>
<!--span [ngSwitch]="publicationInfo.references || undefined" class="badge">
<template [ngSwitchWhen]="undefined">0</template>
<template ngSwitchDefault>{{publicationInfo.references.length}}</template>
</span-->
</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#dataTab">
Related Research Data
<span *ngIf="publicationInfo.relatedResearchData == undefined" class="badge">0</span>
<span *ngIf="publicationInfo.relatedResearchData != undefined" class="badge">{{publicationInfo.relatedResearchData.size}}</span>
</a>
</li>
<li role="presentation">
<a data-toggle="tab" href="#similarTab">
Similar Publications
<span *ngIf="publicationInfo.similarPublications == undefined" class="badge">0</span>
<span *ngIf="publicationInfo.similarPublications != undefined" class="badge">{{publicationInfo.similarPublications.size}}</span>
</a>
</li>
<li role="presentation" *ngIf="publicationInfo.bioentities != undefined">
<a data-toggle="tab" href="#bioentitiesTab">
Bioentities
<span class="badge">{{bioentitiesNum}}</span>
</a>
</li>
</ul>
<div class="tab-content">
<div id="citationsTab" class="tab-pane fade in active panel-body">
<div *ngIf="publicationInfo.references == undefined" class = "alert alert-info " >
There are no references
</div>
<div *ngIf="publicationInfo.references != undefined" >
<div *ngFor="let item of publicationInfo.references">
<p *ngIf=" item != undefined &&item['url'] != undefined">
<div *ngIf="publicationInfo.references != undefined">
<div class="panel panel-default" *ngIf="!showAllReferences && publicationInfo.references.length > 10">
<div class="panel-heading">
<a (click)="showAllReferences = true;">
<div class="text-right">view all {{publicationInfo.references.length}}</div>
</a>
</div>
</div>
<div *ngIf="!showAllReferences">
<div *ngFor="let item of publicationInfo.references.slice(0,10)">
<p *ngIf=" item != undefined && item['url'] != undefined">
<a class="custom-external" href="{{item['url']}}" target="_blank">
{{item['text']}}
</a>
@ -77,9 +205,31 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
{{item['text']}}
</p>
</div>
</div>
</div>
<div *ngIf="showAllReferences">
<div *ngFor="let item of publicationInfo.references.slice(10)">
<p *ngIf=" item != undefined && 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 class="panel panel-default" *ngIf="!showAllReferences && publicationInfo.references.length > 10">
<div class="text-right" class="panel-heading">
<a (click)="showAllReferences = true;">
<div class="text-right" >view all {{publicationInfo.references.length}}</div>
</a>
</div>
</div>
</div>
</div>
<div id="dataTab" class="tab-pane fade panel-body">
<div *ngIf="publicationInfo.relatedResearchData == undefined" class = "alert alert-info " >
There are no related research data
@ -94,10 +244,12 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
<tbody>
<tr *ngFor="let key of publicationInfo.relatedResearchData.keys()">
<td *ngIf="key != undefined">
<a class="custom-external" href="{{key}}" target="_blank">
{{publicationInfo.relatedResearchData.get(key)[0]}}
</a>
({{publicationInfo.relatedResearchData.get(key)[1]}})
<a class="custom-external" href="{{key}}" target="_blank">
{{publicationInfo.relatedResearchData.get(key)[0]}}
</a>
<span *ngIf="publicationInfo.relatedResearchData.get(key)[1] != ''">
({{publicationInfo.relatedResearchData.get(key)[1]}})
</span>
</td>
<td>
<div class="progress">
@ -127,10 +279,12 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
<tbody >
<tr *ngFor="let key of publicationInfo.similarPublications.keys()">
<td *ngIf="key != undefined">
<a class="custom-external" href="{{key}}" target="_blank">
{{publicationInfo.similarPublications.get(key)[0]}}
</a>
({{publicationInfo.similarPublications.get(key)[1]}})
<a class="custom-external" href="{{key}}" target="_blank">
{{publicationInfo.similarPublications.get(key)[0]}}
</a>
<span *ngIf="publicationInfo.similarPublications.get(key)[1] != ''">
({{publicationInfo.similarPublications.get(key)[1]}})
</span>
</td>
<td>
<div class="progress">
@ -189,11 +343,11 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
</dl>
</li>
<li class="list-group-item">
<dl class="functionsSection" *ngIf="publicationInfo.collectedFrom != undefined">
<dl class="functionsSection" *ngIf="publicationInfo.downloadFrom != undefined && publicationInfo.downloadFrom.size > 0">
<dt class="title">Download from</dt>
<dd class="line" *ngFor="let key of publicationInfo.collectedFrom.keys()">
<a href="{{publicationInfo.collectedFrom.get(key)}}">
{{key}}
<dd class="line" *ngFor="let key of publicationInfo.downloadFrom.keys()">
<a href="{{key}}">
{{publicationInfo.downloadFrom.get(key)[1]}}
</a>
</dd>
</dl>
@ -223,8 +377,10 @@ import { InlineClaimProjectComponent} from '../../claimPages/inlineClaimProject/
<li class="list-group-item">
<dl class="functionsSection" *ngIf="publicationInfo.contexts != undefined">
<dt class="title">Related to </dt>
<dd class="line" >
<!-- TODO add contexts here -->
<dd class="line" *ngFor="let item of publicationInfo.contexts">
<span>{{item['labelContext']}}</span>
<span *ngIf="item['labelCategory'] != null">-> {{item['labelCategory']}}</span>
<span *ngIf="item['labelConcept'] != null">: {{item['labelConcept']}}</span>
</dd>
</dl>
<dl class="functionsSection" *ngIf="publicationInfo.contexts == undefined">
@ -259,9 +415,17 @@ export class PublicationComponent {
this.getPublicationInfo();
}
private publicationInfo: PublicationInfo;
private params: RouteParams;
publicationInfo: PublicationInfo;
params: RouteParams;
private showAllAuthors: boolean = false;
private showStyle: boolean = false;
private showAllReferences: boolean = false;
private showAllRelResData: boolean = false;
private showAllSimilPubl: boolean = false;
private showAllBioentities: boolean = false;
private bioentitiesNum: number = 0;
private result ;
private claimInline:string = "none" ;
@ -283,7 +447,16 @@ console.info("do request");
this._publicationService.getPublicationInfo(this.params.get("articleId")).subscribe(
data => {
this.publicationInfo = data;
this.result = []
let bioentitiesNum = 0;
if(this.publicationInfo.bioentities != undefined) {
this.publicationInfo.bioentities.forEach(function (value, key, map) {
bioentitiesNum += value.size;
});
}
this.bioentitiesNum = bioentitiesNum;
this.result = []
let result_ ={id: this.params.get("articleId"), type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
this.result.push(result_);
},
@ -328,7 +501,7 @@ console.info("do request");
var contexts =$event.value;
if(contexts){
for(var i=0; i < contexts.length; i++){
}
}
}

View File

@ -30,7 +30,8 @@ export class PublicationService {
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']!= undefined && res['result']['metadata']['oaf:entity']['extraInfo']['citations']!= undefined)? res['result']['metadata']['oaf:entity']['extraInfo']['citations']['citation']:null
(res['result']['metadata']['oaf:entity']['extraInfo']!= undefined && res['result']['metadata']['oaf:entity']['extraInfo']['citations']!= undefined)? res['result']['metadata']['oaf:entity']['extraInfo']['citations']['citation']:null,
res['result']['metadata']['oaf:entity']['oaf:result']['context']
])
.map(res => this.parsePublicationInfo(res));
@ -67,9 +68,12 @@ export class PublicationService {
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class == "hasAuthor") {
if(this.publicationInfo.authors == undefined) {
this.publicationInfo.authors = new Array<string>();
this.publicationInfo.authors = new Array<{[key: string]: string}>();
}
this.publicationInfo.authors[mydata.ranking-1] = mydata.fullname;
this.publicationInfo.authors[mydata.ranking-1] = {};
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 Map<string, string[]>();
@ -106,7 +110,7 @@ export class PublicationService {
}
}
}
} else if(mydata['to'].class == "isRelatedTo") {
} else if(mydata['to'].class == "iscontexts") {
if(this.publicationInfo.relatedResearchData == undefined) {
this.publicationInfo.relatedResearchData = new Map<string, string[]>();//Array<{}>();
}
@ -130,6 +134,10 @@ export class PublicationService {
}
}
}
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
return (item != undefined);
});
}
if(data[3] != null) {
@ -152,18 +160,25 @@ export class PublicationService {
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;
let url;
if(mydata['webresource'].length == undefined) {
url = mydata['webresource'].url;
} else{
url = mydata['webresource'][0].url;
}
if(!this.publicationInfo.downloadFrom.has(url)) {
this.publicationInfo.downloadFrom.set(url, new Array<string>());
}
if(mydata.hasOwnProperty("licence")) {
this.publicationInfo.downloadFrom.get(url)[0] = mydata['licence'].classid;
}
if(mydata.hasOwnProperty("hostedby")) {
this.publicationInfo.downloadFrom.get(url)[1] = mydata['hostedby'].name;
}
}
}
}
@ -188,7 +203,7 @@ export class PublicationService {
if(data[4] != null) {
this.publicationInfo.identifiers = new Map<string, string>();
if(data[4].hasOwnProperty("classname")) {
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
this.publicationInfo.identifiers.set(data[4].classname, data[4].content);
} else {
for(let i=0; i<data[4].length; i++) {
@ -223,18 +238,19 @@ export class PublicationService {
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>());
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;
}
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;
}
}
}
@ -262,14 +278,13 @@ export class PublicationService {
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>());
let url = "http://dx.doi.org/"+this.publicationInfo.identifiers.get("doi");
if(!this.publicationInfo.downloadFrom.has(url)) {
this.publicationInfo.downloadFrom.set(url, 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;
this.publicationInfo.downloadFrom.get(url)[0] = "";
this.publicationInfo.downloadFrom.get(url)[1] = this.publicationInfo.publisher+"/ "+this.publicationInfo.journal;
}
if(data[10] != null) {
@ -299,6 +314,45 @@ export class PublicationService {
}
}
if(data[11] != null) {
this.publicationInfo.contexts = new Array<{ [key: string]: 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("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] = {};
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] = {};
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] = {};
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
this.publicationInfo.contexts[position]['labelCategory'] = null;
this.publicationInfo.contexts[position]['labelConcept'] = null;
}
}
}
//this.printPublicationInfo();
return this.publicationInfo;