From de793ab3ad0644ccc90ff387f6f154d67840016d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 1 Jul 2024 23:35:47 +0300 Subject: [PATCH 1/5] [develop | DONE | ADDED]: Added relation between products (research product landing) and services (data sources - exclude service type). 1. result-preview.ts: Define interface RelationDatasource and added method "relationDatasourceConvert()". 2. resultLandingInfo.ts: Added fields "relatedServices" and "relatedServicesClassFilters". 3. resultLanding.service.ts: Call parsing for relations "dnet:result_datasource_relations". 4. parsingFunctions.class.ts: Added method "parseDatasources()". 5. resultLanding.component: Follow same schema for related research products (relatedResults) and related services (relatedServices), initialize relation fields and show them. --- .../landing-utils/parsingFunctions.class.ts | 57 +++++++++- .../result/resultLanding.component.html | 58 ++++++---- .../result/resultLanding.component.ts | 102 +++++++++++------- landingPages/result/resultLanding.service.ts | 13 +++ utils/entities/resultLandingInfo.ts | 5 +- utils/result-preview/result-preview.ts | 25 +++++ 6 files changed, 202 insertions(+), 58 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 961c9209..8e631278 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,4 +1,9 @@ -import {HostedByCollectedFrom, Project, RelationResult} from "../../utils/result-preview/result-preview"; +import { + HostedByCollectedFrom, + Project, + RelationDatasource, + RelationResult +} from "../../utils/result-preview/result-preview"; import {Context, Measure, Metric, MetricPerDatasource, Reference} from "../../utils/entities/resultLandingInfo"; import {Injectable} from '@angular/core'; import {properties} from "../../../../environments/environment"; @@ -526,6 +531,56 @@ export class ParsingFunctions { researchResults.push(researchResult); return researchResults; } + + // publication & dataset & software & orp landing : for relatedResearchResults + parseDatasources(datasources: RelationDatasource[], relation, provenanceAction: string, relationName: string): RelationDatasource[] { + let datasource: RelationDatasource = { + name: "", + id: "", + percentage: null, + percentageName: null, + class: "", + provenanceAction: provenanceAction, + relationName: relationName, + openaireCompatibility: "" + }; + + datasource['id'] = relation['to'].content; + if(relation["officialname"]) + datasource.name = relation.officialname; + else { + datasource['name'] = "[no title available]"; + } + + let percentageName: string; + if (relation.trust) { + percentageName = "trust"; + } else if (relation.similarity) { + percentageName = "similarity"; + } + if (percentageName) { + datasource['percentage'] = Math.round(relation[percentageName] * 100); + datasource['percentageName'] = percentageName; + } + + // type + if(relation.hasOwnProperty('datasourcetype') && relation['datasourcetype'].hasOwnProperty("classname")) { + datasource.class = relation['datasourcetype'].classname; + } + + // compatibility + if(relation.hasOwnProperty("openairecompatibility")) { + datasource.openaireCompatibility = relation['openairecompatibility'].classname; + } + + if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") { + if (datasources == undefined) { + datasources = []; + } + datasources.push(datasource); + } + return datasources; + } sortByPercentage(results: RelationResult[]): RelationResult[] { if (results) { diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 03ff3145..9759a15a 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -153,6 +153,10 @@ [tabTitle]="'Related research'" [tabId]="'all_related'" [tabNumber]="resultLandingInfo.relatedResults.length"> + + @@ -179,9 +183,13 @@ +
+ +
@@ -457,6 +465,14 @@

+ +
+ {{openaireEntities.DATASOURCES}} + +
+
+
External Databases @@ -638,7 +654,15 @@
- + +
+
+ + + +
+
@@ -763,34 +787,32 @@ - -
+ +
{{header}}
-
+ [options]="props.classFilters" [(value)]="props.selectedClass" + (valueChange)="relatedClassChanged(type)">
+ [type]="((type == 'datasource') ? openaireEntities.DATASOURCES : openaireEntities.RESULTS)" + [page]="props.page" [pageSize]="pageSize" + [totalResults]="related.length">
    -
  • +
