Linking: in bulk mode search also in datacite, change the info layout
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47473 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
df7c2e965d
commit
fbf296640d
|
@ -249,7 +249,6 @@ getCommunities () {
|
|||
console.log("displaySubcategory: "+id+" value:"+ this.conceptsClassDisplay[id]);
|
||||
}
|
||||
browseConcepts (categoryId) {
|
||||
this.conceptsCategoryLoading[categoryId] = true;
|
||||
if(!Session.isValidAndRemove()){
|
||||
this.saveStateAndRedirectLogin();
|
||||
}else{
|
||||
|
@ -261,6 +260,7 @@ getCommunities () {
|
|||
}
|
||||
this.conceptsClass[categoryId] = [];
|
||||
var token=Session.getUserJwt();
|
||||
this.conceptsCategoryLoading[categoryId] = true;
|
||||
this._contextService.getConcepts(categoryId, "",token,false).subscribe(
|
||||
data => {
|
||||
for(var i=0;i<data.length; i++){
|
||||
|
|
|
@ -13,6 +13,69 @@ export class ClaimResult{
|
|||
public publisher: string;
|
||||
public description: string;
|
||||
public resourceType:string;
|
||||
|
||||
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
||||
|
||||
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{
|
||||
public funderId: string;
|
||||
|
|
|
@ -507,67 +507,15 @@ openaireDataPageChange($event) {
|
|||
}
|
||||
|
||||
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
||||
|
||||
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
|
||||
var result: ClaimResult = new ClaimResult();
|
||||
result.id = itemId;
|
||||
result.type = itemType;
|
||||
result.source = itemSource;
|
||||
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode);
|
||||
|
||||
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
|
||||
result.url = itemUrl;
|
||||
result.accessRights = 'OPEN';
|
||||
result.embargoEndDate = this.nextDate;
|
||||
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]);
|
||||
}
|
||||
}else{
|
||||
if (itemSource == 'orcid'){
|
||||
if(result.authors.length ==0 ){
|
||||
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName);
|
||||
}
|
||||
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
||||
}
|
||||
var found:boolean = this.isSelected( result.id);
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ import { SharedModule } from '../../shared/shared.module';
|
|||
import { CommonModule } from '@angular/common';
|
||||
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component';
|
||||
|
||||
import {SearchDataciteService} from './service/searchDatacite.service';
|
||||
import {SearchDataciteServiceModule} from './service/searchDataciteService.module';
|
||||
|
||||
import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module';
|
||||
import {SearchOrcidService} from './service/searchOrcid.service';
|
||||
|
||||
|
@ -14,10 +15,10 @@ import {PagingModule } from '../../utils/paging.module';
|
|||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule
|
||||
SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule, SearchDataciteServiceModule
|
||||
],
|
||||
providers:[
|
||||
SearchDataciteService, SearchOrcidService
|
||||
SearchOrcidService
|
||||
],
|
||||
declarations: [
|
||||
ClaimResultSearchFormComponent
|
||||
|
|
|
@ -26,6 +26,22 @@ export class SearchDataciteService {
|
|||
});
|
||||
//.catch(this.handleError);
|
||||
}
|
||||
getDataciteResultByDOI (doi: string):any {
|
||||
console.info("Fetch datacite resultt by DOI: "+doi);
|
||||
let url = OpenaireProperties.getSearchDataciteAPIURL()+'/'+doi;
|
||||
let key = url;
|
||||
if (this._cache.has(key)) {
|
||||
return Observable.of(this._cache.get(key));
|
||||
}
|
||||
return this.http.get( url)
|
||||
.map(request => <any> request.json())
|
||||
.do(items => console.info(items))
|
||||
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi))
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
});
|
||||
//.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
private handleError (error: Response) {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.service';
|
||||
import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.service';
|
||||
|
||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||
import {Dates, DOI} from '../../../utils/string-utils.class';
|
||||
import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
||||
import {ClaimResult} from '../../claim-utils/claimEntities.class';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -11,15 +14,41 @@ import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
|||
template: `
|
||||
<div class="uk-animation uk-margin-top" style="min-height:350px;">
|
||||
<form class=" uk-padding uk-panel uk-background-muted ">
|
||||
|
||||
<div class="uk-clearfix">
|
||||
<a class="uk-float-right" uk-toggle="target: #uploadInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> More information about bulk upload? </a>
|
||||
</div>
|
||||
<div id="uploadInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a>
|
||||
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Upload information:</div>
|
||||
Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef or Datacite.
|
||||
Available results will be linked with the selected Projects and Contexts.
|
||||
|
||||
<div class="uk-article-meta">
|
||||
CSV format:
|
||||
<ul class="uk-list">
|
||||
<li>The format of CSV file should be "DOI","ACCESS_MODE","DATE".</li>
|
||||
<li>The value "DOI" is required </li>
|
||||
<li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</li>
|
||||
<li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li>
|
||||
<li>In case access mode is not available default value is "OPEN".</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div for="exampleInputFile">Upload a DOI csv file:</div>
|
||||
<label for="exampleInputFile">Select a file</label>
|
||||
<input id="exampleInputFile" type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
|
||||
<button class="uk-button uk-button-success" [class.disabled]="!enableUpload" type="button" (click)="upload()">Upload</button>
|
||||
<button class="uk-button uk-button-primary" uk-toggle="target: #uploadInfo; animation: uk-animation-fade"><span uk-icon="icon: info"></span> </button>
|
||||
|
||||
<div *ngIf="showReport" class="uk-alert uk-alert-primary" role="alert" >
|
||||
<div>Uploaded file contains {{allIds.length}} rows. {{foundIds.length}} results were sucefully fetched from CrossRef.</div>
|
||||
<a class="uk-alert-close" uk-close></a>
|
||||
<div>Uploaded file contains {{allIds.length}} rows. {{foundIds.length}} results were sucefully fetched from CrossRef and Datacite.</div>
|
||||
<div *ngIf ="duplicateIds.length > 0" >{{duplicateIds.length}} duplicate DOIs.</div>
|
||||
<div *ngIf = "notFoundIds.length > 0" >Couldn't be fetched from crossref:
|
||||
<div *ngIf = "notFoundIds.length > 0" >Couldn't be found:
|
||||
<ul class="">
|
||||
<li *ngFor="let id of notFoundIds">"{{id}}"</li>
|
||||
</ul>
|
||||
|
@ -37,23 +66,6 @@ import {OpenaireProperties} from '../../../utils/properties/openaireProperties';
|
|||
</form>
|
||||
|
||||
|
||||
<div id="uploadInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
||||
<a uk-toggle="target: #uploadInfo; animation: uk-animation-fade" class="uk-float-right"><span uk-icon="icon: close"></span></a>
|
||||
<div class="uk-text-bold"><span uk-icon="icon: info"></span> Upload information:</div>
|
||||
Upload a csv file containing a list of DOIs. For each DOI found in the file, metadata will be fetched from CrossRef.
|
||||
Available results will be linked with the selected Projects and Contexts.
|
||||
|
||||
<div class="uk-article-meta">
|
||||
CSV format:
|
||||
<ul class="uk-list">
|
||||
<li>The format of CSV file should be "DOI","ACCESS_MODE","DATE".</li>
|
||||
<li>The value "DOI" is required </li>
|
||||
<li>Access mode column should have values: "OPEN","CLOSED" or "EMBARGO".</li>
|
||||
<li>Date column valid format is YYYY-MM-DD and is required when access mode has value EMBARGO.</li>
|
||||
<li>In case access mode is not available default value is "OPEN".</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`
|
||||
|
@ -80,10 +92,8 @@ export class BulkClaimComponent {
|
|||
errorMessage = "";
|
||||
infoMEssage = "";
|
||||
enableUpload:boolean = true;
|
||||
constructor(private _searchCrossrefService: SearchCrossrefService) {
|
||||
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
||||
this.filesToUpload = [];
|
||||
|
||||
|
||||
}
|
||||
ngOnInit() {}
|
||||
|
||||
|
@ -189,15 +199,14 @@ export class BulkClaimComponent {
|
|||
var crossrefResult = data.items[0];
|
||||
if(data.items.length > 0){
|
||||
this.foundIds.push(id);
|
||||
var result = {id: id, type :'publication', source : 'crossref',
|
||||
title: crossrefResult.title,url: crossrefResult.URL, result: crossrefResult, accessRights: accessMode, embargoEndDate: date, date : crossrefResult.created['date-time']};
|
||||
var result: ClaimResult = ClaimResult.generateResult(crossrefResult, id,"crossref","publication", crossrefResult.URL, crossrefResult.title, crossrefResult.created['date-time'], accessMode);
|
||||
result.embargoEndDate = date;
|
||||
this.results.push(result);
|
||||
|
||||
|
||||
}else{
|
||||
this.notFoundIds.push(id);
|
||||
}
|
||||
this.endOfFetching();
|
||||
}else{
|
||||
this.searchInDatacite(id,accessMode,date);
|
||||
// this.notFoundIds.push(id);
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
@ -207,17 +216,16 @@ export class BulkClaimComponent {
|
|||
);
|
||||
}
|
||||
searchInDatacite(id:string,accessMode:string,date:string){
|
||||
this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe(
|
||||
data => {
|
||||
this._searchDataciteService.getDataciteResultByDOI(id).subscribe(
|
||||
item => {
|
||||
var dataciteResult = item.data;
|
||||
|
||||
if(dataciteResult != null && dataciteResult.attributes!= null ){
|
||||
|
||||
var crossrefResult = data.items[0];
|
||||
if(data.items.length > 0){
|
||||
this.foundIds.push(id);
|
||||
var result = {id: id, type :'dataset', source : 'datacite',
|
||||
title: crossrefResult.title,url: crossrefResult.URL, result: crossrefResult, accessRights: accessMode, embargoEndDate: date, date : crossrefResult.created['date-time']};
|
||||
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;
|
||||
this.results.push(result);
|
||||
|
||||
|
||||
}else{
|
||||
this.notFoundIds.push(id);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import { SharedModule } from '../../../shared/shared.module';
|
|||
import {LoadingModalModule} from '../../../utils/modal/loadingModal.module';
|
||||
import {BulkClaimComponent} from './bulkClaim.component';
|
||||
import {SearchCrossrefServiceModule} from '../../claim-utils/service/searchCrossrefService.module';
|
||||
import {SearchDataciteServiceModule} from '../../claim-utils/service/searchDataciteService.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, LoadingModalModule, SearchCrossrefServiceModule
|
||||
|
|
|
@ -14,7 +14,12 @@ import { Meta} from '../../../angular2-meta';
|
|||
<div class="page-header">
|
||||
<h1>Linking</h1>
|
||||
</div>
|
||||
|
||||
<!--ul class="uk-breadcrumb">
|
||||
<li><a > Select Projects</a></li>
|
||||
<li><a > Select Communities</a></li>
|
||||
<li><a > Select Research Results</a></li>
|
||||
<li class="uk-active"><a > Complete metadata</a></li>
|
||||
</ul-->
|
||||
<!--ul class="uk-pagination uk-margin-remove-bottom">
|
||||
<li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
|
||||
<li *ngIf="show != 'claim' " (click)="next()" class="uk-margin-auto-left"><a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
||||
|
@ -34,7 +39,7 @@ import { Meta} from '../../../angular2-meta';
|
|||
<a>Projects ({{projects.length}})</a>
|
||||
</li>
|
||||
<li>
|
||||
<a>Contexts ({{contexts.length}})</a>
|
||||
<a>Communities ({{contexts.length}})</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul id="tabs" class="uk-switcher uk-margin-left uk-width-1-1">
|
||||
|
|
|
@ -56,6 +56,7 @@ import {Dates} from '../../../utils/string-utils.class';
|
|||
<!-- 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 class="uk-badge">{{pub.source}}</div>
|
||||
</div>
|
||||
<div *ngIf="showAccessRights && pub.source != 'openaire' " class = "uk-width-1-3 uk-grid">
|
||||
<div class="uk-width-1-3 uk-padding-remove-left">
|
||||
|
|
Loading…
Reference in New Issue