diff --git a/landingPages/landing-utils/metrics/metrics.component.ts b/landingPages/landing-utils/metrics/metrics.component.ts index d19835ab..7107a8da 100644 --- a/landingPages/landing-utils/metrics/metrics.component.ts +++ b/landingPages/landing-utils/metrics/metrics.component.ts @@ -201,7 +201,7 @@ export class MetricsComponent { private sub: Subscription; private timeouts: any[] = []; - public metricsClicked: boolean = true; + public metricsClicked: boolean = false; public status: number; public state: number = -1; diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index d4737c2a..a7c6b200 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -559,11 +559,13 @@ export class ParsingFunctions { } // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects - parseAllSubjects(_subjects: any): [string[], Map, Map] { + parseAllSubjects(_subjects: any): [string[], Map, Map, string[], string[]] { let subjects: string[]; let otherSubjects: Map; let classifiedSubjects: Map; - + let fos: string[]; + let sdg: string[]; + let subject; let length = Array.isArray(_subjects) ? _subjects.length : 1; @@ -571,15 +573,27 @@ export class ParsingFunctions { subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; if (subject.classid != "") { if (subject.inferred && subject.inferred == true) { - if (classifiedSubjects == undefined) { - classifiedSubjects = new Map(); + if(subject.classid === "SDG") { + if (sdg == undefined) { + sdg = new Array(); + } + sdg.push(subject.content+""); + } else if(subject.classid === "FOS") { + if (fos == undefined) { + fos = new Array(); + } + fos.push(subject.content+""); + } else { + if (classifiedSubjects == undefined) { + classifiedSubjects = new Map(); + } + + if (!classifiedSubjects.has(subject.classname)) { + classifiedSubjects.set(subject.classname, new Array()); + } + + classifiedSubjects.get(subject.classname).push(subject.content+""); } - - if (!classifiedSubjects.has(subject.classname)) { - classifiedSubjects.set(subject.classname, new Array()); - } - - classifiedSubjects.get(subject.classname).push(subject.content); } else { if (subject.classid == "keyword") { let content: string = subject.content+""; @@ -636,7 +650,7 @@ export class ParsingFunctions { } } } - return [subjects, otherSubjects, classifiedSubjects]; + return [subjects, otherSubjects, classifiedSubjects, fos, sdg]; } parseContexts(_contexts: any): { diff --git a/landingPages/landing-utils/showPublisher.component.ts b/landingPages/landing-utils/showPublisher.component.ts index 0bf45828..7ae65787 100644 --- a/landingPages/landing-utils/showPublisher.component.ts +++ b/landingPages/landing-utils/showPublisher.component.ts @@ -54,7 +54,7 @@ import {EnvProperties} from "../../utils/properties/env-properties"; , - lissn: {{journal['lissn']}}(kostis) + lissn: {{journal['lissn']}} , diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index f6ebba84..6021e248 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -182,6 +182,26 @@ +
+
+ Fields of Science and Technology classification +
+
+
+ {{resultLandingInfo.fos.join(', ')}} +
+
+
+
+
+ Sustainable Development Goals +
+
+
+ {{resultLandingInfo.sdg.join(', ')}} +
+
+
0) + || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects + || (!!this.resultLandingInfo.organizations && this.resultLandingInfo.organizations.length > 0)); } public get hasSecondaryInfo(): boolean { diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 3d94e580..9082b030 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -8,6 +8,7 @@ import {map} from "rxjs/operators"; import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview"; import {Dates, Identifier, StringUtils} from "../../utils/string-utils.class"; import {properties} from "../../../../environments/environment"; +import {HelperFunctions} from "../../utils/HelperFunctions.class"; @Injectable() export class ResultLandingService { @@ -151,18 +152,21 @@ export class ResultLandingService { if(!this.resultLandingInfo.title || data[1][i].classid == "main title") { this.resultLandingInfo.title = String(data[1][i].content); } - if(data[1][i].classid == "main title") { - break; + if(!this.resultLandingInfo.subtitle && data[1][i].classid === 'subtitle') { + this.resultLandingInfo.subtitle = String(data[1][i].content); } + // if(data[1][i].classid == "main title") { + // break; + // } } } + if(this.resultLandingInfo.title === this.resultLandingInfo.subtitle) { + this.resultLandingInfo.subtitle = ""; + } if(!this.resultLandingInfo.title) { this.resultLandingInfo.title = ""; } // this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : ""; - if(data[1][1].classid === 'subtitle') { - this.resultLandingInfo.subtitle = (data[1][1] && data[1][1].content) ? String(data[1][1].content) : ""; - } } else { this.resultLandingInfo.title = (data[1] && data[1].content) ? String(data[1].content) : ""; } @@ -191,6 +195,8 @@ export class ResultLandingService { } this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction); + } else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") { + this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation); } } } @@ -325,10 +331,20 @@ export class ResultLandingService { // res['result']['metadata']['oaf:entity']['oaf:result']['subject'] if(data[7] != null) { - let subjectResults: [string[], Map, Map] = this.parsingFunctions.parseAllSubjects(data[7]); + let subjectResults: [string[], Map, Map, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[7]); this.resultLandingInfo.subjects = subjectResults[0]; this.resultLandingInfo.otherSubjects = subjectResults[1]; this.resultLandingInfo.classifiedSubjects = subjectResults[2]; + this.resultLandingInfo.fos = subjectResults[3]; + if(this.resultLandingInfo.fos) { + this.resultLandingInfo.fos.sort((a, b) => a.localeCompare(b)) + } + this.resultLandingInfo.sdg = subjectResults[4]; + if(this.resultLandingInfo.sdg) { + this.resultLandingInfo.sdg.sort((a, b) => { + return HelperFunctions.sortSDGs(a, b); + }) + } this.resultLandingInfo.showEgiNotebookButton = this.parsingFunctions.notebookInSubjects; } diff --git a/searchPages/searchUtils/searchFilter.component.ts b/searchPages/searchUtils/searchFilter.component.ts index 846a459b..a38cf982 100644 --- a/searchPages/searchUtils/searchFilter.component.ts +++ b/searchPages/searchUtils/searchFilter.component.ts @@ -10,7 +10,7 @@ import { import {Filter, Value} from './searchHelperClasses.class'; import {ActivatedRoute, Router} from "@angular/router"; import {SearchFields} from "../../utils/properties/searchFields"; - +import {HelperFunctions} from "../../utils/HelperFunctions.class"; @Component({ selector: 'search-filter', templateUrl: 'searchFilter.component.html' @@ -223,20 +223,21 @@ export class SearchFilterComponent implements OnInit, OnChanges { sort(values: Value[]) { let sorted: Value[] = values.slice(); if (this.sortBy == "name") { - sorted.sort((n1, n2) => { - if (n1.name.toLowerCase() > n2.name.toLowerCase()) { - return 1; + if (this.filter.filterId === "sdg") { + return HelperFunctions.sortSDGs(n1.name.toLowerCase(), n2.name.toLowerCase()); + } else { + if (n1.name.toLowerCase() > n2.name.toLowerCase()) { + return 1; + } + if (n1.name < n2.name) { + return -1; + } + return 0; } - - if (n1.name < n2.name) { - return -1; - } - - return 0; }); + return sorted; } - return sorted; } toggle() { diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 6ec1960d..ea0aca9d 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -341,7 +341,7 @@ export class SearchResearchResultsService { }); } - var date: string = (resData.dateofacceptance) + ""; // transform to string in case it is an integer + var date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; let abstracts = this.parsingFunctions.parseDescription(resData.description); diff --git a/utils/HelperFunctions.class.ts b/utils/HelperFunctions.class.ts index f7434446..492364a3 100644 --- a/utils/HelperFunctions.class.ts +++ b/utils/HelperFunctions.class.ts @@ -70,4 +70,23 @@ export class HelperFunctions { public static getValues(value: any): any[] { return Object.keys(value).map(key => value[key]); } + + public static sortSDGs(sgd1: string, sdg2: string): number { + let splitA: string[] = sgd1.split("."); + let numA: number; + if(splitA && splitA.length > 0) { + numA = +splitA[0]; + } + let splitB: string[] = sdg2.split("."); + let numB: number; + if(splitB && splitB.length > 0) { + numB = +splitB[0]; + } + + if(numA && numB) { + return numA - numB; + } else { + return sgd1.localeCompare(sdg2); + } + } } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 0e47aa92..7a461f9d 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -49,6 +49,8 @@ export class ResultLandingInfo { subjects: string[]; otherSubjects: Map; classifiedSubjects: Map; // + fos: string[]; + sdg: string[]; showEgiNotebookButton: boolean = false; // // percentage is for trust diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 1426ddab..6a8105a6 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -14,7 +14,7 @@ export class SearchFields { "resultbestaccessright", "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", - "instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country"]; + "instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country", "sdg", "fos"]; public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher", "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", @@ -231,6 +231,22 @@ export class SearchFields { operator: "cu", equalityOperator: " exact ", filterType: "checkbox" + }, + ["sdg"]: { + name: "Sustainable Development Goals (SDG)", + type: "refine", + param: "sdg", + operator: "sg", + equalityOperator: " exact ", + filterType: "checkbox" + }, + ["fos"]: { + name: "Fields of Science and Technology classification (FOS)", + type: "refine", + param: "fos", + operator: "fs", + equalityOperator: " exact ", + filterType: "checkbox" } };