[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. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57330 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f07c3b6f1f
commit
93f9b9ef7d
|
@ -79,10 +79,10 @@ export class FundedByComponent {
|
||||||
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
|
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
|
||||||
"funderShortname": string, "funderName": string,
|
"funderShortname": string, "funderName": string,
|
||||||
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) {
|
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) {
|
||||||
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small'>";
|
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small uk-light'>";
|
||||||
|
|
||||||
if(item.title) {
|
if(item.title) {
|
||||||
tooltipContent += "<h5>"+item.title+"</h5>";
|
tooltipContent += "<p class='uk-h5'>"+item.title+"</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
||||||
|
@ -111,16 +111,11 @@ export class FundedByComponent {
|
||||||
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
||||||
tooltipContent += "</p>";
|
tooltipContent += "</p>";
|
||||||
}
|
}
|
||||||
tooltipContent += "<span class='uk-text-meta'>";
|
tooltipContent += "<span class='uk-text-small'>";
|
||||||
if(item.provenanceAction == 'Repository') {
|
tooltipContent += item.provenanceAction;
|
||||||
tooltipContent += "Link provided by Repository";
|
|
||||||
} else if(item.provenanceAction == 'OpenAIRE') {
|
|
||||||
tooltipContent += "Link inferred by OpenAIRE";
|
|
||||||
} else if(item.provenanceAction == 'USer') {
|
|
||||||
tooltipContent += "Link claimed by User";
|
|
||||||
}
|
|
||||||
tooltipContent += "</span>";
|
tooltipContent += "</span>";
|
||||||
tooltipContent+="</div>"
|
tooltipContent+="</div>";
|
||||||
|
|
||||||
return tooltipContent;
|
return tooltipContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export class ParsingFunctions {
|
||||||
"funding": string, "code": string,
|
"funding": string, "code": string,
|
||||||
"provenanceAction": string, "inline": boolean
|
"provenanceAction": string, "inline": boolean
|
||||||
}[],
|
}[],
|
||||||
relation: any, projectsProvenanceVocabulary: any):
|
relation: any, provenanceActionVocabulary: any):
|
||||||
{ "id": string, "acronym": string, "title": string,
|
{ "id": string, "acronym": string, "title": string,
|
||||||
"funderShortname": string, "funderName": string,
|
"funderShortname": string, "funderName": string,
|
||||||
"funding": string, "code": string,
|
"funding": string, "code": string,
|
||||||
|
@ -39,8 +39,8 @@ export class ParsingFunctions {
|
||||||
fundedByProject['title'] = relation.title;
|
fundedByProject['title'] = relation.title;
|
||||||
fundedByProject['code'] = relation.code;
|
fundedByProject['code'] = relation.code;
|
||||||
|
|
||||||
if(relation.provenanceaction in projectsProvenanceVocabulary) {
|
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
|
||||||
fundedByProject['provenanceAction'] = projectsProvenanceVocabulary[relation.provenanceaction];
|
fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fundedByProject['id'] = "";
|
fundedByProject['id'] = "";
|
||||||
|
@ -535,7 +535,6 @@ export class ParsingFunctions {
|
||||||
contexts[position]['labelCategory'] = category.label;
|
contexts[position]['labelCategory'] = category.label;
|
||||||
contexts[position]['labelConcept'] = null;
|
contexts[position]['labelConcept'] = null;
|
||||||
position++;
|
position++;
|
||||||
console.info(contexts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -134,7 +134,7 @@ export class ResultLandingComponent {
|
||||||
this.metricsClicked = false;
|
this.metricsClicked = false;
|
||||||
|
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
this.getResultLandingInfo(this.id);
|
this.getProvenanceVocabularyAndResultLandingInfo();
|
||||||
} else {
|
} else {
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
|
|
||||||
|
@ -192,14 +192,26 @@ export class ResultLandingComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getResultLandingInfo(id: string) {
|
private getProvenanceVocabularyAndResultLandingInfo() {
|
||||||
this.warningMessage = '';
|
this.warningMessage = '';
|
||||||
this.errorMessage = '';
|
this.errorMessage = '';
|
||||||
this.showLoading = true;
|
this.showLoading = true;
|
||||||
|
|
||||||
this.resultLandingInfo = null;
|
this.resultLandingInfo = null;
|
||||||
|
|
||||||
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, this.properties).subscribe(
|
this._resultLaningService.getProvenanceActionVocabulary(this.properties).subscribe(
|
||||||
|
provenanceActionVocabulary => {
|
||||||
|
this.getResultLandingInfo(provenanceActionVocabulary);
|
||||||
|
}, err => {
|
||||||
|
this.getResultLandingInfo(null);
|
||||||
|
this.handleError("Error getting provenance action vocabulary for "+this.type+" with id: " + this.id, err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private getResultLandingInfo(provenanceActionVocabulary: any) {
|
||||||
|
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.resultLandingInfo = data;
|
this.resultLandingInfo = data;
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]);
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {throwError} from 'rxjs';
|
||||||
import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
|
import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
|
||||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||||
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
|
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
|
||||||
import {map} from "rxjs/operators";
|
import {map, tap} from "rxjs/operators";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ResultLandingService {
|
export class ResultLandingService {
|
||||||
|
@ -16,7 +16,7 @@ export class ResultLandingService {
|
||||||
public parsingFunctions: ParsingFunctions;
|
public parsingFunctions: ParsingFunctions;
|
||||||
resultLandingInfo: ResultLandingInfo;
|
resultLandingInfo: ResultLandingInfo;
|
||||||
|
|
||||||
getResultLandingInfo (id: string, type: string, properties: EnvProperties): any {
|
getResultLandingInfo (id: string, type: string, provenanceActionVocabulary: any, properties: EnvProperties): any {
|
||||||
let url = properties.searchAPIURLLAst;
|
let url = properties.searchAPIURLLAst;
|
||||||
if (type === 'publication') {
|
if (type === 'publication') {
|
||||||
url += 'publications/';
|
url += 'publications/';
|
||||||
|
@ -50,7 +50,23 @@ export class ResultLandingService {
|
||||||
res[0], // 13
|
res[0], // 13
|
||||||
res[2] // 14
|
res[2] // 14
|
||||||
]))
|
]))
|
||||||
.pipe(map(res => this.parseResultLandingInfo(res, properties)));
|
.pipe(map(res => this.parseResultLandingInfo(res, provenanceActionVocabulary, properties)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getProvenanceActionVocabulary (properties: EnvProperties): any {
|
||||||
|
let url = properties.vocabulariesAPI+"dnet:provenanceActions.json";
|
||||||
|
|
||||||
|
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
.pipe(map(res => res['terms']))
|
||||||
|
.pipe(map(res => this.parseProvenanceActionVocabulary(res, properties)));
|
||||||
|
}
|
||||||
|
|
||||||
|
parseProvenanceActionVocabulary(terms: any, properties: EnvProperties) {
|
||||||
|
var provenanceActionVocabulary: {} = {};
|
||||||
|
for(let term of terms) {
|
||||||
|
provenanceActionVocabulary[term.code] = term.englishName;
|
||||||
|
}
|
||||||
|
return provenanceActionVocabulary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError (error: HttpErrorResponse) {
|
private handleError (error: HttpErrorResponse) {
|
||||||
|
@ -60,7 +76,7 @@ export class ResultLandingService {
|
||||||
return throwError(error || 'Server error');
|
return throwError(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
parseResultLandingInfo (data: any, properties: EnvProperties): any {
|
parseResultLandingInfo (data: any, provenanceActionVocabulary: any, properties: EnvProperties): any {
|
||||||
this.resultLandingInfo = new ResultLandingInfo();
|
this.resultLandingInfo = new ResultLandingInfo();
|
||||||
|
|
||||||
// res
|
// res
|
||||||
|
@ -105,13 +121,11 @@ export class ResultLandingService {
|
||||||
relation = Array.isArray(data[2]) ? data[2][i] : data[2];
|
relation = Array.isArray(data[2]) ? data[2][i] : data[2];
|
||||||
if(relation.hasOwnProperty("to")) {
|
if(relation.hasOwnProperty("to")) {
|
||||||
if(relation['to'].class == "isProducedBy") {
|
if(relation['to'].class == "isProducedBy") {
|
||||||
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, this.resultLandingInfo.projectsProvenanceVocabulary);
|
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary);
|
||||||
} else if(relation['to'].class == "isRelatedTo") {
|
} else if(relation['to'].class == "isRelatedTo") {
|
||||||
let provenanceAction: string;
|
let provenanceAction: string = "";
|
||||||
if(relation.provenanceaction in this.resultLandingInfo.researchResultsProvenanceVocabulary) {
|
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
|
||||||
provenanceAction = this.resultLandingInfo.researchResultsProvenanceVocabulary[relation.provenanceaction];
|
provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
|
||||||
} else {
|
|
||||||
provenanceAction = "Other";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction);
|
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction);
|
||||||
|
|
|
@ -20,25 +20,6 @@ export class ResultLandingInfo {
|
||||||
"accessMode": string[], "bestAccessMode": string,
|
"accessMode": string[], "bestAccessMode": string,
|
||||||
"type": string, "year":string}[];
|
"type": string, "year":string}[];
|
||||||
|
|
||||||
projectsProvenanceVocabulary: { "sysimport:crosswalk:repository": string,
|
|
||||||
"sysimport:crosswalk:entityregistry": string,
|
|
||||||
"sysimport:crosswalk:datasetarchive": string,
|
|
||||||
"iis": string,
|
|
||||||
"sysimport:mining:repository": string,
|
|
||||||
"user:claim:pid": string,
|
|
||||||
"user:claim:search": string,
|
|
||||||
"user:claim:datacite": string
|
|
||||||
} = {
|
|
||||||
"sysimport:crosswalk:repository": "Repository",
|
|
||||||
"sysimport:crosswalk:entityregistry": "Repository",
|
|
||||||
"sysimport:crosswalk:datasetarchive": "Repository",
|
|
||||||
"iis": "OpenAIRE",
|
|
||||||
"sysimport:mining:repository": "OpenAIRE",
|
|
||||||
"user:claim:pid": "User",
|
|
||||||
"user:claim:search": "User",
|
|
||||||
"user:claim:datacite": "User"
|
|
||||||
};
|
|
||||||
|
|
||||||
fundedByProjects: { "id": string, "acronym": string, "title": string,
|
fundedByProjects: { "id": string, "acronym": string, "title": string,
|
||||||
"funderShortname": string, "funderName": string,
|
"funderShortname": string, "funderName": string,
|
||||||
"funding": string, "code": string, "provenanceAction": string, "inline": boolean}[];
|
"funding": string, "code": string, "provenanceAction": string, "inline": boolean}[];
|
||||||
|
@ -53,9 +34,6 @@ export class ResultLandingInfo {
|
||||||
otherSubjects: Map<string, string[]>;
|
otherSubjects: Map<string, string[]>;
|
||||||
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
|
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
|
||||||
|
|
||||||
researchResultsProvenanceVocabulary: {"iis": string, "sysimport": string, "user": string} =
|
|
||||||
{"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
|
|
||||||
|
|
||||||
// percentage is for trust
|
// percentage is for trust
|
||||||
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]>;
|
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]>;
|
||||||
// percentage is for similarity
|
// percentage is for similarity
|
||||||
|
|
Loading…
Reference in New Issue