[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:
konstantina.galouni 2019-10-09 13:28:23 +00:00
parent f07c3b6f1f
commit 93f9b9ef7d
5 changed files with 48 additions and 50 deletions

View File

@ -79,10 +79,10 @@ export class FundedByComponent {
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"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) {
tooltipContent += "<h5>"+item.title+"</h5>";
tooltipContent += "<p class='uk-h5'>"+item.title+"</p>";
}
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) {
tooltipContent += "</p>";
}
tooltipContent += "<span class='uk-text-meta'>";
if(item.provenanceAction == 'Repository') {
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 class='uk-text-small'>";
tooltipContent += item.provenanceAction;
tooltipContent += "</span>";
tooltipContent+="</div>"
tooltipContent+="</div>";
return tooltipContent;
}

View File

@ -10,7 +10,7 @@ export class ParsingFunctions {
"funding": string, "code": string,
"provenanceAction": string, "inline": boolean
}[],
relation: any, projectsProvenanceVocabulary: any):
relation: any, provenanceActionVocabulary: any):
{ "id": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"funding": string, "code": string,
@ -39,8 +39,8 @@ export class ParsingFunctions {
fundedByProject['title'] = relation.title;
fundedByProject['code'] = relation.code;
if(relation.provenanceaction in projectsProvenanceVocabulary) {
fundedByProject['provenanceAction'] = projectsProvenanceVocabulary[relation.provenanceaction];
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction];
}
} else {
fundedByProject['id'] = "";
@ -535,7 +535,6 @@ export class ParsingFunctions {
contexts[position]['labelCategory'] = category.label;
contexts[position]['labelConcept'] = null;
position++;
console.info(contexts);
}
}
} else {

View File

@ -134,7 +134,7 @@ export class ResultLandingComponent {
this.metricsClicked = false;
if (this.id) {
this.getResultLandingInfo(this.id);
this.getProvenanceVocabularyAndResultLandingInfo();
} else {
this.showLoading = false;
@ -192,14 +192,26 @@ export class ResultLandingComponent {
);
}
private getResultLandingInfo(id: string) {
private getProvenanceVocabularyAndResultLandingInfo() {
this.warningMessage = '';
this.errorMessage = '';
this.showLoading = true;
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 => {
this.resultLandingInfo = data;
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]);

View File

@ -4,7 +4,7 @@ import {throwError} from 'rxjs';
import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
import {map} from "rxjs/operators";
import {map, tap} from "rxjs/operators";
@Injectable()
export class ResultLandingService {
@ -16,7 +16,7 @@ export class ResultLandingService {
public parsingFunctions: ParsingFunctions;
resultLandingInfo: ResultLandingInfo;
getResultLandingInfo (id: string, type: string, properties: EnvProperties): any {
getResultLandingInfo (id: string, type: string, provenanceActionVocabulary: any, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst;
if (type === 'publication') {
url += 'publications/';
@ -50,7 +50,23 @@ export class ResultLandingService {
res[0], // 13
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) {
@ -60,7 +76,7 @@ export class ResultLandingService {
return throwError(error || 'Server error');
}
parseResultLandingInfo (data: any, properties: EnvProperties): any {
parseResultLandingInfo (data: any, provenanceActionVocabulary: any, properties: EnvProperties): any {
this.resultLandingInfo = new ResultLandingInfo();
// res
@ -105,13 +121,11 @@ export class ResultLandingService {
relation = Array.isArray(data[2]) ? data[2][i] : data[2];
if(relation.hasOwnProperty("to")) {
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") {
let provenanceAction: string;
if(relation.provenanceaction in this.resultLandingInfo.researchResultsProvenanceVocabulary) {
provenanceAction = this.resultLandingInfo.researchResultsProvenanceVocabulary[relation.provenanceaction];
} else {
provenanceAction = "Other";
let provenanceAction: string = "";
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
}
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction);

View File

@ -20,25 +20,6 @@ export class ResultLandingInfo {
"accessMode": string[], "bestAccessMode": 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,
"funderShortname": string, "funderName": string,
"funding": string, "code": string, "provenanceAction": string, "inline": boolean}[];
@ -53,9 +34,6 @@ export class ResultLandingInfo {
otherSubjects: Map<string, string[]>;
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
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]>;
// percentage is for similarity