1 |
58240
|
k.triantaf
|
import {SearchResult} from "../entities/searchResult";
|
2 |
|
|
import {ResultLandingInfo} from "../entities/resultLandingInfo";
|
3 |
58169
|
k.triantaf
|
import {OrganizationInfo} from "../entities/organizationInfo";
|
4 |
58118
|
k.triantaf
|
|
5 |
58240
|
k.triantaf
|
export interface HostedByCollectedFrom {
|
6 |
|
|
downloadName: string;
|
7 |
|
|
downloadUrl: string[];
|
8 |
|
|
collectedName: string;
|
9 |
|
|
collectedId: string;
|
10 |
|
|
accessMode: string[];
|
11 |
|
|
bestAccessMode: string;
|
12 |
|
|
type: string;
|
13 |
|
|
year: string;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
export interface Journal {
|
17 |
|
|
journal?: string;
|
18 |
|
|
issn?: string;
|
19 |
|
|
lissn: string;
|
20 |
|
|
eissn?: string;
|
21 |
|
|
issue?: string;
|
22 |
|
|
volume?: string;
|
23 |
|
|
start_page?: string;
|
24 |
|
|
end_page?: string;
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
export interface RelationResult {
|
28 |
|
|
name: string;
|
29 |
|
|
id: string;
|
30 |
|
|
date: string;
|
31 |
|
|
percentage: number;
|
32 |
|
|
class: string
|
33 |
|
|
provenanceAction?: string;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
export interface Project {
|
37 |
|
|
id: string;
|
38 |
|
|
acronym: string;
|
39 |
|
|
title: string;
|
40 |
|
|
funderShortname: string;
|
41 |
|
|
funderName: string;
|
42 |
|
|
funding?: string;
|
43 |
|
|
code: string;
|
44 |
|
|
budget?: string;
|
45 |
|
|
contribution?: string;
|
46 |
|
|
currency?: string;
|
47 |
|
|
provenanceAction?: string;
|
48 |
|
|
inline?: boolean
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
export interface Author {
|
52 |
|
|
fullName: string;
|
53 |
|
|
orcid: string;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
export interface ResultTitle {
|
57 |
|
|
name: string;
|
58 |
|
|
accessMode: string;
|
59 |
|
|
sc39: string;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
export interface Organization {
|
63 |
|
|
id: string;
|
64 |
|
|
name: string;
|
65 |
|
|
shortname?: string;
|
66 |
|
|
websiteUrl?: string;
|
67 |
|
|
country?: string;
|
68 |
|
|
trust?: number;
|
69 |
|
|
}
|
70 |
|
|
|
71 |
58118
|
k.triantaf
|
export class ResultPreview {
|
72 |
|
|
id: string;
|
73 |
|
|
title: string;
|
74 |
|
|
accessMode: string;
|
75 |
|
|
sc39: string;
|
76 |
|
|
countries: string[];
|
77 |
58413
|
argiro.kok
|
|
78 |
|
|
//Impact factor
|
79 |
|
|
DOI:string;
|
80 |
|
|
pop_inf
|
81 |
58118
|
k.triantaf
|
//publications & datasets & orp & software & organizations:
|
82 |
|
|
projects: Project[];
|
83 |
|
|
|
84 |
|
|
//datasets & orp & publications & software
|
85 |
|
|
description: string;
|
86 |
|
|
year: string;
|
87 |
|
|
embargoEndDate: Date | string;
|
88 |
|
|
authors: Author[];
|
89 |
|
|
languages: string[];
|
90 |
|
|
identifiers: Map<string, string[]>; //key is the classname
|
91 |
|
|
hostedBy_collectedFrom: HostedByCollectedFrom[];
|
92 |
|
|
|
93 |
|
|
//datasets & orp & software:
|
94 |
|
|
publisher: string;
|
95 |
|
|
|
96 |
|
|
//software
|
97 |
|
|
programmingLanguages: string[];
|
98 |
|
|
|
99 |
|
|
//dataproviders & projects:
|
100 |
|
|
organizations: Organization[];
|
101 |
|
|
|
102 |
|
|
//projects:
|
103 |
|
|
acronym: string;
|
104 |
|
|
code: string;
|
105 |
|
|
funderShortname: string;
|
106 |
58202
|
konstantin
|
budget: string;
|
107 |
|
|
contribution: string;
|
108 |
|
|
currency: string;
|
109 |
58118
|
k.triantaf
|
startYear: number;
|
110 |
|
|
endYear: number;
|
111 |
|
|
openAccessMandatePublications: boolean;
|
112 |
|
|
openAccessMandateDatasets: boolean;
|
113 |
|
|
|
114 |
|
|
//organizations:
|
115 |
|
|
country: string;
|
116 |
|
|
|
117 |
|
|
//dataproviders:
|
118 |
|
|
englishname: string;
|
119 |
|
|
websiteURL: string;
|
120 |
|
|
OAIPMHURL: string;
|
121 |
|
|
compatibility: string;
|
122 |
|
|
compatibilityUNKNOWN: boolean;
|
123 |
|
|
subjects: string[];
|
124 |
|
|
|
125 |
|
|
resultType: string;
|
126 |
|
|
types: string[];
|
127 |
|
|
|
128 |
58144
|
k.triantaf
|
// Relation result
|
129 |
|
|
relation: string;
|
130 |
|
|
percentage: number;
|
131 |
|
|
provenanceAction: string;
|
132 |
|
|
|
133 |
58136
|
k.triantaf
|
public static searchResultConvert(result: SearchResult, type: string): ResultPreview {
|
134 |
58118
|
k.triantaf
|
let resultPreview: ResultPreview = new ResultPreview();
|
135 |
|
|
resultPreview.id = result.id;
|
136 |
|
|
resultPreview.title = result.title.name;
|
137 |
|
|
resultPreview.accessMode = result.title.accessMode;
|
138 |
|
|
resultPreview.sc39 = result.title.sc39;
|
139 |
|
|
if(result.countriesForResults) {
|
140 |
|
|
resultPreview.countries = result.countries;
|
141 |
|
|
} else if(result.country) {
|
142 |
|
|
resultPreview.countries = [result.country];
|
143 |
|
|
} else {
|
144 |
|
|
resultPreview.countries = result.countries;
|
145 |
|
|
}
|
146 |
|
|
resultPreview.projects = result.projects;
|
147 |
|
|
resultPreview.description = result.description;
|
148 |
|
|
resultPreview.year = result.year;
|
149 |
|
|
resultPreview.embargoEndDate = result.embargoEndDate;
|
150 |
|
|
resultPreview.authors = result.authors;
|
151 |
|
|
resultPreview.languages = result.languages;
|
152 |
|
|
resultPreview.publisher = result.publisher;
|
153 |
|
|
resultPreview.programmingLanguages = result.programmingLanguages;
|
154 |
|
|
resultPreview.organizations = result.organizations;
|
155 |
|
|
resultPreview.acronym = result.acronym;
|
156 |
|
|
resultPreview.code = result.code;
|
157 |
|
|
resultPreview.funderShortname = result.funderShortname;
|
158 |
58202
|
konstantin
|
resultPreview.budget = result.budget;
|
159 |
|
|
resultPreview.contribution = result.contribution;
|
160 |
|
|
resultPreview.currency = result.currency;
|
161 |
58118
|
k.triantaf
|
resultPreview.startYear = result.startYear;
|
162 |
|
|
resultPreview.endYear = result.endYear;
|
163 |
|
|
resultPreview.openAccessMandatePublications = result.openAccessMandatePublications;
|
164 |
|
|
resultPreview.openAccessMandateDatasets = result.openAccessMandateDatasets;
|
165 |
|
|
resultPreview.englishname = result.englishname;
|
166 |
|
|
if(result.type) {
|
167 |
|
|
resultPreview.types = [result.type];
|
168 |
|
|
} else {
|
169 |
|
|
resultPreview.types = result.types;
|
170 |
|
|
}
|
171 |
|
|
resultPreview.websiteURL = result.websiteURL;
|
172 |
|
|
resultPreview.OAIPMHURL = result.OAIPMHURL;
|
173 |
|
|
resultPreview.compatibility = result.compatibility;
|
174 |
|
|
resultPreview.compatibilityUNKNOWN = result.compatibilityUNKNOWN;
|
175 |
|
|
resultPreview.subjects = result.subjects;
|
176 |
|
|
resultPreview.resultType = type;
|
177 |
58413
|
argiro.kok
|
//impact factor;
|
178 |
|
|
resultPreview.DOI=result.DOI;
|
179 |
58118
|
k.triantaf
|
return resultPreview;
|
180 |
|
|
}
|
181 |
58125
|
k.triantaf
|
|
182 |
58136
|
k.triantaf
|
public static resultLandingInfoConvert(result: ResultLandingInfo, type: string): ResultPreview {
|
183 |
58125
|
k.triantaf
|
let resultPreview: ResultPreview = new ResultPreview();
|
184 |
|
|
resultPreview.title = result.title;
|
185 |
|
|
resultPreview.accessMode = result.accessMode;
|
186 |
|
|
resultPreview.countries = result.countries;
|
187 |
|
|
resultPreview.projects = result.fundedByProjects;
|
188 |
|
|
resultPreview.description = result.description;
|
189 |
58136
|
k.triantaf
|
if(result.dateofacceptance) {
|
190 |
|
|
resultPreview.year = new Date(result.dateofacceptance).getFullYear().toString();
|
191 |
|
|
}
|
192 |
58125
|
k.triantaf
|
resultPreview.embargoEndDate = result.embargoEndDate;
|
193 |
|
|
resultPreview.authors = result.authors;
|
194 |
|
|
resultPreview.languages = result.languages;
|
195 |
|
|
resultPreview.publisher = result.publisher;
|
196 |
|
|
resultPreview.programmingLanguages = result.programmingLanguages;
|
197 |
|
|
resultPreview.organizations = result.organizations;
|
198 |
|
|
resultPreview.types = result.types;
|
199 |
|
|
resultPreview.subjects = result.subjects;
|
200 |
|
|
resultPreview.resultType = type;
|
201 |
|
|
resultPreview.identifiers = result.identifiers;
|
202 |
|
|
resultPreview.hostedBy_collectedFrom = result.hostedBy_collectedFrom;
|
203 |
|
|
return resultPreview;
|
204 |
|
|
}
|
205 |
58144
|
k.triantaf
|
|
206 |
|
|
public static relationResultConvert(result: RelationResult, relation: string = 'trust'): ResultPreview {
|
207 |
|
|
let resultPreview: ResultPreview = new ResultPreview();
|
208 |
|
|
resultPreview.id = result.id;
|
209 |
|
|
resultPreview.title = result.name;
|
210 |
|
|
resultPreview.resultType = result.class;
|
211 |
|
|
if(result.date) {
|
212 |
|
|
resultPreview.year = result.date.toString();
|
213 |
|
|
}
|
214 |
|
|
resultPreview.relation = relation;
|
215 |
|
|
resultPreview.percentage = result.percentage;
|
216 |
|
|
resultPreview.provenanceAction = result.provenanceAction;
|
217 |
|
|
return resultPreview;
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
public static organizationConvert(result: Organization, relation: string = 'trust'): ResultPreview {
|
221 |
|
|
let resultPreview: ResultPreview = new ResultPreview();
|
222 |
|
|
resultPreview.id = result.id;
|
223 |
|
|
if(result.name) {
|
224 |
|
|
resultPreview.title = result.name;
|
225 |
|
|
if(result.shortname) {
|
226 |
|
|
resultPreview.title += ' (' + result.shortname + ')';
|
227 |
|
|
}
|
228 |
|
|
} else if(result.shortname) {
|
229 |
|
|
resultPreview.title = result.shortname;
|
230 |
|
|
}
|
231 |
58169
|
k.triantaf
|
if(result.country) {
|
232 |
|
|
resultPreview.countries = [result.country];
|
233 |
|
|
}
|
234 |
58144
|
k.triantaf
|
resultPreview.relation = relation;
|
235 |
|
|
resultPreview.percentage = result.trust;
|
236 |
|
|
resultPreview.websiteURL = result.websiteUrl;
|
237 |
|
|
resultPreview.resultType = 'organization';
|
238 |
|
|
return resultPreview;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
58169
|
k.triantaf
|
public static organizationInfoConvert(result: OrganizationInfo): ResultPreview {
|
242 |
|
|
let resultPreview: ResultPreview = new ResultPreview();
|
243 |
|
|
if(result.title && result.title.name) {
|
244 |
|
|
resultPreview.title = result.title.name;
|
245 |
|
|
if(result.name) {
|
246 |
|
|
resultPreview.title += ' (' + result.name + ')';
|
247 |
|
|
}
|
248 |
|
|
} else if(result.name) {
|
249 |
|
|
resultPreview.title = result.name;
|
250 |
|
|
}
|
251 |
|
|
if(result.country) {
|
252 |
|
|
resultPreview.countries = [result.country];
|
253 |
|
|
}
|
254 |
|
|
if(result.title && result.title.url) {
|
255 |
|
|
resultPreview.websiteURL = result.title.url;
|
256 |
|
|
}
|
257 |
|
|
resultPreview.resultType = 'organization';
|
258 |
|
|
return resultPreview;
|
259 |
|
|
}
|
260 |
|
|
|
261 |
58240
|
k.triantaf
|
}
|