Claim Search: add parse method(optionally) in all search services for claim search(orcid, datacite, crossref), use common response as an array of ClaimResult | use common component to show those results | transform openaire results to ClaimResult class | enhance Orcid result with DOI with info got from crossref
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51910 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8167f5411c
commit
a1c223bd78
|
@ -13,3 +13,4 @@ export class Claim {
|
||||||
export class Project{
|
export class Project{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,69 +13,10 @@ export class ClaimResult{
|
||||||
public publisher: string;
|
public publisher: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public resourceType:string;
|
public resourceType:string;
|
||||||
|
DOI: string;
|
||||||
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
editors=[];
|
||||||
|
journal: string;
|
||||||
var result: ClaimResult = new ClaimResult();
|
|
||||||
result.id = itemId;
|
|
||||||
result.type = itemType;
|
|
||||||
result.source = itemSource;
|
|
||||||
|
|
||||||
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
|
|
||||||
result.url = itemUrl;
|
|
||||||
result.accessRights = 'OPEN';
|
|
||||||
result.date = date;
|
|
||||||
result.result = item;
|
|
||||||
if(item.publisher){
|
|
||||||
result.publisher = item.publisher;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(itemSource == 'datacite'){
|
|
||||||
|
|
||||||
result.publisher = item.attributes['container-title'];
|
|
||||||
if(item.attributes.author){
|
|
||||||
result.authors =[]
|
|
||||||
for(var i=0; i< item.attributes.author.length; i++){
|
|
||||||
result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
|
|
||||||
}else if (itemSource == 'openaire'){
|
|
||||||
//TODO put right access rights
|
|
||||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date};
|
|
||||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
|
|
||||||
result.embargoEndDate = accessmode;
|
|
||||||
|
|
||||||
}else if(itemSource == 'crossref'){
|
|
||||||
date = (date == null) ? null : date.substring(0,10);
|
|
||||||
result.date = date;
|
|
||||||
result.resourceType = item.type;
|
|
||||||
result.description = item.abstract;
|
|
||||||
if(item.author){
|
|
||||||
result.authors =[]
|
|
||||||
for(var i=0; i< item.author.length; i++){
|
|
||||||
result.authors.push(item.author[i].family +" "+ item.author[i].given );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
|
||||||
}else if (itemSource == 'orcid'){
|
|
||||||
date = (date == null) ? null : date + "-01.-01"
|
|
||||||
result.date = date;
|
|
||||||
if(item['work-type']){
|
|
||||||
result.resourceType = item.type;
|
|
||||||
|
|
||||||
}
|
|
||||||
if(item.contributors){
|
|
||||||
result.authors =[]
|
|
||||||
for(var i=0; i< item.contributors.length; i++){
|
|
||||||
result.authors.push(item.contributors[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export class ClaimProject{
|
export class ClaimProject{
|
||||||
public funderId: string;
|
public funderId: string;
|
||||||
|
|
|
@ -39,18 +39,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-divider">
|
|
||||||
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''">
|
<claim-results [(results)]=crossrefResults [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<div >
|
|
||||||
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" > <span class="custom-external"></span> {{item.title}}</a>
|
|
||||||
<span *ngIf="!item.URL" >{{item.title}}</span>
|
|
||||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.DOI)" (click)="add(item, item.DOI, 'crossref', 'publication', item.URL, item.title, item.created['date-time'],'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
</div>
|
|
||||||
<span *ngIf="item.publisher" class="uk-article-meta">Publisher: {{item.publisher}}</span><span class="uk-article-meta" *ngIf="(item['published-print'] && item['published-print']['date-parts'] && item['published-print']['date-parts'][0])">({{(item['published-print']['date-parts'][0][0])?item['published-print']['date-parts'][0][0]:item['published-print']['date-parts'][0]}})</span>
|
|
||||||
<div *ngIf="item.author && item.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of item.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.author.slice(0,10).length-1))?"; ":""}}{{(i == item.author.slice(0,10).length-1 && item.author.length > 10)?"...":""}}</span></div>
|
|
||||||
<div *ngIf="item.editor && item.editor.length > 0" class="uk-article-meta">Editors: <span *ngFor="let author of item.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (item.editor.slice(0,10).length-1))?"; ":""}}{{(i == item.editor.slice(0,10).length-1 && item.editor.length > 10)?"...":""}}</span></div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,19 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="openairePubs.length > 0 " class="uk-list uk-list-divider">
|
<claim-results [(results)]=openairePubs [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<li *ngFor=" let result of openairePubs " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
|
||||||
<div >
|
|
||||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
|
||||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
|
||||||
<a *ngIf="!isSelected(result.id)" (click)="add(result, result.id, 'openaire', 'publication', result['title'].url, result['title'].name, result.year,result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
</div>
|
|
||||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span class="uk-article-meta" *ngIf="(result.year)">({{result.year}})</span>
|
|
||||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -103,34 +81,20 @@
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">
|
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix">
|
||||||
<div class="uk-float-right">
|
<div class="uk-float-right">
|
||||||
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
|
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list uk-list-divider">
|
<claim-results *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " [(results)]=orcidResultsToShow [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['work-summary'][0]['put-code']))?'uk-block-muted':''">
|
|
||||||
<div>
|
|
||||||
<span *ngIf="!item.URL" >{{item['work-summary'][0]['title']['title'].value}}</span>
|
|
||||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(authorId+'-'+item['work-summary'][0]['put-code'])" (click)="add(item,authorId+'-'+item['work-summary'][0]['put-code'],'orcid', 'publication', null, item['work-summary'][0]['title']['title'].value, item['work-summary'][0]['publication-date']?item['work-summary'][0]['publication-date'].year.value :null,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
</div>
|
|
||||||
<span *ngIf="item['work-summary'][0]['journal-title'] && item['work-summary'][0]['journal-title'].value " class="uk-article-meta">Journal: {{item['work-summary'][0]['journal-title'].value}}</span><span class="uk-article-meta" *ngIf="(item['work-summary'][0]['publication-date']&&item['work-summary'][0]['publication-date'].year&&item['work-summary'][0]['publication-date'].year.value)"> ({{item['work-summary'][0]['publication-date'].year.value}})</span>
|
|
||||||
<div *ngIf="item['work-summary'][0].source && item['work-summary'][0].source['source-name'] && item['work-summary'][0].source['source-name']" class="uk-article-meta">Authors: {{ item['work-summary'][0].source['source-name'].value}}
|
|
||||||
<!--span *ngFor="let author of item.contributors.slice(0,10) l.valueet i = index">{{author}}{{(i < (item.contributors.slice(0,10).length-1))?"; ":""}}{{(i == item.contributors.slice(0,10).length-1 && item.contributors.length > 10)?"...":""}}</span--></div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-primary " > No results found </div>
|
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-primary " > No results found </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade">
|
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade">
|
||||||
<div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
<div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
|
||||||
<div *ngIf="dataciteStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
<div *ngIf="dataciteStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
|
||||||
|
@ -143,21 +107,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-divider">
|
<claim-results *ngIf="dataciteResults.length > 0 " [(results)]=dataciteResults [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.attributes.doi))?'uk-block-muted':''" >
|
|
||||||
<div >
|
|
||||||
<a *ngIf="item.attributes.doi" target="_blank" href="{{'http://dx.doi.org/'+item.attributes.doi}}" > <span class="custom-external"></span> {{item.attributes.title}}</a>
|
|
||||||
<span *ngIf="!item.attributes.doi" >{{item.attributes.title}}</span>
|
|
||||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(item.attributes.doi)" (click)="add(item, item.attributes.doi,'datacite','dataset', 'http://dx.doi.org/'+item.attributes.doi, item.attributes.title, item.attributes.published,'OPEN')" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<span *ngIf="item.attributes['container-title']" class="uk-article-meta">Publisher: {{item.attributes['container-title']}}</span><span *ngIf="(item.attributes.published)" class="uk-article-meta">({{item.attributes.published}})</span>
|
|
||||||
<div *ngIf="item.attributes.author && item.attributes.author.length > 0" class="uk-article-meta">Authors:
|
|
||||||
<span *ngFor="let author of item.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (item.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == item.attributes.author.slice(0,10).length-1 && item.attributes.author.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -173,23 +123,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="openaireData.length > 0 " class="uk-list uk-list-divider">
|
<claim-results *ngIf="openaireData.length > 0 " [(results)]=openaireData [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<li *ngFor=" let result of openaireData " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
|
||||||
<div >
|
|
||||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
|
||||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
|
||||||
|
|
||||||
|
|
||||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
|
|
||||||
(click)="add(result, result.id, 'openaire','dataset', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
|
|
||||||
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
</div>
|
|
||||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
|
|
||||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -205,22 +139,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<ul *ngIf="openaireSoftware.length > 0 " class="uk-list uk-list-divider">
|
|
||||||
<li *ngFor=" let result of openaireSoftware " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
|
||||||
<div >
|
|
||||||
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a>
|
|
||||||
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span>
|
|
||||||
|
|
||||||
|
<claim-results *ngIf="openaireSoftware.length > 0 " [(results)]=openaireSoftware [(selectedResults)]=selectedResults > </claim-results>
|
||||||
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
|
|
||||||
(click)="add(result, result.id, 'openaire','software', result['title'].url, result['title'].name, result.year, result['title'].accessMode)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
|
|
||||||
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
|
||||||
</div>
|
|
||||||
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span>
|
|
||||||
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -158,12 +158,12 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
this.crossrefPage=page;
|
this.crossrefPage=page;
|
||||||
this.crossrefResultsNum = data['total-results'];
|
this.crossrefResultsNum = data['total-results'];
|
||||||
if(data.items == 0){
|
if(data.items == 0){
|
||||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe(
|
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.crossrefResults = data.items;
|
this.crossrefResults = data;
|
||||||
this.crossrefPage=page;
|
this.crossrefPage=page;
|
||||||
this.crossrefResultsNum = data['total-results'];
|
this.crossrefResultsNum = data.length;
|
||||||
this.crossrefStatus = this.errorCodes.DONE;
|
this.crossrefStatus = this.errorCodes.DONE;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
@ -182,11 +182,11 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe(
|
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.crossrefResults = data.items;
|
this.crossrefResults = data;
|
||||||
this.crossrefPage=page;
|
this.crossrefPage=page;
|
||||||
this.crossrefResultsNum = data['total-results'];
|
this.crossrefResultsNum = data.length;
|
||||||
this.crossrefStatus = this.errorCodes.DONE;
|
this.crossrefStatus = this.errorCodes.DONE;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -202,12 +202,12 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
|
||||||
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe(
|
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.crossrefResults = data.items;
|
this.crossrefResults = data;
|
||||||
this.crossrefPage=page;
|
this.crossrefPage=page;
|
||||||
this.crossrefResultsNum = data['total-results'];
|
this.crossrefResultsNum = data.length;
|
||||||
this.crossrefStatus = this.errorCodes.DONE;
|
this.crossrefStatus = this.errorCodes.DONE;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
@ -231,7 +231,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openairePubsPage=page;
|
this.openairePubsPage=page;
|
||||||
this.openairePubsNum = data[0];
|
this.openairePubsNum = data[0];
|
||||||
this.openairePubs = data[1];
|
this.openairePubs = this.openaire2ClaimResults(data[1],"publication");
|
||||||
this.openairePubsStatus = this.errorCodes.DONE;
|
this.openairePubsStatus = this.errorCodes.DONE;
|
||||||
if(this.openairePubsNum == 0){
|
if(this.openairePubsNum == 0){
|
||||||
this.openairePubsStatus = this.errorCodes.NONE;
|
this.openairePubsStatus = this.errorCodes.NONE;
|
||||||
|
@ -252,7 +252,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openairePubsPage=page;
|
this.openairePubsPage=page;
|
||||||
this.openairePubsNum = data[0];
|
this.openairePubsNum = data[0];
|
||||||
this.openairePubs = data[1];
|
this.openairePubs = this.openaire2ClaimResults(data[1],"publication");
|
||||||
this.openairePubsStatus = this.errorCodes.DONE;
|
this.openairePubsStatus = this.errorCodes.DONE;
|
||||||
if(this.openairePubsNum == 0){
|
if(this.openairePubsNum == 0){
|
||||||
this.openairePubsStatus = this.errorCodes.NONE;
|
this.openairePubsStatus = this.errorCodes.NONE;
|
||||||
|
@ -364,7 +364,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
this.authorFamilyName = this.authors[index].authorFamilyName;
|
this.authorFamilyName = this.authors[index].authorFamilyName;
|
||||||
this.authorId = this.authors[index].id;
|
this.authorId = this.authors[index].id;
|
||||||
this.orcidStatus = this.errorCodes.LOADING;
|
this.orcidStatus = this.errorCodes.LOADING;
|
||||||
this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties).subscribe(
|
this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.orcidResults=data;
|
this.orcidResults=data;
|
||||||
|
@ -382,6 +382,13 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
if(this.orcidResultsNum == 0){
|
if(this.orcidResultsNum == 0){
|
||||||
this.orcidStatus = this.errorCodes.NONE;
|
this.orcidStatus = this.errorCodes.NONE;
|
||||||
}
|
}
|
||||||
|
for(var i=0;i<this.orcidResults.length; i++){
|
||||||
|
var result = this.orcidResults[i];
|
||||||
|
result['authors'].push(this.authorFamilyName + ', '+this.authorGivenName);
|
||||||
|
if(result['DOI'] !=null){
|
||||||
|
this.enhanceInfoFromDOI(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.orcidResultsNum = 0;
|
this.orcidResultsNum = 0;
|
||||||
this.totalPages=0;
|
this.totalPages=0;
|
||||||
|
@ -397,7 +404,42 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private enhanceInfoFromDOI(result){
|
||||||
|
|
||||||
|
if(result['DOI'] !=null){
|
||||||
|
this._searchCrossrefService.searchCrossrefByDOIs([result['DOI']], this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||||
|
data => {
|
||||||
|
if(data != null || data.length > 0 ) {
|
||||||
|
var crossrefResult = data[0];
|
||||||
|
if(result['title'] == null ||result['title'] == ""){
|
||||||
|
result['title'] = crossrefResult['title'];
|
||||||
|
}
|
||||||
|
if(crossrefResult['authors'].length > 0){
|
||||||
|
result['authors'] = [];
|
||||||
|
for(var i =0; i <crossrefResult['authors'].length; i++ ){
|
||||||
|
result['authors'].push(crossrefResult['authors'][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(result['journal'] == null ||result['journal'] == ""){
|
||||||
|
result['journal'] = crossrefResult['journal'];
|
||||||
|
}
|
||||||
|
if(result['publisher'] == null ||result['publisher'] == ""){
|
||||||
|
result['publisher'] = crossrefResult['publisher'];
|
||||||
|
}
|
||||||
|
if(result['date'] == null ||result['date'] == ""){
|
||||||
|
result['date'] = crossrefResult['date'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
},
|
||||||
|
err =>{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Is it USED???
|
Is it USED???
|
||||||
private remove(item){
|
private remove(item){
|
||||||
|
@ -453,34 +495,6 @@ openaireSoftwarePageChange($event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private isSelected(id:string){
|
|
||||||
|
|
||||||
var found:boolean = false;
|
|
||||||
this.warningMessage = "";
|
|
||||||
for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
|
||||||
let item = this.selectedResults[_i];
|
|
||||||
if(item.id == id){
|
|
||||||
found=true;
|
|
||||||
this.warningMessage = "Publication already in selected list";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// isSelected(id:string){
|
|
||||||
//
|
|
||||||
// var found:boolean = false;
|
|
||||||
// this.warningMessage = "";
|
|
||||||
// for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
|
||||||
// let item = this.selectedResults[_i];
|
|
||||||
// if(item.id == id){
|
|
||||||
// found=true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return found;
|
|
||||||
// }
|
|
||||||
private searchDatacite (term: string, size : number, page : number) {
|
private searchDatacite (term: string, size : number, page : number) {
|
||||||
this.getDataciteResults(term,size,page);
|
this.getDataciteResults(term,size,page);
|
||||||
this.warningMessage = "";
|
this.warningMessage = "";
|
||||||
|
@ -495,7 +509,7 @@ openaireSoftwarePageChange($event) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openaireDataPage=page;
|
this.openaireDataPage=page;
|
||||||
this.openaireDataNum = data[0];
|
this.openaireDataNum = data[0];
|
||||||
this.openaireData = data[1];
|
this.openaireData = this.openaire2ClaimResults(data[1],"dataset");
|
||||||
this.openaireDataStatus = this.errorCodes.DONE;
|
this.openaireDataStatus = this.errorCodes.DONE;
|
||||||
if(this.openaireDataNum == 0){
|
if(this.openaireDataNum == 0){
|
||||||
this.openaireDataStatus = this.errorCodes.NONE;
|
this.openaireDataStatus = this.errorCodes.NONE;
|
||||||
|
@ -513,7 +527,7 @@ openaireSoftwarePageChange($event) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openaireDataPage=page;
|
this.openaireDataPage=page;
|
||||||
this.openaireDataNum = data[0];
|
this.openaireDataNum = data[0];
|
||||||
this.openaireData = data[1];
|
this.openaireData = this.openaire2ClaimResults(data[1],"dataset");
|
||||||
this.openaireDataStatus = this.errorCodes.DONE;
|
this.openaireDataStatus = this.errorCodes.DONE;
|
||||||
if(this.openaireDataNum == 0){
|
if(this.openaireDataNum == 0){
|
||||||
this.openaireDataStatus = this.errorCodes.NONE;
|
this.openaireDataStatus = this.errorCodes.NONE;
|
||||||
|
@ -538,7 +552,7 @@ openaireSoftwarePageChange($event) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openaireSoftwarePage=page;
|
this.openaireSoftwarePage=page;
|
||||||
this.openaireSoftwareNum = data[0];
|
this.openaireSoftwareNum = data[0];
|
||||||
this.openaireSoftware = data[1];
|
this.openaireSoftware = this.openaire2ClaimResults(data[1],"software");
|
||||||
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
||||||
if(this.openaireSoftwareNum == 0){
|
if(this.openaireSoftwareNum == 0){
|
||||||
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
||||||
|
@ -556,7 +570,8 @@ openaireSoftwarePageChange($event) {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.openaireSoftwarePage=page;
|
this.openaireSoftwarePage=page;
|
||||||
this.openaireSoftwareNum = data[0];
|
this.openaireSoftwareNum = data[0];
|
||||||
this.openaireSoftware = data[1];
|
this.openaireSoftware = this.openaire2ClaimResults(data[1],"software");
|
||||||
|
|
||||||
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
||||||
if(this.openaireSoftwareNum == 0){
|
if(this.openaireSoftwareNum == 0){
|
||||||
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
||||||
|
@ -573,13 +588,44 @@ openaireSoftwarePageChange($event) {
|
||||||
this.infoMessage = "";
|
this.infoMessage = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private openaire2ClaimResults(data,type):ClaimResult[]{
|
||||||
|
var claimResults = [];
|
||||||
|
for(var i=0; i< data.length; i++){
|
||||||
|
var item = data[i];
|
||||||
|
var result: ClaimResult = new ClaimResult();
|
||||||
|
result.publisher = null;
|
||||||
|
result.journal = null;
|
||||||
|
result.DOI = null;
|
||||||
|
result.id = item.id;
|
||||||
|
result.title = item.title.name;
|
||||||
|
result.url = item.title.url;
|
||||||
|
result.source = "openaire";
|
||||||
|
result.date = item.year;
|
||||||
|
result.accessRights = item.title.accessMode;
|
||||||
|
console.log(item);
|
||||||
|
result.type = type;
|
||||||
|
|
||||||
|
result.publisher = item.publisher;
|
||||||
|
result.result = item;
|
||||||
|
if(item.authors){
|
||||||
|
for(var j=0; j<item.authors.length; j++){
|
||||||
|
result.authors.push(item.authors[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
claimResults.push(result);
|
||||||
|
}
|
||||||
|
return claimResults;
|
||||||
|
|
||||||
|
}
|
||||||
private getDataciteResults (term: string, size : number, page : number) {
|
private getDataciteResults (term: string, size : number, page : number) {
|
||||||
console.log("getDataciteResults + "+this.properties.searchDataciteAPIURL)
|
console.log("getDataciteResults + "+this.properties.searchDataciteAPIURL)
|
||||||
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties).subscribe(
|
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.dataciteResults = data.data;
|
this.dataciteResults = data;
|
||||||
this.datacitePage=page;
|
this.datacitePage=page;
|
||||||
this.dataciteResultsNum = data.meta.total;
|
this.dataciteResultsNum = data.length;
|
||||||
this.dataciteStatus = this.errorCodes.DONE;
|
this.dataciteStatus = this.errorCodes.DONE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -592,43 +638,6 @@ openaireSoftwarePageChange($event) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
|
||||||
|
|
||||||
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
|
|
||||||
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode);
|
|
||||||
|
|
||||||
|
|
||||||
if (itemSource == 'orcid'){
|
|
||||||
if(result.authors.length ==0 ){
|
|
||||||
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var found:boolean = this.isSelected( result.id);
|
|
||||||
|
|
||||||
this.warningMessage = "";
|
|
||||||
if (!found) {
|
|
||||||
this.selectedResults.push(result);
|
|
||||||
|
|
||||||
UIkit.notification({
|
|
||||||
message : 'A new research result is selected.',
|
|
||||||
status : 'primary',
|
|
||||||
timeout : 1000,
|
|
||||||
pos : 'top-center'
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
this.warningMessage = "Research Data already in selected list";
|
|
||||||
UIkit.notification({
|
|
||||||
message : 'The research result is already on your list.',
|
|
||||||
status : 'warning',
|
|
||||||
timeout : 1000,
|
|
||||||
pos : 'top-center'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public searchSourceChanged(source){
|
public searchSourceChanged(source){
|
||||||
this.searchSource = source;
|
this.searchSource = source;
|
||||||
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source;
|
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component';
|
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component';
|
||||||
|
import {ClaimResultsComponent} from './claimResults.component';
|
||||||
|
|
||||||
import {SearchDataciteServiceModule} from './service/searchDataciteService.module';
|
import {SearchDataciteServiceModule} from './service/searchDataciteService.module';
|
||||||
|
|
||||||
|
@ -22,9 +23,9 @@ import {HelperModule} from '../../utils/helper/helper.module';
|
||||||
SearchOrcidService
|
SearchOrcidService
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ClaimResultSearchFormComponent
|
ClaimResultSearchFormComponent, ClaimResultsComponent
|
||||||
|
|
||||||
],
|
],
|
||||||
exports: [ClaimResultSearchFormComponent ]
|
exports: [ClaimResultSearchFormComponent, ClaimResultsComponent ]
|
||||||
})
|
})
|
||||||
export class ClaimResultSearchFormModule { }
|
export class ClaimResultSearchFormModule { }
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import {ClaimResult} from '../claim-utils/claimEntities.class';
|
||||||
|
|
||||||
|
declare var UIkit:any;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'claim-results',
|
||||||
|
template:`
|
||||||
|
|
||||||
|
<ul *ngIf="results.length > 0 " class="uk-list uk-list-divider">
|
||||||
|
<li *ngFor=" let result of results " [class]="(isSelected(result.id))?'uk-block-muted':''">
|
||||||
|
<div >
|
||||||
|
<a *ngIf="result.url" target="_blank" [href]="result.url" >{{result.title?result.title:'[No title available]'}}</a>
|
||||||
|
<span *ngIf="!result.url" >{{result.title?result.title:'[No title available]'}}</span>
|
||||||
|
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)"
|
||||||
|
(click)="add(result)" class="uk-icon-button"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect>
|
||||||
|
<rect x="1" y="9" width="17" height="1"></rect></svg></a>
|
||||||
|
</div>
|
||||||
|
<span *ngIf="result.publisher!=null" class="uk-article-meta">Publisher: {{result.publisher}}</span>
|
||||||
|
<span *ngIf="result.journal!=null" class="uk-article-meta">Journal: {{result.journal}}</span><span *ngIf="(result.date)" class="uk-article-meta"> ({{result.date}})</span>
|
||||||
|
<div *ngIf="result.authors && result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of result.authors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
||||||
|
<div *ngIf="result.editors && result.editors.length > 0" class="uk-article-meta">Editors: <span *ngFor="let author of result.editors.slice(0,10) let i = index">{{author}}{{(i < (result.authors.slice(0,10).length-1))?"; ":""}}{{(i == result.authors.slice(0,10).length-1 && result.authors.length > 10)?"...":""}}</span></div>
|
||||||
|
</li>`,
|
||||||
|
|
||||||
|
})
|
||||||
|
export class ClaimResultsComponent {
|
||||||
|
@Input() results;
|
||||||
|
@Input() selectedResults;
|
||||||
|
private isSelected(id:string){
|
||||||
|
|
||||||
|
var found:boolean = false;
|
||||||
|
for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
||||||
|
let item = this.selectedResults[_i];
|
||||||
|
if(item.id == id){
|
||||||
|
found=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
add(item){
|
||||||
|
var found:boolean = this.isSelected( item.id);
|
||||||
|
if (!found) {
|
||||||
|
this.selectedResults.push(item);
|
||||||
|
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'A new research result is selected.',
|
||||||
|
status : 'primary',
|
||||||
|
timeout : 1000,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'The research result is already on your list.',
|
||||||
|
status : 'warning',
|
||||||
|
timeout : 1000,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,22 +4,23 @@ import {Observable} from 'rxjs/Observable';
|
||||||
import 'rxjs/add/observable/of';
|
import 'rxjs/add/observable/of';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/share';
|
import 'rxjs/add/operator/share';
|
||||||
|
import { ClaimResult} from '../claimEntities.class';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchCrossrefService {
|
export class SearchCrossrefService {
|
||||||
constructor( private http: Http ) {}
|
constructor( private http: Http ) {}
|
||||||
|
|
||||||
|
|
||||||
searchCrossrefResults (term: string, size : number, page : number, apiUrl:string):any {
|
searchCrossrefResults (term: string, size : number, page : number, apiUrl:string, parse:boolean = false):any {
|
||||||
let url = apiUrl+'?query='+term+'&rows='+size+'&offset='+(size*(page-1));
|
let url = apiUrl+'?query='+term+'&rows='+size+'&offset='+(size*(page-1));
|
||||||
let key = url;
|
let key = url;
|
||||||
|
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(request => <any> request.json().message)
|
.map(request => <any> request.json().message)
|
||||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term));
|
.map(request => (parse?this.parse(request.items):request))
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
searchCrossrefByDOIs(DOIs: string[], apiUrl:string):any {
|
searchCrossrefByDOIs(DOIs: string[], apiUrl:string, parse:boolean = false):any {
|
||||||
|
|
||||||
var doisParams = "";
|
var doisParams = "";
|
||||||
for(var i =0 ;i < DOIs.length; i++){
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
@ -31,11 +32,11 @@ export class SearchCrossrefService {
|
||||||
|
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(request => <any> request.json().message)
|
.map(request => <any> request.json().message)
|
||||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams));
|
.map(request => (parse?this.parse(request.items):request))
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
searchCrossrefByMultipleDOIs(dois: string[], apiUrl:string):any {
|
searchCrossrefByMultipleDOIs(dois: string[], apiUrl:string, parse:boolean = false):any {
|
||||||
let url = apiUrl+'?filter=doi:';
|
let url = apiUrl+'?filter=doi:';
|
||||||
for(var i=0; i<dois.length; i++){
|
for(var i=0; i<dois.length; i++){
|
||||||
url=url+(url.length==0?'':',')+'doi:'+dois[i];
|
url=url+(url.length==0?'':',')+'doi:'+dois[i];
|
||||||
|
@ -46,7 +47,7 @@ export class SearchCrossrefService {
|
||||||
|
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(request => <any> request.json().message)
|
.map(request => <any> request.json().message)
|
||||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']));
|
.map(request => (parse?this.parse(request.items):request))
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,5 +58,41 @@ export class SearchCrossrefService {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
parse(response):ClaimResult[]{
|
||||||
|
var results:ClaimResult[] = [];
|
||||||
|
for(var i=0; i<response.length; i++){
|
||||||
|
var item=response[i];
|
||||||
|
var result:ClaimResult = new ClaimResult();
|
||||||
|
result.publisher = null;
|
||||||
|
result.journal = null;
|
||||||
|
result.DOI = item.DOI;
|
||||||
|
result.id = item.DOI;
|
||||||
|
result.title = item.title;
|
||||||
|
result.url = item.URL;
|
||||||
|
result.source = 'crossref';
|
||||||
|
result.type = 'publication';
|
||||||
|
if(item['published-print']){
|
||||||
|
result.date = item['published-print']['date-parts'][0];
|
||||||
|
}
|
||||||
|
result.accessRights = "OPEN";
|
||||||
|
result.publisher = item.publisher;
|
||||||
|
result.journal = null;
|
||||||
|
result.result = item;
|
||||||
|
if(item.author){
|
||||||
|
for(var j=0; j<item.author.length; j++){
|
||||||
|
result.authors.push(item.author[j].family+", "+item.author[j].given);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(item.editor){
|
||||||
|
for(var j=0; j<item.editor.length; j++){
|
||||||
|
result.editors.push(item.editor[j].family+", "+item.editor[j].given);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,30 +5,33 @@ import 'rxjs/add/observable/of';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/share';
|
import 'rxjs/add/operator/share';
|
||||||
import{EnvProperties} from '../../../utils/properties/env-properties';
|
import{EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
|
import { ClaimResult} from '../claimEntities.class';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchDataciteService {
|
export class SearchDataciteService {
|
||||||
constructor(private http: Http ) {}
|
constructor(private http: Http ) {}
|
||||||
|
|
||||||
searchDataciteResults (term: string, size : number, page : number, properties:EnvProperties):any {
|
searchDataciteResults (term: string, size : number, page : number, properties:EnvProperties, parse:boolean = false):any {
|
||||||
console.info("In search datacite results "+term+ " "+properties.searchDataciteAPIURL);
|
console.info("In search datacite results "+term+ " "+properties.searchDataciteAPIURL);
|
||||||
let url = properties.searchDataciteAPIURL+'?query='+term+'&rows='+size+'&start='+(size*(page-1));
|
let url = properties.searchDataciteAPIURL+'?query='+term+'&rows='+size+'&start='+(size*(page-1));
|
||||||
let key = url;
|
let key = url;
|
||||||
|
|
||||||
return this.http.get( ( properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get( ( properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
.map(request => <any> request.json())
|
.map(request => <any> request.json())
|
||||||
|
.map(request => (parse?this.parse(request.data):request))
|
||||||
.do(items => console.info(items))
|
.do(items => console.info(items))
|
||||||
.do(items => console.log("Datacite Results: total results = "+items.meta.total+" keyword = "+term));
|
//.catch(this.handleError);
|
||||||
//.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
getDataciteResultByDOI (doi: string, properties:EnvProperties):any {
|
getDataciteResultByDOI (doi: string, properties:EnvProperties, parse:boolean = false):any {
|
||||||
console.info("Fetch datacite resultt by DOI: "+doi);
|
console.info("Fetch datacite resultt by DOI: "+doi);
|
||||||
let url = properties.searchDataciteAPIURL+'/'+doi;
|
let url = properties.searchDataciteAPIURL+'/'+doi;
|
||||||
let key = url;
|
let key = url;
|
||||||
|
|
||||||
return this.http.get( (properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get( (properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
.map(request => <any> request.json())
|
.map(request => <any> request.json())
|
||||||
|
.map(request => (parse?this.parse(request.data):request))
|
||||||
.do(items => console.info(items));
|
.do(items => console.info(items));
|
||||||
|
|
||||||
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi))
|
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi))
|
||||||
|
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
|
@ -48,4 +51,34 @@ export class SearchDataciteService {
|
||||||
let body = res.json();
|
let body = res.json();
|
||||||
return body.data || { };
|
return body.data || { };
|
||||||
}
|
}
|
||||||
|
parse(response):ClaimResult[]{
|
||||||
|
var results:ClaimResult[] = [];
|
||||||
|
for(var i=0; i<response.length; i++){
|
||||||
|
var item=response[i];
|
||||||
|
var result:ClaimResult = new ClaimResult();
|
||||||
|
result.publisher = null;
|
||||||
|
result.journal = null;
|
||||||
|
result.DOI = item.attributes.doi;
|
||||||
|
result.id = item.attributes.doi;
|
||||||
|
result.title = item.attributes.title;
|
||||||
|
result.url = 'http://dx.doi.org/'+item.attributes.doi;
|
||||||
|
result.source = 'datacite';
|
||||||
|
result.type = 'dataset';
|
||||||
|
result.date = item.attributes.published;
|
||||||
|
result.accessRights = "OPEN";
|
||||||
|
result.publisher =item.attributes['container-title']
|
||||||
|
result.journal = null;
|
||||||
|
result.result = item;
|
||||||
|
if(item.attributes.author){
|
||||||
|
for(var j=0; j<item.attributes.author.length; j++){
|
||||||
|
var author = item.attributes.author[j];
|
||||||
|
result.authors.push((author.family)?author.family+', '+author.given:author.literal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import{EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
import 'rxjs/add/observable/of';
|
import 'rxjs/add/observable/of';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/share';
|
import 'rxjs/add/operator/share';
|
||||||
|
import { ClaimResult} from '../claimEntities.class';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SearchOrcidService {
|
export class SearchOrcidService {
|
||||||
|
@ -48,7 +49,7 @@ export class SearchOrcidService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
searchOrcidPublications (id: string, properties:EnvProperties):any {
|
searchOrcidPublications (id: string, properties:EnvProperties, parse:boolean = false):any {
|
||||||
console.info("In search Orcid publications for author: "+id);
|
console.info("In search Orcid publications for author: "+id);
|
||||||
|
|
||||||
var headers = new Headers();
|
var headers = new Headers();
|
||||||
|
@ -58,7 +59,9 @@ export class SearchOrcidService {
|
||||||
let key = url;
|
let key = url;
|
||||||
|
|
||||||
return this.http.get(url, { headers: headers })
|
return this.http.get(url, { headers: headers })
|
||||||
.map(res => res.json()['group']);
|
.map(res => res.json()['group'])
|
||||||
|
.do(res => console.log(res))
|
||||||
|
.map(request => (parse?this.parse(request):request));
|
||||||
//.map(res => res['orcid-work']);
|
//.map(res => res['orcid-work']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,4 +128,54 @@ export class SearchOrcidService {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
parse(response):ClaimResult[]{
|
||||||
|
var results:ClaimResult[] = [];
|
||||||
|
for(var i=0; i<response.length; i++){
|
||||||
|
var item=response[i];
|
||||||
|
var result:ClaimResult = new ClaimResult();
|
||||||
|
result.DOI = null;
|
||||||
|
result.url = null;
|
||||||
|
result.publisher = null;
|
||||||
|
result.journal = null;
|
||||||
|
if(item['work-summary'] && item['work-summary'].length > 0){
|
||||||
|
item = item['work-summary'][0];
|
||||||
|
}else{
|
||||||
|
item['work-summary'];
|
||||||
|
}
|
||||||
|
if(item['external-ids'] && item['external-ids']['external-id']){
|
||||||
|
for(var j =0; j< item['external-ids']['external-id'].length; j++){
|
||||||
|
var id = item['external-ids']['external-id'][j];
|
||||||
|
if(id['external-id-type'] == "doi"){
|
||||||
|
result.DOI = id['external-id-value'];
|
||||||
|
result.url = "http://dx.doi.org/" + result.DOI;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.id = item['put-code'];
|
||||||
|
if(item.title && item.title.title){
|
||||||
|
result.title = item['title']['title'].value;
|
||||||
|
}
|
||||||
|
result.journal = item['journal-title'];
|
||||||
|
result.source = 'orcid';
|
||||||
|
result.type = 'publication';
|
||||||
|
if(item['publication-date'] && item['publication-date']['year']){
|
||||||
|
result.date = item['publication-date']['year'].value
|
||||||
|
}
|
||||||
|
|
||||||
|
result.accessRights = "OPEN";
|
||||||
|
if(item.publisher){
|
||||||
|
result.publisher = item.publisher;
|
||||||
|
}
|
||||||
|
result.result = item;
|
||||||
|
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,13 +175,12 @@ export class BulkClaimComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchResult(id:string,accessMode:string,date:string){
|
fetchResult(id:string,accessMode:string,date:string){
|
||||||
this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties.searchCrossrefAPIURL).subscribe(
|
this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties.searchCrossrefAPIURL, true).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
|
||||||
var crossrefResult = data.items[0];
|
var result = data[0];
|
||||||
if(data.items.length > 0){
|
if(data.length > 0){
|
||||||
this.foundIds.push(id);
|
this.foundIds.push(id);
|
||||||
var result: ClaimResult = ClaimResult.generateResult(crossrefResult, id,"crossref","publication", crossrefResult.URL, crossrefResult.title, crossrefResult.created['date-time'], accessMode);
|
|
||||||
result.embargoEndDate = date;
|
result.embargoEndDate = date;
|
||||||
this.results.push(result);
|
this.results.push(result);
|
||||||
this.endOfFetching();
|
this.endOfFetching();
|
||||||
|
@ -198,14 +197,13 @@ export class BulkClaimComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
searchInDatacite(id:string,accessMode:string,date:string){
|
searchInDatacite(id:string,accessMode:string,date:string){
|
||||||
this._searchDataciteService.getDataciteResultByDOI(id,this.properties).subscribe(
|
this._searchDataciteService.getDataciteResultByDOI(id,this.properties,true).subscribe(
|
||||||
item => {
|
items => {
|
||||||
var dataciteResult = item.data;
|
|
||||||
|
|
||||||
if(dataciteResult != null && dataciteResult.attributes!= null ){
|
if(items.length > 0){
|
||||||
|
var result = items[0];
|
||||||
|
|
||||||
this.foundIds.push(id);
|
this.foundIds.push(id);
|
||||||
var result: ClaimResult = ClaimResult.generateResult(dataciteResult, id,"datacite","dataset", 'http://dx.doi.org/'+dataciteResult.attributes.doi, dataciteResult.attributes.title, dataciteResult.attributes.published, accessMode);
|
|
||||||
result.embargoEndDate = date;
|
result.embargoEndDate = date;
|
||||||
this.results.push(result);
|
this.results.push(result);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -36,26 +36,14 @@ import {Dates} from '../../../utils/string-utils.class';
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span *ngIf="pub.publisher" >Publisher: {{pub.publisher}}</span>
|
<span *ngIf="pub.publisher" >Publisher: {{pub.publisher}}</span>
|
||||||
<!--Orcid --><span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " >Journal: {{pub.result['journal-title'].value}}</span>
|
<span *ngIf="pub.journal " >Journal: {{pub.journal}}</span>
|
||||||
<span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
|
<span *ngIf="pub.date" >({{pub.date}})</span>
|
||||||
|
|
||||||
<div *ngIf="pub.authors && pub.authors.length > 0" >Authors: <span *ngFor="let author of pub.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.authors.slice(0,10).length-1 && pub.authors.length > 10)?"...":""}}</span></div>
|
<div *ngIf="pub.authors && pub.authors.length > 0" >Authors: <span *ngFor="let author of pub.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.authors.slice(0,10).length-1 && pub.authors.length > 10)?"...":""}}</span></div>
|
||||||
|
|
||||||
<!-- Crossref -->
|
<div *ngIf="pub.editors && pub.editors.length > 0" >Editors: <span *ngFor="let author of pub.editors.slice(0,10) let i = index">{{author}} {{(i < (pub.editors.slice(0,10).length-1))?"; ":""}}{{(i == pub.editors.slice(0,10).length-1 && pub.editors.length > 10)?"...":""}}</span></div>
|
||||||
<!--span *ngIf="pub.result.publisher" class="uk-article-meta">Publisher: {{pub.result.publisher}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
|
|
||||||
<div *ngIf="pub.result.author && pub.result.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.author.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.author.slice(0,10).length-1 && pub.result.author.length > 10)?"...":""}}</span></div-->
|
|
||||||
<div *ngIf="pub.result.editor && pub.result.editor.length > 0" >Editors: <span *ngFor="let author of pub.result.editor.slice(0,10) let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.editor.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.editor.slice(0,10).length-1 && pub.result.editor.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
<!-- Openaire -->
|
|
||||||
<div *ngIf="pub.result.authors && pub.result.authors.length >0 " >Authors: <span *ngFor="let author of pub.result.authors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.authors.slice(0,10).length-1 && pub.result.authors.length > 10)?"...":""}}</span></div>
|
|
||||||
|
|
||||||
<!-- Orcid -->
|
|
||||||
|
|
||||||
<!--span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span>
|
|
||||||
<div *ngIf="pub.result.contributors && pub.result.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.contributors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.contributors.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.contributors.slice(0,10).length-1 && pub.result.contributors.length > 10)?"...":""}}</span></div-->
|
|
||||||
<!-- Datacite -->
|
|
||||||
<!--span *ngIf="pub.result.attributes['container-title']" class="uk-article-meta">Publisher: {{pub.result.attributes['container-title']}}</span><span *ngIf="pub.date" class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
|
|
||||||
<div *ngIf="pub.result.attributes.author && pub.result.attributes.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.attributes.author.slice(0,10) let i = index">{{(author.family)?author.family+', '+author.given:author.literal}}{{(i < (pub.result.attributes.author.slice(0,10).length-1))?"; ":""}}{{(i == pub.result.attributes.author.slice(0,10).length-1 && pub.result.attributes.author.length > 10)?"...":""}}</span></div-->
|
|
||||||
<div><span class="uk-label label-grey">{{pub.source}}</span>
|
<div><span class="uk-label label-grey">{{pub.source}}</span>
|
||||||
<span *ngIf="pub.accessRights" [class]=" 'uk-label label-'+pub.accessRights" > {{pub.accessRights}}</span>
|
<span *ngIf="pub.accessRights" [class]=" 'uk-label label-'+pub.accessRights" > {{pub.accessRights}}</span>
|
||||||
<span *ngIf="pub.type" [class]="'uk-label label-'+pub.type" > {{pub.type}}</span>
|
<span *ngIf="pub.type" [class]="'uk-label label-'+pub.type" > {{pub.type}}</span>
|
||||||
|
|
Loading…
Reference in New Issue