0"
- class="uk-margin-bottom">
+
+ 0" class="uk-margin-bottom">
{{header}}
-
1" class="uk-margin-medium-bottom"
+
1" class="uk-margin-medium-bottom"
input type="select" placeholder="Filter by relation" inputClass="flat x-small"
- [options]="relatedClassFilters" [(value)]="relatedClassSelected"
- (valueChange)="relatedClassChanged()">
+ [options]="props.classFilters" [(value)]="props.selectedClass"
+ (valueChange)="relatedClassChanged(type)">
+ [type]="((type == 'datasource') ? openaireEntities.DATASOURCES : openaireEntities.RESULTS)"
+ [page]="props.page" [pageSize]="pageSize"
+ [totalResults]="related.length">
-
pageSize"
+ pageSize"
class="uk-margin-top"
- (pageChange)="updateRelatedPage($event)"
- [currentPage]="relatedPage" [size]="pageSize"
- [totalResults]="researchResults.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;