Revision 51910
Added by Argiro Kokogiannaki almost 6 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/service/searchCrossref.service.ts | ||
---|---|---|
4 | 4 |
import 'rxjs/add/observable/of'; |
5 | 5 |
import 'rxjs/add/operator/do'; |
6 | 6 |
import 'rxjs/add/operator/share'; |
7 |
import { ClaimResult} from '../claimEntities.class'; |
|
7 | 8 |
@Injectable() |
8 | 9 |
export class SearchCrossrefService { |
9 | 10 |
constructor( private http: Http ) {} |
10 | 11 |
|
11 | 12 |
|
12 |
searchCrossrefResults (term: string, size : number, page : number, apiUrl:string):any { |
|
13 |
searchCrossrefResults (term: string, size : number, page : number, apiUrl:string, parse:boolean = false):any {
|
|
13 | 14 |
let url = apiUrl+'?query='+term+'&rows='+size+'&offset='+(size*(page-1)); |
14 | 15 |
let key = url; |
15 | 16 |
|
16 | 17 |
return this.http.get(url) |
17 | 18 |
.map(request => <any> request.json().message) |
18 |
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" keyword = "+term));
|
|
19 |
.map(request => (parse?this.parse(request.items):request))
|
|
19 | 20 |
//.catch(this.handleError); |
20 | 21 |
|
21 | 22 |
} |
22 |
searchCrossrefByDOIs(DOIs: string[], apiUrl:string):any { |
|
23 |
searchCrossrefByDOIs(DOIs: string[], apiUrl:string, parse:boolean = false):any {
|
|
23 | 24 |
|
24 | 25 |
var doisParams = ""; |
25 | 26 |
for(var i =0 ;i < DOIs.length; i++){ |
... | ... | |
31 | 32 |
|
32 | 33 |
return this.http.get(url) |
33 | 34 |
.map(request => <any> request.json().message) |
34 |
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams));
|
|
35 |
.map(request => (parse?this.parse(request.items):request))
|
|
35 | 36 |
//.catch(this.handleError); |
36 | 37 |
|
37 | 38 |
} |
38 |
searchCrossrefByMultipleDOIs(dois: string[], apiUrl:string):any { |
|
39 |
searchCrossrefByMultipleDOIs(dois: string[], apiUrl:string, parse:boolean = false):any {
|
|
39 | 40 |
let url = apiUrl+'?filter=doi:'; |
40 | 41 |
for(var i=0; i<dois.length; i++){ |
41 | 42 |
url=url+(url.length==0?'':',')+'doi:'+dois[i]; |
... | ... | |
46 | 47 |
|
47 | 48 |
return this.http.get(url) |
48 | 49 |
.map(request => <any> request.json().message) |
49 |
.do(items => console.log("Crossref Results: total results = "+items['total-results']));
|
|
50 |
.map(request => (parse?this.parse(request.items):request))
|
|
50 | 51 |
//.catch(this.handleError); |
51 | 52 |
|
52 | 53 |
} |
... | ... | |
57 | 58 |
console.log(error); |
58 | 59 |
return Observable.throw(error || 'Server error'); |
59 | 60 |
} |
61 |
parse(response):ClaimResult[]{ |
|
62 |
var results:ClaimResult[] = []; |
|
63 |
for(var i=0; i<response.length; i++){ |
|
64 |
var item=response[i]; |
|
65 |
var result:ClaimResult = new ClaimResult(); |
|
66 |
result.publisher = null; |
|
67 |
result.journal = null; |
|
68 |
result.DOI = item.DOI; |
|
69 |
result.id = item.DOI; |
|
70 |
result.title = item.title; |
|
71 |
result.url = item.URL; |
|
72 |
result.source = 'crossref'; |
|
73 |
result.type = 'publication'; |
|
74 |
if(item['published-print']){ |
|
75 |
result.date = item['published-print']['date-parts'][0]; |
|
76 |
} |
|
77 |
result.accessRights = "OPEN"; |
|
78 |
result.publisher = item.publisher; |
|
79 |
result.journal = null; |
|
80 |
result.result = item; |
|
81 |
if(item.author){ |
|
82 |
for(var j=0; j<item.author.length; j++){ |
|
83 |
result.authors.push(item.author[j].family+", "+item.author[j].given); |
|
84 |
} |
|
85 |
} |
|
86 |
if(item.editor){ |
|
87 |
for(var j=0; j<item.editor.length; j++){ |
|
88 |
result.editors.push(item.editor[j].family+", "+item.editor[j].given); |
|
89 |
} |
|
90 |
} |
|
91 |
results.push(result); |
|
92 |
} |
|
60 | 93 |
|
94 |
return results; |
|
95 |
|
|
96 |
} |
|
97 |
|
|
61 | 98 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/service/searchDatacite.service.ts | ||
---|---|---|
5 | 5 |
import 'rxjs/add/operator/do'; |
6 | 6 |
import 'rxjs/add/operator/share'; |
7 | 7 |
import{EnvProperties} from '../../../utils/properties/env-properties'; |
8 |
import { ClaimResult} from '../claimEntities.class'; |
|
8 | 9 |
|
9 | 10 |
@Injectable() |
10 | 11 |
export class SearchDataciteService { |
11 | 12 |
constructor(private http: Http ) {} |
12 | 13 |
|
13 |
searchDataciteResults (term: string, size : number, page : number, properties:EnvProperties):any { |
|
14 |
searchDataciteResults (term: string, size : number, page : number, properties:EnvProperties, parse:boolean = false):any {
|
|
14 | 15 |
console.info("In search datacite results "+term+ " "+properties.searchDataciteAPIURL); |
15 | 16 |
let url = properties.searchDataciteAPIURL+'?query='+term+'&rows='+size+'&start='+(size*(page-1)); |
16 | 17 |
let key = url; |
17 | 18 |
|
18 | 19 |
return this.http.get( ( properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) |
19 | 20 |
.map(request => <any> request.json()) |
21 |
.map(request => (parse?this.parse(request.data):request)) |
|
20 | 22 |
.do(items => console.info(items)) |
21 |
.do(items => console.log("Datacite Results: total results = "+items.meta.total+" keyword = "+term)); |
|
22 |
//.catch(this.handleError); |
|
23 |
//.catch(this.handleError); |
|
23 | 24 |
} |
24 |
getDataciteResultByDOI (doi: string, properties:EnvProperties):any { |
|
25 |
getDataciteResultByDOI (doi: string, properties:EnvProperties, parse:boolean = false):any {
|
|
25 | 26 |
console.info("Fetch datacite resultt by DOI: "+doi); |
26 | 27 |
let url = properties.searchDataciteAPIURL+'/'+doi; |
27 | 28 |
let key = url; |
28 | 29 |
|
29 | 30 |
return this.http.get( (properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) |
30 | 31 |
.map(request => <any> request.json()) |
32 |
.map(request => (parse?this.parse(request.data):request)) |
|
31 | 33 |
.do(items => console.info(items)); |
34 |
|
|
32 | 35 |
// .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi)) |
33 | 36 |
|
34 | 37 |
//.catch(this.handleError); |
... | ... | |
48 | 51 |
let body = res.json(); |
49 | 52 |
return body.data || { }; |
50 | 53 |
} |
54 |
parse(response):ClaimResult[]{ |
|
55 |
var results:ClaimResult[] = []; |
|
56 |
for(var i=0; i<response.length; i++){ |
|
57 |
var item=response[i]; |
|
58 |
var result:ClaimResult = new ClaimResult(); |
|
59 |
result.publisher = null; |
|
60 |
result.journal = null; |
|
61 |
result.DOI = item.attributes.doi; |
|
62 |
result.id = item.attributes.doi; |
|
63 |
result.title = item.attributes.title; |
|
64 |
result.url = 'http://dx.doi.org/'+item.attributes.doi; |
|
65 |
result.source = 'datacite'; |
|
66 |
result.type = 'dataset'; |
|
67 |
result.date = item.attributes.published; |
|
68 |
result.accessRights = "OPEN"; |
|
69 |
result.publisher =item.attributes['container-title'] |
|
70 |
result.journal = null; |
|
71 |
result.result = item; |
|
72 |
if(item.attributes.author){ |
|
73 |
for(var j=0; j<item.attributes.author.length; j++){ |
|
74 |
var author = item.attributes.author[j]; |
|
75 |
result.authors.push((author.family)?author.family+', '+author.given:author.literal); |
|
76 |
} |
|
77 |
} |
|
78 |
results.push(result); |
|
79 |
} |
|
80 |
|
|
81 |
return results; |
|
82 |
|
|
83 |
} |
|
51 | 84 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/service/searchOrcid.service.ts | ||
---|---|---|
7 | 7 |
import 'rxjs/add/observable/of'; |
8 | 8 |
import 'rxjs/add/operator/do'; |
9 | 9 |
import 'rxjs/add/operator/share'; |
10 |
import { ClaimResult} from '../claimEntities.class'; |
|
10 | 11 |
|
11 | 12 |
@Injectable() |
12 | 13 |
export class SearchOrcidService { |
... | ... | |
48 | 49 |
|
49 | 50 |
} |
50 | 51 |
|
51 |
searchOrcidPublications (id: string, properties:EnvProperties):any { |
|
52 |
searchOrcidPublications (id: string, properties:EnvProperties, parse:boolean = false):any {
|
|
52 | 53 |
console.info("In search Orcid publications for author: "+id); |
53 | 54 |
|
54 | 55 |
var headers = new Headers(); |
... | ... | |
58 | 59 |
let key = url; |
59 | 60 |
|
60 | 61 |
return this.http.get(url, { headers: headers }) |
61 |
.map(res => res.json()['group']); |
|
62 |
.map(res => res.json()['group']) |
|
63 |
.do(res => console.log(res)) |
|
64 |
.map(request => (parse?this.parse(request):request)); |
|
62 | 65 |
//.map(res => res['orcid-work']); |
63 | 66 |
} |
64 | 67 |
|
... | ... | |
125 | 128 |
} |
126 | 129 |
return ret; |
127 | 130 |
} |
131 |
parse(response):ClaimResult[]{ |
|
132 |
var results:ClaimResult[] = []; |
|
133 |
for(var i=0; i<response.length; i++){ |
|
134 |
var item=response[i]; |
|
135 |
var result:ClaimResult = new ClaimResult(); |
|
136 |
result.DOI = null; |
|
137 |
result.url = null; |
|
138 |
result.publisher = null; |
|
139 |
result.journal = null; |
|
140 |
if(item['work-summary'] && item['work-summary'].length > 0){ |
|
141 |
item = item['work-summary'][0]; |
|
142 |
}else{ |
|
143 |
item['work-summary']; |
|
144 |
} |
|
145 |
if(item['external-ids'] && item['external-ids']['external-id']){ |
|
146 |
for(var j =0; j< item['external-ids']['external-id'].length; j++){ |
|
147 |
var id = item['external-ids']['external-id'][j]; |
|
148 |
if(id['external-id-type'] == "doi"){ |
|
149 |
result.DOI = id['external-id-value']; |
|
150 |
result.url = "http://dx.doi.org/" + result.DOI; |
|
151 |
break; |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
result.id = item['put-code']; |
|
156 |
if(item.title && item.title.title){ |
|
157 |
result.title = item['title']['title'].value; |
|
158 |
} |
|
159 |
result.journal = item['journal-title']; |
|
160 |
result.source = 'orcid'; |
|
161 |
result.type = 'publication'; |
|
162 |
if(item['publication-date'] && item['publication-date']['year']){ |
|
163 |
result.date = item['publication-date']['year'].value |
|
164 |
} |
|
165 |
|
|
166 |
result.accessRights = "OPEN"; |
|
167 |
if(item.publisher){ |
|
168 |
result.publisher = item.publisher; |
|
169 |
} |
|
170 |
result.result = item; |
|
171 |
|
|
172 |
results.push(result); |
|
173 |
} |
|
174 |
|
|
175 |
return results; |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
|
|
180 |
|
|
128 | 181 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claimResultSearchForm.component.html | ||
---|---|---|
39 | 39 |
</div> |
40 | 40 |
</div> |
41 | 41 |
<div > |
42 |
<ul *ngIf="crossrefResults.length > 0 " class="uk-list uk-list-divider"> |
|
43 |
<li *ngFor=" let item of crossrefResults " [class]="(isSelected(item.DOI))?'uk-block-muted':''"> |
|
44 |
<div > |
|
45 |
<a *ngIf="item.URL" target="_blank" href="{{item.URL}}" > <span class="custom-external"></span> {{item.title}}</a> |
|
46 |
<span *ngIf="!item.URL" >{{item.title}}</span> |
|
47 |
<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> |
|
48 |
</div> |
|
49 |
<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> |
|
50 |
<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> |
|
51 |
<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> |
|
52 |
</li> |
|
53 |
</ul> |
|
42 |
|
|
43 |
<claim-results [(results)]=crossrefResults [(selectedResults)]=selectedResults > </claim-results> |
|
54 | 44 |
</div> |
55 | 45 |
</div> |
56 | 46 |
</div> |
... | ... | |
66 | 56 |
</div> |
67 | 57 |
</div> |
68 | 58 |
<div > |
69 |
<ul *ngIf="openairePubs.length > 0 " class="uk-list uk-list-divider"> |
|
70 |
<li *ngFor=" let result of openairePubs " [class]="(isSelected(result.id))?'uk-block-muted':''"> |
|
71 |
<div > |
|
72 |
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a> |
|
73 |
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span> |
|
74 |
<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> |
|
75 |
</div> |
|
76 |
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span class="uk-article-meta" *ngIf="(result.year)">({{result.year}})</span> |
|
77 |
<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> |
|
78 |
|
|
79 |
|
|
80 |
</li> |
|
81 |
</ul> |
|
59 |
<claim-results [(results)]=openairePubs [(selectedResults)]=selectedResults > </claim-results> |
|
82 | 60 |
</div> |
83 | 61 |
</div> |
84 | 62 |
</div> |
... | ... | |
103 | 81 |
</select> |
104 | 82 |
</span> |
105 | 83 |
|
106 |
|
|
107 | 84 |
</div> |
108 | 85 |
|
109 |
|
|
110 | 86 |
<div *ngIf=" ((orcidResultsNum >0) && (totalPages > 1) && ( 0 < page && page <= totalPages )) " class="uk-clearfix"> |
111 | 87 |
<div class="uk-float-right"> |
112 | 88 |
<paging-no-load [currentPage]="orcidPage" [totalResults]="orcidResultsNum" [term]="keyword" [size]="size" (pageChange)="orcidPageChange($event)"> </paging-no-load> |
113 | 89 |
</div> |
114 |
|
|
115 | 90 |
</div> |
116 | 91 |
<div > |
117 |
<ul *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " class="uk-list uk-list-divider"> |
|
118 |
<li *ngFor=" let item of orcidResultsToShow " [class]="(isSelected(authorId+'-'+item['work-summary'][0]['put-code']))?'uk-block-muted':''"> |
|
119 |
<div> |
|
120 |
<span *ngIf="!item.URL" >{{item['work-summary'][0]['title']['title'].value}}</span> |
|
121 |
<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> |
|
122 |
</div> |
|
123 |
<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> |
|
124 |
<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}} |
|
125 |
<!--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> |
|
126 |
|
|
127 |
</li> |
|
128 |
</ul> |
|
92 |
<claim-results *ngIf="orcidResultsNum >0 && orcidResultsToShow.length > 0 " [(results)]=orcidResultsToShow [(selectedResults)]=selectedResults > </claim-results> |
|
129 | 93 |
<div *ngIf="orcidResultsNum == 0" class = "uk-alert uk-alert-primary " > No results found </div> |
130 | 94 |
</div> |
131 | 95 |
</div> |
132 | 96 |
</div> |
133 |
</div> |
|
97 |
|
|
134 | 98 |
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade"> |
135 | 99 |
<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> |
136 | 100 |
<div *ngIf="dataciteStatus == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div> |
... | ... | |
143 | 107 |
</div> |
144 | 108 |
</div> |
145 | 109 |
<div > |
146 |
<ul *ngIf="dataciteResults.length > 0 " class="uk-list uk-list-divider"> |
|
147 |
<li *ngFor=" let item of dataciteResults " [class]="(isSelected(item.attributes.doi))?'uk-block-muted':''" > |
|
148 |
<div > |
|
149 |
<a *ngIf="item.attributes.doi" target="_blank" href="{{'http://dx.doi.org/'+item.attributes.doi}}" > <span class="custom-external"></span> {{item.attributes.title}}</a> |
|
150 |
<span *ngIf="!item.attributes.doi" >{{item.attributes.title}}</span> |
|
151 |
<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> |
|
152 |
|
|
153 |
</div> |
|
154 |
<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> |
|
155 |
<div *ngIf="item.attributes.author && item.attributes.author.length > 0" class="uk-article-meta">Authors: |
|
156 |
<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> |
|
157 |
|
|
158 |
</li> |
|
159 |
</ul> |
|
160 |
|
|
110 |
<claim-results *ngIf="dataciteResults.length > 0 " [(results)]=dataciteResults [(selectedResults)]=selectedResults > </claim-results> |
|
161 | 111 |
</div> |
162 | 112 |
</div> |
163 | 113 |
</div> |
... | ... | |
173 | 123 |
</div> |
174 | 124 |
</div> |
175 | 125 |
<div > |
176 |
<ul *ngIf="openaireData.length > 0 " class="uk-list uk-list-divider"> |
|
177 |
<li *ngFor=" let result of openaireData " [class]="(isSelected(result.id))?'uk-block-muted':''"> |
|
178 |
<div > |
|
179 |
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a> |
|
180 |
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span> |
|
181 |
|
|
182 |
|
|
183 |
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)" |
|
184 |
(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> |
|
185 |
<rect x="1" y="9" width="17" height="1"></rect></svg></a> |
|
186 |
</div> |
|
187 |
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span> |
|
188 |
<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> |
|
189 |
|
|
190 |
|
|
191 |
</li> |
|
192 |
</ul> |
|
126 |
<claim-results *ngIf="openaireData.length > 0 " [(results)]=openaireData [(selectedResults)]=selectedResults > </claim-results> |
|
193 | 127 |
</div> |
194 | 128 |
</div> |
195 | 129 |
</div> |
... | ... | |
205 | 139 |
</div> |
206 | 140 |
</div> |
207 | 141 |
<div > |
208 |
<ul *ngIf="openaireSoftware.length > 0 " class="uk-list uk-list-divider"> |
|
209 |
<li *ngFor=" let result of openaireSoftware " [class]="(isSelected(result.id))?'uk-block-muted':''"> |
|
210 |
<div > |
|
211 |
<a *ngIf="result['title'].url" target="_blank" [href]="result['title'].url" >{{result['title'].name}}</a> |
|
212 |
<span *ngIf="!result['title'].url" >{{result['title'].name}}</span> |
|
213 | 142 |
|
214 |
|
|
215 |
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)" |
|
216 |
(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> |
|
217 |
<rect x="1" y="9" width="17" height="1"></rect></svg></a> |
|
218 |
</div> |
|
219 |
<span *ngIf="result.publisher" class="uk-article-meta">Publisher: {{result.publisher}}</span><span *ngIf="(result.year)" class="uk-article-meta">({{result.year}})</span> |
|
220 |
<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> |
|
221 |
|
|
222 |
</li> |
|
223 |
</ul> |
|
143 |
<claim-results *ngIf="openaireSoftware.length > 0 " [(results)]=openaireSoftware [(selectedResults)]=selectedResults > </claim-results> |
|
224 | 144 |
</div> |
225 | 145 |
</div> |
226 | 146 |
</div> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claimEntities.class.ts | ||
---|---|---|
13 | 13 |
public publisher: string; |
14 | 14 |
public description: string; |
15 | 15 |
public resourceType:string; |
16 |
|
|
17 |
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){ |
|
18 |
|
|
19 |
var result: ClaimResult = new ClaimResult(); |
|
20 |
result.id = itemId; |
|
21 |
result.type = itemType; |
|
22 |
result.source = itemSource; |
|
23 |
|
|
24 |
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle; |
|
25 |
result.url = itemUrl; |
|
26 |
result.accessRights = 'OPEN'; |
|
27 |
result.date = date; |
|
28 |
result.result = item; |
|
29 |
if(item.publisher){ |
|
30 |
result.publisher = item.publisher; |
|
31 |
} |
|
32 |
|
|
33 |
if(itemSource == 'datacite'){ |
|
34 |
|
|
35 |
result.publisher = item.attributes['container-title']; |
|
36 |
if(item.attributes.author){ |
|
37 |
result.authors =[] |
|
38 |
for(var i=0; i< item.attributes.author.length; i++){ |
|
39 |
result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date}; |
|
44 |
}else if (itemSource == 'openaire'){ |
|
45 |
//TODO put right access rights |
|
46 |
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date}; |
|
47 |
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date}; |
|
48 |
result.embargoEndDate = accessmode; |
|
49 |
|
|
50 |
}else if(itemSource == 'crossref'){ |
|
51 |
date = (date == null) ? null : date.substring(0,10); |
|
52 |
result.date = date; |
|
53 |
result.resourceType = item.type; |
|
54 |
result.description = item.abstract; |
|
55 |
if(item.author){ |
|
56 |
result.authors =[] |
|
57 |
for(var i=0; i< item.author.length; i++){ |
|
58 |
result.authors.push(item.author[i].family +" "+ item.author[i].given ); |
|
59 |
} |
|
60 |
} |
|
61 |
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date}; |
|
62 |
}else if (itemSource == 'orcid'){ |
|
63 |
date = (date == null) ? null : date + "-01.-01" |
|
64 |
result.date = date; |
|
65 |
if(item['work-type']){ |
|
66 |
result.resourceType = item.type; |
|
67 |
|
|
68 |
} |
|
69 |
if(item.contributors){ |
|
70 |
result.authors =[] |
|
71 |
for(var i=0; i< item.contributors.length; i++){ |
|
72 |
result.authors.push(item.contributors[i]); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
77 |
return result; |
|
78 |
} |
|
16 |
DOI: string; |
|
17 |
editors=[]; |
|
18 |
journal: string; |
|
19 |
|
|
79 | 20 |
} |
80 | 21 |
export class ClaimProject{ |
81 | 22 |
public funderId: string; |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claimResultSearchForm.component.ts | ||
---|---|---|
158 | 158 |
this.crossrefPage=page; |
159 | 159 |
this.crossrefResultsNum = data['total-results']; |
160 | 160 |
if(data.items == 0){ |
161 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( |
|
161 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
|
162 | 162 |
data => { |
163 | 163 |
if(data != null) { |
164 |
this.crossrefResults = data.items;
|
|
164 |
this.crossrefResults = data; |
|
165 | 165 |
this.crossrefPage=page; |
166 |
this.crossrefResultsNum = data['total-results'];
|
|
166 |
this.crossrefResultsNum = data.length;
|
|
167 | 167 |
this.crossrefStatus = this.errorCodes.DONE; |
168 | 168 |
|
169 | 169 |
}else{ |
... | ... | |
182 | 182 |
} |
183 | 183 |
}, |
184 | 184 |
err => { |
185 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( |
|
185 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
|
186 | 186 |
data => { |
187 |
this.crossrefResults = data.items;
|
|
187 |
this.crossrefResults = data; |
|
188 | 188 |
this.crossrefPage=page; |
189 |
this.crossrefResultsNum = data['total-results'];
|
|
189 |
this.crossrefResultsNum = data.length;
|
|
190 | 190 |
this.crossrefStatus = this.errorCodes.DONE; |
191 | 191 |
|
192 | 192 |
}, |
... | ... | |
202 | 202 |
}else{ |
203 | 203 |
|
204 | 204 |
|
205 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( |
|
205 |
this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL, true).subscribe(
|
|
206 | 206 |
data => { |
207 | 207 |
if(data != null) { |
208 |
this.crossrefResults = data.items;
|
|
208 |
this.crossrefResults = data; |
|
209 | 209 |
this.crossrefPage=page; |
210 |
this.crossrefResultsNum = data['total-results'];
|
|
210 |
this.crossrefResultsNum = data.length;
|
|
211 | 211 |
this.crossrefStatus = this.errorCodes.DONE; |
212 | 212 |
|
213 | 213 |
}else{ |
... | ... | |
231 | 231 |
if(data != null) { |
232 | 232 |
this.openairePubsPage=page; |
233 | 233 |
this.openairePubsNum = data[0]; |
234 |
this.openairePubs = data[1];
|
|
234 |
this.openairePubs = this.openaire2ClaimResults(data[1],"publication");
|
|
235 | 235 |
this.openairePubsStatus = this.errorCodes.DONE; |
236 | 236 |
if(this.openairePubsNum == 0){ |
237 | 237 |
this.openairePubsStatus = this.errorCodes.NONE; |
... | ... | |
252 | 252 |
if(data != null) { |
253 | 253 |
this.openairePubsPage=page; |
254 | 254 |
this.openairePubsNum = data[0]; |
255 |
this.openairePubs = data[1];
|
|
255 |
this.openairePubs = this.openaire2ClaimResults(data[1],"publication");
|
|
256 | 256 |
this.openairePubsStatus = this.errorCodes.DONE; |
257 | 257 |
if(this.openairePubsNum == 0){ |
258 | 258 |
this.openairePubsStatus = this.errorCodes.NONE; |
... | ... | |
364 | 364 |
this.authorFamilyName = this.authors[index].authorFamilyName; |
365 | 365 |
this.authorId = this.authors[index].id; |
366 | 366 |
this.orcidStatus = this.errorCodes.LOADING; |
367 |
this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties).subscribe( |
|
367 |
this._searchOrcidService.searchOrcidPublications(this.authors[index].id, this.properties, true).subscribe(
|
|
368 | 368 |
data => { |
369 | 369 |
if(data != null) { |
370 | 370 |
this.orcidResults=data; |
... | ... | |
382 | 382 |
if(this.orcidResultsNum == 0){ |
383 | 383 |
this.orcidStatus = this.errorCodes.NONE; |
384 | 384 |
} |
385 |
for(var i=0;i<this.orcidResults.length; i++){ |
|
386 |
var result = this.orcidResults[i]; |
|
387 |
result['authors'].push(this.authorFamilyName + ', '+this.authorGivenName); |
|
388 |
if(result['DOI'] !=null){ |
|
389 |
this.enhanceInfoFromDOI(result); |
|
390 |
} |
|
391 |
} |
|
385 | 392 |
} else { |
386 | 393 |
this.orcidResultsNum = 0; |
387 | 394 |
this.totalPages=0; |
... | ... | |
397 | 404 |
|
398 | 405 |
|
399 | 406 |
} |
407 |
private enhanceInfoFromDOI(result){ |
|
400 | 408 |
|
409 |
if(result['DOI'] !=null){ |
|
410 |
this._searchCrossrefService.searchCrossrefByDOIs([result['DOI']], this.properties.searchCrossrefAPIURL, true).subscribe( |
|
411 |
data => { |
|
412 |
if(data != null || data.length > 0 ) { |
|
413 |
var crossrefResult = data[0]; |
|
414 |
if(result['title'] == null ||result['title'] == ""){ |
|
415 |
result['title'] = crossrefResult['title']; |
|
416 |
} |
|
417 |
if(crossrefResult['authors'].length > 0){ |
|
418 |
result['authors'] = []; |
|
419 |
for(var i =0; i <crossrefResult['authors'].length; i++ ){ |
|
420 |
result['authors'].push(crossrefResult['authors'][i]); |
|
421 |
} |
|
422 |
} |
|
423 |
if(result['journal'] == null ||result['journal'] == ""){ |
|
424 |
result['journal'] = crossrefResult['journal']; |
|
425 |
} |
|
426 |
if(result['publisher'] == null ||result['publisher'] == ""){ |
|
427 |
result['publisher'] = crossrefResult['publisher']; |
|
428 |
} |
|
429 |
if(result['date'] == null ||result['date'] == ""){ |
|
430 |
result['date'] = crossrefResult['date']; |
|
431 |
} |
|
432 |
|
|
433 |
}else{ |
|
434 |
} |
|
435 |
}, |
|
436 |
err =>{ |
|
437 |
|
|
438 |
} |
|
439 |
|
|
440 |
); |
|
441 |
} |
|
442 |
} |
|
401 | 443 |
/* |
402 | 444 |
Is it USED??? |
403 | 445 |
private remove(item){ |
... | ... | |
453 | 495 |
|
454 | 496 |
} |
455 | 497 |
|
456 |
private isSelected(id:string){ |
|
457 |
|
|
458 |
var found:boolean = false; |
|
459 |
this.warningMessage = ""; |
|
460 |
for (var _i = 0; _i < this.selectedResults.length; _i++) { |
|
461 |
let item = this.selectedResults[_i]; |
|
462 |
if(item.id == id){ |
|
463 |
found=true; |
|
464 |
this.warningMessage = "Publication already in selected list"; |
|
465 |
} |
|
466 |
} |
|
467 |
return found; |
|
468 |
|
|
469 |
|
|
470 |
} |
|
471 |
// isSelected(id:string){ |
|
472 |
// |
|
473 |
// var found:boolean = false; |
|
474 |
// this.warningMessage = ""; |
|
475 |
// for (var _i = 0; _i < this.selectedResults.length; _i++) { |
|
476 |
// let item = this.selectedResults[_i]; |
|
477 |
// if(item.id == id){ |
|
478 |
// found=true; |
|
479 |
// break; |
|
480 |
// } |
|
481 |
// } |
|
482 |
// return found; |
|
483 |
// } |
|
484 | 498 |
private searchDatacite (term: string, size : number, page : number) { |
485 | 499 |
this.getDataciteResults(term,size,page); |
486 | 500 |
this.warningMessage = ""; |
... | ... | |
495 | 509 |
if(data != null) { |
496 | 510 |
this.openaireDataPage=page; |
497 | 511 |
this.openaireDataNum = data[0]; |
498 |
this.openaireData = data[1];
|
|
512 |
this.openaireData = this.openaire2ClaimResults(data[1],"dataset");
|
|
499 | 513 |
this.openaireDataStatus = this.errorCodes.DONE; |
500 | 514 |
if(this.openaireDataNum == 0){ |
501 | 515 |
this.openaireDataStatus = this.errorCodes.NONE; |
... | ... | |
513 | 527 |
if(data != null) { |
514 | 528 |
this.openaireDataPage=page; |
515 | 529 |
this.openaireDataNum = data[0]; |
516 |
this.openaireData = data[1];
|
|
530 |
this.openaireData = this.openaire2ClaimResults(data[1],"dataset");
|
|
517 | 531 |
this.openaireDataStatus = this.errorCodes.DONE; |
518 | 532 |
if(this.openaireDataNum == 0){ |
519 | 533 |
this.openaireDataStatus = this.errorCodes.NONE; |
... | ... | |
538 | 552 |
if(data != null) { |
539 | 553 |
this.openaireSoftwarePage=page; |
540 | 554 |
this.openaireSoftwareNum = data[0]; |
541 |
this.openaireSoftware = data[1];
|
|
555 |
this.openaireSoftware = this.openaire2ClaimResults(data[1],"software");
|
|
542 | 556 |
this.openaireSoftwareStatus = this.errorCodes.DONE; |
543 | 557 |
if(this.openaireSoftwareNum == 0){ |
544 | 558 |
this.openaireSoftwareStatus = this.errorCodes.NONE; |
... | ... | |
556 | 570 |
if(data != null) { |
557 | 571 |
this.openaireSoftwarePage=page; |
558 | 572 |
this.openaireSoftwareNum = data[0]; |
559 |
this.openaireSoftware = data[1]; |
|
573 |
this.openaireSoftware = this.openaire2ClaimResults(data[1],"software"); |
|
574 |
|
|
560 | 575 |
this.openaireSoftwareStatus = this.errorCodes.DONE; |
561 | 576 |
if(this.openaireSoftwareNum == 0){ |
562 | 577 |
this.openaireSoftwareStatus = this.errorCodes.NONE; |
... | ... | |
573 | 588 |
this.infoMessage = ""; |
574 | 589 |
|
575 | 590 |
} |
591 |
|
|
592 |
private openaire2ClaimResults(data,type):ClaimResult[]{ |
|
593 |
var claimResults = []; |
|
594 |
for(var i=0; i< data.length; i++){ |
|
595 |
var item = data[i]; |
|
596 |
var result: ClaimResult = new ClaimResult(); |
|
597 |
result.publisher = null; |
|
598 |
result.journal = null; |
|
599 |
result.DOI = null; |
|
600 |
result.id = item.id; |
|
601 |
result.title = item.title.name; |
|
602 |
result.url = item.title.url; |
|
603 |
result.source = "openaire"; |
|
604 |
result.date = item.year; |
|
605 |
result.accessRights = item.title.accessMode; |
|
606 |
console.log(item); |
|
607 |
result.type = type; |
|
608 |
|
|
609 |
result.publisher = item.publisher; |
|
610 |
result.result = item; |
|
611 |
if(item.authors){ |
|
612 |
for(var j=0; j<item.authors.length; j++){ |
|
613 |
result.authors.push(item.authors[j]); |
|
614 |
} |
|
615 |
} |
|
616 |
|
|
617 |
claimResults.push(result); |
|
618 |
} |
|
619 |
return claimResults; |
|
620 |
|
|
621 |
} |
|
576 | 622 |
private getDataciteResults (term: string, size : number, page : number) { |
577 | 623 |
console.log("getDataciteResults + "+this.properties.searchDataciteAPIURL) |
578 |
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties).subscribe( |
|
624 |
this._searchDataciteService.searchDataciteResults(term, size, page, this.properties, true).subscribe(
|
|
579 | 625 |
data => { |
580 |
this.dataciteResults = data.data;
|
|
626 |
this.dataciteResults = data; |
|
581 | 627 |
this.datacitePage=page; |
582 |
this.dataciteResultsNum = data.meta.total;
|
|
628 |
this.dataciteResultsNum = data.length;
|
|
583 | 629 |
this.dataciteStatus = this.errorCodes.DONE; |
584 | 630 |
|
585 | 631 |
|
... | ... | |
592 | 638 |
); |
593 | 639 |
} |
594 | 640 |
|
595 |
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){ |
|
596 |
|
|
597 |
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle); |
|
598 |
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode); |
|
599 |
|
|
600 |
|
|
601 |
if (itemSource == 'orcid'){ |
|
602 |
if(result.authors.length ==0 ){ |
|
603 |
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName); |
|
604 |
} |
|
605 |
} |
|
606 |
var found:boolean = this.isSelected( result.id); |
|
607 |
|
|
608 |
this.warningMessage = ""; |
|
609 |
if (!found) { |
|
610 |
this.selectedResults.push(result); |
|
611 |
|
|
612 |
UIkit.notification({ |
|
613 |
message : 'A new research result is selected.', |
|
614 |
status : 'primary', |
|
615 |
timeout : 1000, |
|
616 |
pos : 'top-center' |
|
617 |
}); |
|
618 |
|
|
619 |
|
|
620 |
}else{ |
|
621 |
this.warningMessage = "Research Data already in selected list"; |
|
622 |
UIkit.notification({ |
|
623 |
message : 'The research result is already on your list.', |
|
624 |
status : 'warning', |
|
625 |
timeout : 1000, |
|
626 |
pos : 'top-center' |
|
627 |
}); |
|
628 |
} |
|
629 |
|
|
630 |
} |
|
631 |
|
|
632 | 641 |
public searchSourceChanged(source){ |
633 | 642 |
this.searchSource = source; |
634 | 643 |
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source; |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claimResultSearchForm.module.ts | ||
---|---|---|
3 | 3 |
import { SharedModule } from '../../shared/shared.module'; |
4 | 4 |
import { CommonModule } from '@angular/common'; |
5 | 5 |
import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component'; |
6 |
import {ClaimResultsComponent} from './claimResults.component'; |
|
6 | 7 |
|
7 | 8 |
import {SearchDataciteServiceModule} from './service/searchDataciteService.module'; |
8 | 9 |
|
... | ... | |
22 | 23 |
SearchOrcidService |
23 | 24 |
], |
24 | 25 |
declarations: [ |
25 |
ClaimResultSearchFormComponent |
|
26 |
ClaimResultSearchFormComponent, ClaimResultsComponent
|
|
26 | 27 |
|
27 | 28 |
], |
28 |
exports: [ClaimResultSearchFormComponent ] |
|
29 |
exports: [ClaimResultSearchFormComponent, ClaimResultsComponent ]
|
|
29 | 30 |
}) |
30 | 31 |
export class ClaimResultSearchFormModule { } |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claim.ts | ||
---|---|---|
13 | 13 |
export class Project{ |
14 | 14 |
|
15 | 15 |
} |
16 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/claim-utils/claimResults.component.ts | ||
---|---|---|
1 |
import {Component, Input, Output, EventEmitter} from '@angular/core'; |
|
2 |
import { ActivatedRoute } from '@angular/router'; |
|
3 |
|
|
4 |
import {ClaimResult} from '../claim-utils/claimEntities.class'; |
|
5 |
|
|
6 |
declare var UIkit:any; |
|
7 |
|
|
8 |
@Component({ |
|
9 |
selector: 'claim-results', |
|
10 |
template:` |
|
11 |
|
|
12 |
<ul *ngIf="results.length > 0 " class="uk-list uk-list-divider"> |
|
13 |
<li *ngFor=" let result of results " [class]="(isSelected(result.id))?'uk-block-muted':''"> |
|
14 |
<div > |
|
15 |
<a *ngIf="result.url" target="_blank" [href]="result.url" >{{result.title?result.title:'[No title available]'}}</a> |
|
16 |
<span *ngIf="!result.url" >{{result.title?result.title:'[No title available]'}}</span> |
|
17 |
<a class="uk-button-default uk-align-right" *ngIf="!isSelected(result.id)" |
|
18 |
(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> |
|
19 |
<rect x="1" y="9" width="17" height="1"></rect></svg></a> |
|
20 |
</div> |
|
21 |
<span *ngIf="result.publisher!=null" class="uk-article-meta">Publisher: {{result.publisher}}</span> |
|
22 |
<span *ngIf="result.journal!=null" class="uk-article-meta">Journal: {{result.journal}}</span><span *ngIf="(result.date)" class="uk-article-meta"> ({{result.date}})</span> |
|
23 |
<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> |
|
24 |
<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> |
|
25 |
</li>`, |
|
26 |
|
|
27 |
}) |
|
28 |
export class ClaimResultsComponent { |
|
29 |
@Input() results; |
|
30 |
@Input() selectedResults; |
|
31 |
private isSelected(id:string){ |
|
32 |
|
|
33 |
var found:boolean = false; |
|
34 |
for (var _i = 0; _i < this.selectedResults.length; _i++) { |
|
35 |
let item = this.selectedResults[_i]; |
|
36 |
if(item.id == id){ |
|
37 |
found=true; |
|
38 |
} |
|
39 |
} |
|
40 |
return found; |
|
41 |
|
|
42 |
|
|
43 |
} |
|
44 |
add(item){ |
|
45 |
var found:boolean = this.isSelected( item.id); |
|
46 |
if (!found) { |
|
47 |
this.selectedResults.push(item); |
|
48 |
|
|
49 |
UIkit.notification({ |
|
50 |
message : 'A new research result is selected.', |
|
51 |
status : 'primary', |
|
52 |
timeout : 1000, |
|
53 |
pos : 'top-center' |
|
54 |
}); |
|
55 |
|
|
56 |
}else{ |
|
57 |
UIkit.notification({ |
|
58 |
message : 'The research result is already on your list.', |
|
59 |
status : 'warning', |
|
60 |
timeout : 1000, |
|
61 |
pos : 'top-center' |
|
62 |
}); |
|
63 |
} |
|
64 |
|
|
65 |
} |
|
66 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/linking/bulkClaim/bulkClaim.component.ts | ||
---|---|---|
175 | 175 |
} |
176 | 176 |
|
177 | 177 |
fetchResult(id:string,accessMode:string,date:string){ |
178 |
this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties.searchCrossrefAPIURL).subscribe( |
|
178 |
this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties.searchCrossrefAPIURL, true).subscribe(
|
|
179 | 179 |
data => { |
180 | 180 |
|
181 |
var crossrefResult = data.items[0];
|
|
182 |
if(data.items.length > 0){
|
|
181 |
var result = data[0];
|
|
182 |
if(data.length > 0){ |
|
183 | 183 |
this.foundIds.push(id); |
184 |
var result: ClaimResult = ClaimResult.generateResult(crossrefResult, id,"crossref","publication", crossrefResult.URL, crossrefResult.title, crossrefResult.created['date-time'], accessMode); |
|
185 | 184 |
result.embargoEndDate = date; |
186 | 185 |
this.results.push(result); |
187 | 186 |
this.endOfFetching(); |
... | ... | |
198 | 197 |
); |
199 | 198 |
} |
200 | 199 |
searchInDatacite(id:string,accessMode:string,date:string){ |
201 |
this._searchDataciteService.getDataciteResultByDOI(id,this.properties).subscribe( |
|
202 |
item => { |
|
203 |
var dataciteResult = item.data; |
|
200 |
this._searchDataciteService.getDataciteResultByDOI(id,this.properties,true).subscribe( |
|
201 |
items => { |
|
204 | 202 |
|
205 |
if(dataciteResult != null && dataciteResult.attributes!= null ){ |
|
203 |
if(items.length > 0){ |
|
204 |
var result = items[0]; |
|
206 | 205 |
|
207 | 206 |
this.foundIds.push(id); |
208 |
var result: ClaimResult = ClaimResult.generateResult(dataciteResult, id,"datacite","dataset", 'http://dx.doi.org/'+dataciteResult.attributes.doi, dataciteResult.attributes.title, dataciteResult.attributes.published, accessMode); |
|
209 | 207 |
result.embargoEndDate = date; |
210 | 208 |
this.results.push(result); |
211 | 209 |
}else{ |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/claims/linking/selected/selectedResults.component.ts | ||
---|---|---|
36 | 36 |
</div> |
37 | 37 |
|
38 | 38 |
<span *ngIf="pub.publisher" >Publisher: {{pub.publisher}}</span> |
39 |
<!--Orcid --><span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " >Journal: {{pub.result['journal-title'].value}}</span>
|
|
40 |
<span *ngIf="pub.date" >({{pub.date.substring(0,4)}})</span>
|
|
39 |
<span *ngIf="pub.journal " >Journal: {{pub.journal}}</span>
|
|
40 |
<span *ngIf="pub.date" >({{pub.date}})</span> |
|
41 | 41 |
|
42 | 42 |
<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> |
43 | 43 |
|
44 |
<!-- Crossref --> |
|
45 |
<!--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> |
|
46 |
<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--> |
|
47 |
<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> |
|
44 |
<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> |
|
48 | 45 |
|
49 |
<!-- Openaire --> |
|
50 |
<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> |
|
51 | 46 |
|
52 |
<!-- Orcid --> |
|
53 |
|
|
54 |
<!--span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span> |
|
55 |
<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--> |
|
56 |
<!-- Datacite --> |
|
57 |
<!--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> |
|
58 |
<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--> |
|
59 | 47 |
<div><span class="uk-label label-grey">{{pub.source}}</span> |
60 | 48 |
<span *ngIf="pub.accessRights" [class]=" 'uk-label label-'+pub.accessRights" > {{pub.accessRights}}</span> |
61 | 49 |
<span *ngIf="pub.type" [class]="'uk-label label-'+pub.type" > {{pub.type}}</span> |
Also available in: Unified diff
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