- + (pageChange)="updateRelatedPage($event, type)" + [currentPage]="props.page" [size]="pageSize" + [totalResults]="related.length">
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index b20fc52c..8596a08b 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -13,7 +13,7 @@ import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {HelperService} from '../../utils/helper/helper.service'; import {Location} from "@angular/common"; import {MetricsService} from "../../services/metrics.service"; -import {RelationResult, ResultPreview} from "../../utils/result-preview/result-preview"; +import {RelationDatasource, RelationResult, ResultPreview} from "../../utils/result-preview/result-preview"; import {IndexInfoService} from "../../utils/indexInfo.service"; import {Identifier, StringUtils} from "../../utils/string-utils.class"; import {properties} from "../../../../environments/environment"; @@ -95,12 +95,7 @@ export class ResultLandingComponent { // Custom tab paging variables public referencesPage: number = 1; public bioentitiesPage: number = 1; - public relatedPage: number = 1; - public similarPage: number = 1; - public supplementaryPage: number = 1; - public supplementedByPage: number = 1; - public organizationsPage: number = 1; - public openCitationsPage: number = 1; + public pageSize: number = 10; // Map counting variables @@ -139,9 +134,28 @@ export class ResultLandingComponent { public pid: string; public contextsWithLink: any; - public relatedClassFilters: Option[]=[{"label": "All relations", "value": ""}]; - public relatedClassSelected: string = ""; - public filteredRelatedResults: RelationResult[]; + public relatedResults: { + classFilters: Option[], + selectedClass: string, + page: number + } = { + classFilters: [{"label": "All relations", "value": ""}], + selectedClass: "", + page: 1, + }; + filteredRelatedResults: RelationResult[]; + + public relatedServices: { + classFilters: Option[], + selectedClass: string, + page: number + } = { + classFilters: [{"label": "All relations", "value": ""}], + selectedClass: "", + page: 1 + } + filteredRelatedServices: RelationDatasource[]; + public provenanceActionVocabulary = null; public relationsVocabulary = null; @@ -168,6 +182,7 @@ export class ResultLandingComponent { @ViewChild('subjectsFsModal') subjectsFsModal: FullScreenModalComponent; @ViewChild('referencesFsModal') referencesFsModal: FullScreenModalComponent; @ViewChild('relatedResearchFsModal') relatedResearchFsModal: FullScreenModalComponent; + @ViewChild('servicesFsModal') servicesFsModal: FullScreenModalComponent; @ViewChild('bioentitiesFsModal') bioentitiesFsModal: FullScreenModalComponent; @ViewChild('compatibleEOSCFsModal') compatibleEOSCFsModal: FullScreenModalComponent; @ViewChild('fundedByFsModal') fundedByFsModal: FullScreenModalComponent; @@ -558,20 +573,34 @@ export class ResultLandingComponent { } } } - this.relatedClassFilters = [{"label": "All relations", "value": ""}]; + this.relatedResults.classFilters = [{"label": "All relations", "value": ""}]; if (this.resultLandingInfo.relatedClassFilters.size > 1) { for (let relClass of this.resultLandingInfo.relatedClassFilters) { - this.relatedClassFilters.push({ + this.relatedResults.classFilters.push({ "label": HelperFunctions.getVocabularyLabel(relClass, this.relationsVocabulary), "value": relClass }); } } else { - this.relatedClassFilters.pop(); + this.relatedResults.classFilters.pop(); } - this.relatedClassSelected = ""; + this.relatedResults.selectedClass = ""; this.filteredRelatedResults = this.resultLandingInfo.relatedResults; + this.relatedServices.classFilters = [{"label": "All relations", "value": ""}]; + if (this.resultLandingInfo.relatedServicesClassFilters.size > 1) { + for (let relClass of this.resultLandingInfo.relatedServicesClassFilters) { + this.relatedServices.classFilters.push({ + "label": HelperFunctions.getVocabularyLabel(relClass, this.relationsVocabulary), + "value": relClass + }); + } + } else { + this.relatedServices.classFilters.pop(); + } + this.relatedServices.selectedClass = ""; + this.filteredRelatedServices = this.resultLandingInfo.relatedServices + this.hasViews = false; this.hasDownloads = false; if (this.resultLandingInfo.measure && this.resultLandingInfo.measure.counts) { @@ -711,25 +740,14 @@ export class ResultLandingComponent { this.scrollToTabTop('bioentities'); } - public updateRelatedPage($event) { - this.relatedPage = $event.value; - this.scrollToTabTop('all_related'); - } - - public updateSimilarPage($event) { - this.similarPage = $event.value; - } - - public updateSupplementaryPage($event) { - this.supplementaryPage = $event.value; - } - - public updateSupplementedByPage($event) { - this.supplementedByPage = $event.value; - } - - public updateOrganizationsPage($event) { - this.organizationsPage = $event.value; + public updateRelatedPage($event, type) { + if(type == "datasource") { + this.relatedServices.page = $event.value; + this.scrollToTabTop("dataProviders"); + } else { + this.relatedResults.page = $event.value; + this.scrollToTabTop('all_related'); + } } scrollToTabTop(tabId:string){ @@ -788,8 +806,11 @@ export class ResultLandingComponent { this.alertModalDeletedByInference.open(); } - public getResultPreview(result: RelationResult): ResultPreview { - return ResultPreview.relationResultConvert(result); + public getResultPreview(result: RelationResult|RelationDatasource, type: string): ResultPreview { + if(type == "datasource") { + return ResultPreview.relationDatasourceConvert(result); + } + return ResultPreview.relationResultConvert(result); } updateUrlWithType(pid) { @@ -983,9 +1004,14 @@ export class ResultLandingComponent { this.contextsWithLink = contextsWithLink; } - public relatedClassChanged() { - this.relatedPage = 1; - this.filteredRelatedResults = this.resultLandingInfo.relatedResults.filter(result => !this.relatedClassSelected || result.relationName.toLowerCase() == this.relatedClassSelected.toLowerCase()); + public relatedClassChanged(type) { + if(type == "datasource") { + this.relatedServices.page = 1; + this.filteredRelatedServices = this.resultLandingInfo.relatedServices.filter(result => !this.relatedServices.selectedClass || result.relationName.toLowerCase() == this.relatedServices.selectedClass.toLowerCase()); + } else { + this.relatedResults.page = 1; + this.filteredRelatedResults = this.resultLandingInfo.relatedResults.filter(result => !this.relatedResults.selectedClass || result.relationName.toLowerCase() == this.relatedResults.selectedClass.toLowerCase()); + } } public viewAllOrganizationsClick() { diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 6c9b1d1d..77c5cd1e 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -210,6 +210,19 @@ export class ResultLandingService { this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName); } else if (relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") { this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation); + } else if (relation['to'].scheme && relation['to'].scheme == "dnet:result_datasource_relations") { + let relationName: string = relation.to.class; + if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) { + this.resultLandingInfo.relatedServicesClassFilters.add(relationName); + } + + let provenanceAction: string = relation.provenanceaction; + + // this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName); + if (this.resultLandingInfo.relatedServices == undefined) { + this.resultLandingInfo.relatedServices = []; + } + this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName); } } } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 8cdf216b..76e98ada 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -3,7 +3,7 @@ import { HostedByCollectedFrom, Journal, OARoutes, Organization, - Project, + Project, RelationDatasource, RelationResult } from "../result-preview/result-preview"; import {isArray} from "rxjs/internal-compatibility"; @@ -194,6 +194,9 @@ export class ResultLandingInfo { organizations: Organization[]; openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[]; + relatedServices: RelationDatasource[]; + relatedServicesClassFilters: Set = new Set(); + // DATASET subtitle: string; diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index 0362be0b..424f5bcf 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -37,6 +37,17 @@ export interface RelationResult { relationName?: string; } +export interface RelationDatasource { + name: string; + id: string; + percentage: number; + percentageName?: string; + class: string + provenanceAction?: string; + relationName?: string; + openaireCompatibility: string; +} + export interface Project { id: string; acronym: string; @@ -271,6 +282,20 @@ export class ResultPreview { return resultPreview; } + public static relationDatasourceConvert(result: RelationDatasource): ResultPreview { + let resultPreview: ResultPreview = new ResultPreview(); + resultPreview.id = result.id; + resultPreview.title = result.name; + resultPreview.resultType = "dataprovider"; + resultPreview.types = [result.class]; + resultPreview.relationName = result.relationName; + resultPreview.relation = result.percentageName; + resultPreview.percentage = result.percentage; + resultPreview.provenanceAction = result.provenanceAction; + resultPreview.compatibility = result.openaireCompatibility; + return resultPreview; + } + public static organizationConvert(result: Organization, relation: string = 'trust'): ResultPreview { let resultPreview: ResultPreview = new ResultPreview(); resultPreview.id = result.id; From 1b706003974ca33cc100ba6772084576e6148694 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Jul 2024 00:03:18 +0300 Subject: [PATCH 2/5] [develop | DONE | CHANGED]: resultLanding.component.html: Hide usage counts per datasource from production | fos.component.html: Hide level 4 from keyword view too on beta and production (show only on dev). --- fos/fos.component.html | 12 +++++++----- landingPages/result/resultLanding.component.html | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fos/fos.component.html b/fos/fos.component.html index 5bc80108..d5d67d7f 100644 --- a/fos/fos.component.html +++ b/fos/fos.component.html @@ -228,11 +228,13 @@ class="uk-link-text" [innerHTML]="highlightKeyword(searchFieldsHelper.getFosParameter() == 'foslabel' ? subSubItem.label : subSubItem.id)"> -
- - -
+ +
+ + +
+
diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 9759a15a..a19949c5 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -1152,7 +1152,7 @@
-
+
From a8c2b2d0a315064ee557c4c7039c57228d130543 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Jul 2024 00:15:21 +0300 Subject: [PATCH 3/5] [develop | DONE | CHANGED]: Parse organization versions from "children" field of the record, instead of querying explicitly. 1. organizationInfo.ts: Added field "children". 2. organization.service.ts: Set children field. 3. organization.component.html: In add parameter children. 4. organization/deletedByInference/deletedByInference.component.ts: Parse children to initialize resultsPreview: ResultPreview[] and show versions accordingly. --- .../deletedByInference.component.ts | 65 +++++++++++-------- .../organization/organization.component.html | 6 +- services/organization.service.ts | 1 + utils/entities/organizationInfo.ts | 1 + 4 files changed, 45 insertions(+), 28 deletions(-) diff --git a/landingPages/organization/deletedByInference/deletedByInference.component.ts b/landingPages/organization/deletedByInference/deletedByInference.component.ts index 9502348c..736b2ee2 100644 --- a/landingPages/organization/deletedByInference/deletedByInference.component.ts +++ b/landingPages/organization/deletedByInference/deletedByInference.component.ts @@ -19,28 +19,30 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class"; template: `
- + [totalResults]="resultsPreview.length">
    -
  • - +
- + [totalResults]="resultsPreview.length">
` }) export class OrganizationsDeletedByInferenceComponent { @Input() prevPath: string = ""; - public results: OrganizationInfo[] = []; + public resultsPreview: ResultPreview[] = []; + @Input() children = []; + @Input() id: string; @Input() ids: string[] = []; @Input() type: string; @@ -67,10 +69,10 @@ export class OrganizationsDeletedByInferenceComponent { this.properties = properties; this.subscriptions.push(this.route.queryParams.subscribe(data => { - this.errorCodes = new ErrorCodes(); - this.status = this.errorCodes.LOADING; + this.errorCodes = new ErrorCodes(); + this.status = this.errorCodes.LOADING; - this.getDeletedByInference(); + this.parseDeletedByInference(); })); } @@ -81,27 +83,38 @@ export class OrganizationsDeletedByInferenceComponent { } }); } - getDeletedByInference() { - this.results = []; - this.status = this.errorCodes.LOADING; - this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( - data => { - this.results = data; - this.status = this.errorCodes.DONE; - }, - error => { - if(error.status == '404') { - this.status = this.errorCodes.NOT_FOUND; - } else if(error.status == '500') { - this.status = this.errorCodes.ERROR; + public parseDeletedByInference() { + let length = Array.isArray(this.children) ? this.children.length : 1; + for (let i = 0; i < length; i++) { + let result = Array.isArray(this.children) ? this.children[i] : this.children; + let preview = new ResultPreview(); + + if(result.hasOwnProperty("websiteurl")) { + preview.websiteURL = result.websiteurl; + } + if(result.hasOwnProperty("legalshortname")) { + preview.title = result.legalshortname; + } + if(result.hasOwnProperty("legalname")) { + if(preview.title && preview.title != result.legalname) { + preview.title += "("+result.legalname+")"; } else { - this.status = this.errorCodes.NOT_AVAILABLE; + preview.title = result.legalname; } } - )); + + if(result.hasOwnProperty("country")) { + preview.countries = [result['country'].classname]; + } + + preview.resultType = 'organization'; + + this.resultsPreview.push(preview); + } + this.status = this.errorCodes.DONE; } - + public getResultPreview(result: OrganizationInfo): ResultPreview { return ResultPreview.organizationInfoConvert(result); } diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index c58d75c4..a4411222 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -370,7 +370,8 @@ [id]="organizationInfo.objIdentifier" [ids]="organizationInfo.deletedByInferenceIds" [modal]="AlertModalDeletedByInference" - [type]="'organizations'" [prevPath]="prevPath"> + [type]="'organizations'" [prevPath]="prevPath" + [children]="organizationInfo.children">
@@ -484,7 +485,8 @@ + [type]="'organizations'" [prevPath]="prevPath" + [children]="organizationInfo.children"> diff --git a/services/organization.service.ts b/services/organization.service.ts index 44a81633..48daceca 100644 --- a/services/organization.service.ts +++ b/services/organization.service.ts @@ -93,6 +93,7 @@ export class OrganizationService { this.organizationInfo.deletedByInferenceIds.push(result.objidentifier); } } + this.organizationInfo.children = children['organization']; } if(organization['pid']) { diff --git a/utils/entities/organizationInfo.ts b/utils/entities/organizationInfo.ts index 7943db6e..fed1c128 100644 --- a/utils/entities/organizationInfo.ts +++ b/utils/entities/organizationInfo.ts @@ -28,6 +28,7 @@ export class OrganizationInfo { // organizations: {name: string; url: string}[]}[]; deletedByInferenceIds: string[]; + children; identifiers: Map; //key is the classname belongsTo: boolean = true; message: string; From 85657ceb61dd6aa424a23f45065fadcbc924b1fe Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Jul 2024 00:25:35 +0300 Subject: [PATCH 4/5] [develop | DONE | CHANGED]: Parse research products versions from "children" field of the record, instead of querying explicitly. 1. resultLandingInfo.ts: Added field "children". 2. resultLanding.service.ts: Set children field. 3. resultLanding.component.html: In add parameter children. 4. result/deletedByInference/deletedByInference.component.ts: Parse children to initialize resultsPreview: ResultPreview[] and show versions accordingly. --- .../deletedByInference.component.ts | 122 ++++++++++++++---- .../result/resultLanding.component.html | 24 ++-- landingPages/result/resultLanding.service.ts | 1 + utils/entities/resultLandingInfo.ts | 1 + 4 files changed, 113 insertions(+), 35 deletions(-) diff --git a/landingPages/result/deletedByInference/deletedByInference.component.ts b/landingPages/result/deletedByInference/deletedByInference.component.ts index b986c240..2bee1215 100644 --- a/landingPages/result/deletedByInference/deletedByInference.component.ts +++ b/landingPages/result/deletedByInference/deletedByInference.component.ts @@ -8,33 +8,36 @@ import {RouterHelper} from '../../../utils/routerHelper.class'; import {ErrorCodes} from '../../../utils/properties/errorCodes'; import {DeletedByInferenceService} from './deletedByInference.service'; -import {ResultPreview} from "../../../utils/result-preview/result-preview"; +import {HostedByCollectedFrom, ResultPreview} from "../../../utils/result-preview/result-preview"; import {AlertModal} from "../../../utils/modal/alert"; import {Subscriber} from "rxjs"; import {properties} from "../../../../../environments/environment"; import {HelperFunctions} from "../../../utils/HelperFunctions.class"; +import {Dates, StringUtils} from "../../../utils/string-utils.class"; +import {ParsingFunctions} from "../../landing-utils/parsingFunctions.class"; @Component({ selector: 'deletedByInference', template: `
- + [totalResults]="resultsPreview.length">
    -
  • - +
- + [totalResults]="resultsPreview.length">
` @@ -42,7 +45,8 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class"; export class DeletedByInferenceComponent { @Input() isMobile: boolean = false; @Input() prevPath: string = ""; - public results: ResultLandingInfo[] = []; + public resultsPreview: ResultPreview[] = []; + @Input() children = []; @Input() id: string; @Input() ids: string[] = []; @Input() type: string; @@ -74,7 +78,7 @@ export class DeletedByInferenceComponent { this.errorCodes = new ErrorCodes(); this.status = this.errorCodes.LOADING; - this.getDeletedByInference(); + this.parseDeletedByInference(); })); } @@ -85,25 +89,89 @@ export class DeletedByInferenceComponent { } }); } - - getDeletedByInference() { - this.results = []; - this.status = this.errorCodes.LOADING; - this.subscriptions.push(this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( - data => { - this.results = data; - this.status = this.errorCodes.DONE; - }, - error => { - if (error.status == '404') { - this.status = this.errorCodes.NOT_FOUND; - } else if (error.status == '500') { - this.status = this.errorCodes.ERROR; - } else { - this.status = this.errorCodes.NOT_AVAILABLE; + + public parseDeletedByInference() { + let parsingFunctions: ParsingFunctions = new ParsingFunctions(); + let length = Array.isArray(this.children) ? this.children.length : 1; + for (let i = 0; i < length; i++) { + let result = Array.isArray(this.children) ? this.children[i] : this.children; + let preview = new ResultPreview(); + if(result.hasOwnProperty("creator")) { + preview.authors = []; + let authorsLength = Array.isArray(result.creator) ? result.creator.length : 1; + for (let j = 0; j < authorsLength; j++) { + let author = {"fullName": Array.isArray(result.creator) ? result.creator[j] : result.creator, "orcid": null, "orcid_pending": null}; + preview.authors.push(author); } } - )); + if(result.hasOwnProperty("dateofacceptance")) { + preview.year = new Date(result.dateofacceptance).getFullYear().toString(); + } + if(result.hasOwnProperty("title")) { + let titleLength = Array.isArray(result.title) ? result.title.length : 1; + for (let j = 0; j < titleLength; j++) { + let title = Array.isArray(result.title) ? result.title[j] : result.title; + if (!preview.title || title.classid == "main title") { + preview.title = StringUtils.HTMLToString(String(title.content)); + } + } + } + if(result.hasOwnProperty("description")) { + preview.description = result.description; + } + preview.resultType = result?.resulttype?.classid ? result.resulttype.classid : this.resultType; + + + if (result.hasOwnProperty("instance")) { + preview.hostedBy_collectedFrom = new Array(); + + preview.types = new Array(); + let types = new Set(); + + let counter = 0; + let instance; + + let instanesLength = Array.isArray(result['instance']) ? result['instance'].length : 1; + + for (let j = 0; j < instanesLength; j++) { + instance = Array.isArray(result['instance']) ? result['instance'][j] : result['instance']; + if(result.hasOwnProperty('collectedfrom')) { + if(Array.isArray(result['collectedfrom'])) { + // not sure if this is correct mapping + instance['collectedfrom'] = result['collectedfrom'].length >= j ? result['collectedfrom'][j] : result['collectedfrom'][result['collectedfrom'].length - 1]; + } else { + instance['collectedfrom'] = result['collectedfrom']; + } + } + + parsingFunctions.parseTypes(preview.types, types, instance); + + if (instance.hasOwnProperty("webresource")) { + let url; + if (!Array.isArray(instance['webresource'])) { + url = instance['webresource'].url; + } else { + url = instance['webresource'][0].url; + } + if (url.includes('&')) { + url = url.replace(/&/gmu, '&'); + } + + /**********************************************************/ + if (instance.hasOwnProperty("hostedby")) { + parsingFunctions.parseHostedBy_collectedFrom(preview.hostedBy_collectedFrom, instance, url, null); + } + /**********************************************************/ + } + } + + // /* Order Download from via openness*/ + preview.hostedBy_collectedFrom.sort(parsingFunctions.compareHostedByCollectedFrom); + } + + this.resultsPreview.push(preview); + } + this.status = this.errorCodes.DONE; } public getResultPreview(result: ResultLandingInfo): ResultPreview { diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index a19949c5..7621c2a0 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -724,22 +724,26 @@ [id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [ids]="resultLandingInfo.deletedByInferenceIds" [modal]="AlertModalDeletedByInference" - [resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath">
+ [resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath" + [children]="resultLandingInfo.children"> + [resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath" + [children]="resultLandingInfo.children"> + [resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath" + [children]="resultLandingInfo.children"> + [resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath" + [children]="resultLandingInfo.children"> + [modal]="alertModalDeletedByInferenceFS" + [children]="resultLandingInfo.children"> + [modal]="alertModalDeletedByInferenceFS" + [children]="resultLandingInfo.children"> + [modal]="alertModalDeletedByInferenceFS" + [children]="resultLandingInfo.children"> + [modal]="alertModalDeletedByInferenceFS" + [children]="resultLandingInfo.children"> diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 77c5cd1e..24913d76 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -238,6 +238,7 @@ export class ResultLandingService { let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result']; this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier); } + this.resultLandingInfo.children = data[3]['result']; } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 76e98ada..f8c03a0b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -185,6 +185,7 @@ export class ResultLandingInfo { contexts: Context[]; deletedByInferenceIds: string[]; + children; // PUBLICATION, DATASET, ORP references: Reference[]; From 0bd8667667744f3e011979ec557cea15d3b13698 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Jul 2024 00:46:57 +0300 Subject: [PATCH 5/5] [develop | DONE | CHANGED]: dataProviderInfo.ts: Renamed "EOSC Service Catalogue" to "EOSC Resource Hub" | environment.ts: Updated "eoscMarketplaceURL" property. --- utils/entities/dataProviderInfo.ts | 3 +-- utils/properties/environments/environment.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/entities/dataProviderInfo.ts b/utils/entities/dataProviderInfo.ts index a532260d..7ed87639 100644 --- a/utils/entities/dataProviderInfo.ts +++ b/utils/entities/dataProviderInfo.ts @@ -11,8 +11,7 @@ export class DataproviderProvenance { this.provenance.set("fairsharing_::", {"urlPrefix": properties.fairSharingURL, "name": "FAIRsharing"}); this.provenance.set("eosc________::", { "urlPrefix": properties.eoscMarketplaceURL, - "name": "EOSC Service Catalogue" - }); + "name": "EOSC Resource Hub" }); } } diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts index f7e88a8c..8f0b7308 100644 --- a/utils/properties/environments/environment.ts +++ b/utils/properties/environments/environment.ts @@ -25,7 +25,7 @@ export let common: EnvProperties = { wikiDataURL: "https://www.wikidata.org/wiki/", fundRefURL: "https://data.crossref.org/fundingdata/funder/", fairSharingURL: "https://fairsharing.org/", - eoscMarketplaceURL: "https://marketplace.eosc-portal.eu/services/", + eoscMarketplaceURL: "https://open-science-cloud.ec.europa.eu/resources/services/", sherpaURL: "http://sherpa.ac.uk/romeo/issn/", sherpaURLSuffix: "/", zenodo: "https://zenodo.org/",