Revision 57330
Added by Konstantina Galouni about 5 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/landing-utils/parsingFunctions.class.ts | ||
---|---|---|
10 | 10 |
"funding": string, "code": string, |
11 | 11 |
"provenanceAction": string, "inline": boolean |
12 | 12 |
}[], |
13 |
relation: any, projectsProvenanceVocabulary: any):
|
|
13 |
relation: any, provenanceActionVocabulary: any):
|
|
14 | 14 |
{ "id": string, "acronym": string, "title": string, |
15 | 15 |
"funderShortname": string, "funderName": string, |
16 | 16 |
"funding": string, "code": string, |
... | ... | |
39 | 39 |
fundedByProject['title'] = relation.title; |
40 | 40 |
fundedByProject['code'] = relation.code; |
41 | 41 |
|
42 |
if(relation.provenanceaction in projectsProvenanceVocabulary) {
|
|
43 |
fundedByProject['provenanceAction'] = projectsProvenanceVocabulary[relation.provenanceaction];
|
|
42 |
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
|
|
43 |
fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction];
|
|
44 | 44 |
} |
45 | 45 |
} else { |
46 | 46 |
fundedByProject['id'] = ""; |
... | ... | |
535 | 535 |
contexts[position]['labelCategory'] = category.label; |
536 | 536 |
contexts[position]['labelConcept'] = null; |
537 | 537 |
position++; |
538 |
console.info(contexts); |
|
539 | 538 |
} |
540 | 539 |
} |
541 | 540 |
} else { |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/landing-utils/fundedBy.component.ts | ||
---|---|---|
79 | 79 |
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string, |
80 | 80 |
"funderShortname": string, "funderName": string, |
81 | 81 |
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) { |
82 |
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small'>"; |
|
82 |
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small uk-light'>";
|
|
83 | 83 |
|
84 | 84 |
if(item.title) { |
85 |
tooltipContent += "<h5>"+item.title+"</h5>";
|
|
85 |
tooltipContent += "<p class='uk-h5'>"+item.title+"</p>";
|
|
86 | 86 |
} |
87 | 87 |
|
88 | 88 |
if(item.code || item.funderName || item.funderShortname || item.funding) { |
... | ... | |
111 | 111 |
if(item.code || item.funderName || item.funderShortname || item.funding) { |
112 | 112 |
tooltipContent += "</p>"; |
113 | 113 |
} |
114 |
tooltipContent += "<span class='uk-text-meta'>"; |
|
115 |
if(item.provenanceAction == 'Repository') { |
|
116 |
tooltipContent += "Link provided by Repository"; |
|
117 |
} else if(item.provenanceAction == 'OpenAIRE') { |
|
118 |
tooltipContent += "Link inferred by OpenAIRE"; |
|
119 |
} else if(item.provenanceAction == 'USer') { |
|
120 |
tooltipContent += "Link claimed by User"; |
|
121 |
} |
|
114 |
tooltipContent += "<span class='uk-text-small'>"; |
|
115 |
tooltipContent += item.provenanceAction; |
|
122 | 116 |
tooltipContent += "</span>"; |
123 |
tooltipContent+="</div>" |
|
117 |
tooltipContent+="</div>"; |
|
118 |
|
|
124 | 119 |
return tooltipContent; |
125 | 120 |
} |
126 | 121 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/result/resultLanding.service.ts | ||
---|---|---|
4 | 4 |
import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo'; |
5 | 5 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
6 | 6 |
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class'; |
7 |
import {map} from "rxjs/operators"; |
|
7 |
import {map, tap} from "rxjs/operators";
|
|
8 | 8 |
|
9 | 9 |
@Injectable() |
10 | 10 |
export class ResultLandingService { |
... | ... | |
16 | 16 |
public parsingFunctions: ParsingFunctions; |
17 | 17 |
resultLandingInfo: ResultLandingInfo; |
18 | 18 |
|
19 |
getResultLandingInfo (id: string, type: string, properties: EnvProperties): any { |
|
19 |
getResultLandingInfo (id: string, type: string, provenanceActionVocabulary: any, properties: EnvProperties): any {
|
|
20 | 20 |
let url = properties.searchAPIURLLAst; |
21 | 21 |
if (type === 'publication') { |
22 | 22 |
url += 'publications/'; |
... | ... | |
50 | 50 |
res[0], // 13 |
51 | 51 |
res[2] // 14 |
52 | 52 |
])) |
53 |
.pipe(map(res => this.parseResultLandingInfo(res, properties))); |
|
53 |
.pipe(map(res => this.parseResultLandingInfo(res, provenanceActionVocabulary, properties)));
|
|
54 | 54 |
} |
55 | 55 |
|
56 |
getProvenanceActionVocabulary (properties: EnvProperties): any { |
|
57 |
let url = properties.vocabulariesAPI+"dnet:provenanceActions.json"; |
|
58 |
|
|
59 |
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) |
|
60 |
.pipe(map(res => res['terms'])) |
|
61 |
.pipe(map(res => this.parseProvenanceActionVocabulary(res, properties))); |
|
62 |
} |
|
63 |
|
|
64 |
parseProvenanceActionVocabulary(terms: any, properties: EnvProperties) { |
|
65 |
var provenanceActionVocabulary: {} = {}; |
|
66 |
for(let term of terms) { |
|
67 |
provenanceActionVocabulary[term.code] = term.englishName; |
|
68 |
} |
|
69 |
return provenanceActionVocabulary; |
|
70 |
} |
|
71 |
|
|
56 | 72 |
private handleError (error: HttpErrorResponse) { |
57 | 73 |
// in a real world app, we may send the error to some remote logging infrastructure |
58 | 74 |
// instead of just logging it to the console |
... | ... | |
60 | 76 |
return throwError(error || 'Server error'); |
61 | 77 |
} |
62 | 78 |
|
63 |
parseResultLandingInfo (data: any, properties: EnvProperties): any { |
|
79 |
parseResultLandingInfo (data: any, provenanceActionVocabulary: any, properties: EnvProperties): any {
|
|
64 | 80 |
this.resultLandingInfo = new ResultLandingInfo(); |
65 | 81 |
|
66 | 82 |
// res |
... | ... | |
105 | 121 |
relation = Array.isArray(data[2]) ? data[2][i] : data[2]; |
106 | 122 |
if(relation.hasOwnProperty("to")) { |
107 | 123 |
if(relation['to'].class == "isProducedBy") { |
108 |
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, this.resultLandingInfo.projectsProvenanceVocabulary);
|
|
124 |
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary);
|
|
109 | 125 |
} else if(relation['to'].class == "isRelatedTo") { |
110 |
let provenanceAction: string; |
|
111 |
if(relation.provenanceaction in this.resultLandingInfo.researchResultsProvenanceVocabulary) { |
|
112 |
provenanceAction = this.resultLandingInfo.researchResultsProvenanceVocabulary[relation.provenanceaction]; |
|
113 |
} else { |
|
114 |
provenanceAction = "Other"; |
|
126 |
let provenanceAction: string = ""; |
|
127 |
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { |
|
128 |
provenanceAction = provenanceActionVocabulary[relation.provenanceaction]; |
|
115 | 129 |
} |
116 | 130 |
|
117 | 131 |
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction); |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/result/resultLanding.component.ts | ||
---|---|---|
134 | 134 |
this.metricsClicked = false; |
135 | 135 |
|
136 | 136 |
if (this.id) { |
137 |
this.getResultLandingInfo(this.id);
|
|
137 |
this.getProvenanceVocabularyAndResultLandingInfo();
|
|
138 | 138 |
} else { |
139 | 139 |
this.showLoading = false; |
140 | 140 |
|
... | ... | |
192 | 192 |
); |
193 | 193 |
} |
194 | 194 |
|
195 |
private getResultLandingInfo(id: string) {
|
|
195 |
private getProvenanceVocabularyAndResultLandingInfo() {
|
|
196 | 196 |
this.warningMessage = ''; |
197 | 197 |
this.errorMessage = ''; |
198 | 198 |
this.showLoading = true; |
199 | 199 |
|
200 | 200 |
this.resultLandingInfo = null; |
201 | 201 |
|
202 |
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, this.properties).subscribe( |
|
202 |
this._resultLaningService.getProvenanceActionVocabulary(this.properties).subscribe( |
|
203 |
provenanceActionVocabulary => { |
|
204 |
this.getResultLandingInfo(provenanceActionVocabulary); |
|
205 |
}, err => { |
|
206 |
this.getResultLandingInfo(null); |
|
207 |
this.handleError("Error getting provenance action vocabulary for "+this.type+" with id: " + this.id, err); |
|
208 |
} |
|
209 |
); |
|
210 |
|
|
211 |
} |
|
212 |
|
|
213 |
private getResultLandingInfo(provenanceActionVocabulary: any) { |
|
214 |
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe( |
|
203 | 215 |
data => { |
204 | 216 |
this.resultLandingInfo = data; |
205 | 217 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]); |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entities/resultLandingInfo.ts | ||
---|---|---|
20 | 20 |
"accessMode": string[], "bestAccessMode": string, |
21 | 21 |
"type": string, "year":string}[]; |
22 | 22 |
|
23 |
projectsProvenanceVocabulary: { "sysimport:crosswalk:repository": string, |
|
24 |
"sysimport:crosswalk:entityregistry": string, |
|
25 |
"sysimport:crosswalk:datasetarchive": string, |
|
26 |
"iis": string, |
|
27 |
"sysimport:mining:repository": string, |
|
28 |
"user:claim:pid": string, |
|
29 |
"user:claim:search": string, |
|
30 |
"user:claim:datacite": string |
|
31 |
} = { |
|
32 |
"sysimport:crosswalk:repository": "Repository", |
|
33 |
"sysimport:crosswalk:entityregistry": "Repository", |
|
34 |
"sysimport:crosswalk:datasetarchive": "Repository", |
|
35 |
"iis": "OpenAIRE", |
|
36 |
"sysimport:mining:repository": "OpenAIRE", |
|
37 |
"user:claim:pid": "User", |
|
38 |
"user:claim:search": "User", |
|
39 |
"user:claim:datacite": "User" |
|
40 |
}; |
|
41 |
|
|
42 | 23 |
fundedByProjects: { "id": string, "acronym": string, "title": string, |
43 | 24 |
"funderShortname": string, "funderName": string, |
44 | 25 |
"funding": string, "code": string, "provenanceAction": string, "inline": boolean}[]; |
... | ... | |
53 | 34 |
otherSubjects: Map<string, string[]>; |
54 | 35 |
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects> |
55 | 36 |
|
56 |
researchResultsProvenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = |
|
57 |
{"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"}; |
|
58 |
|
|
59 | 37 |
// percentage is for trust |
60 | 38 |
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]>; |
61 | 39 |
// percentage is for similarity |
Also available in: Unified diff
[Trunk | Library]:
1. resultLandingInfo.ts: Remove 'projectsProvenanceVocabulary' and 'researchResultsProvenanceVocabulary' - vocabulary API is used now.
2. resultLanding.service.ts: Create method 'getProvenanceActionVocabulary()' to get provenance action term from vocabulary and use it in 'parseResultLandingInfo()'.
3. resultLanding.component.ts: Before the request of 'ResultLandingInfo', request 'provenance action terms' from vocabulary API.
4. fundedBy.component.ts: Add provenance action label as is in tooltip & add class 'uk-light' in tooltip & use 'uk-text-small' instead of 'uk-text-meta' for provenance label.