2020-03-16 14:09:46 +01:00
|
|
|
import {
|
|
|
|
Author,
|
|
|
|
HostedByCollectedFrom,
|
2023-12-20 22:55:00 +01:00
|
|
|
Journal, OARoutes,
|
2020-03-16 14:09:46 +01:00
|
|
|
Organization,
|
|
|
|
Project,
|
|
|
|
RelationResult
|
|
|
|
} from "../result-preview/result-preview";
|
2024-05-29 12:05:04 +02:00
|
|
|
import {isArray} from "rxjs/internal-compatibility";
|
|
|
|
import {OpenaireEntities} from "../properties/searchFields";
|
|
|
|
import {StringUtils} from "../string-utils.class";
|
2020-03-16 14:09:46 +01:00
|
|
|
|
2020-03-20 13:01:55 +01:00
|
|
|
export interface Id {
|
2023-10-06 11:22:00 +02:00
|
|
|
type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid";
|
2020-03-17 18:48:02 +01:00
|
|
|
value: string;
|
|
|
|
trust: number
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Reference {
|
|
|
|
name?: string;
|
2020-03-20 13:01:55 +01:00
|
|
|
ids: Id[];
|
2020-03-17 18:48:02 +01:00
|
|
|
}
|
|
|
|
|
2022-04-12 14:01:45 +02:00
|
|
|
export interface Context {
|
|
|
|
labelContext: string;
|
|
|
|
idContext: string;
|
|
|
|
labelCategory: string;
|
|
|
|
idCategory: string;
|
|
|
|
labelConcept: string;
|
|
|
|
idConcept: string;
|
|
|
|
link?: string;
|
|
|
|
logo?: string;
|
|
|
|
}
|
|
|
|
|
2023-01-13 07:32:16 +01:00
|
|
|
export interface Measure {
|
2023-02-17 18:40:05 +01:00
|
|
|
bip?: Metric[]
|
|
|
|
counts?: Metric[]
|
2023-11-08 15:57:56 +01:00
|
|
|
countsPerDatasource?: MetricPerDatasource[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MetricPerDatasource {
|
|
|
|
datasourceId: string,
|
2023-11-27 17:10:37 +01:00
|
|
|
datasourceName: string,
|
2023-11-08 15:57:56 +01:00
|
|
|
views: number,
|
|
|
|
downloads: number
|
2023-02-17 18:40:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Metric {
|
|
|
|
name: string,
|
|
|
|
order: number,
|
|
|
|
icon: string,
|
|
|
|
value: any
|
2023-01-13 07:32:16 +01:00
|
|
|
}
|
|
|
|
|
2024-05-29 12:05:04 +02:00
|
|
|
class Field {
|
|
|
|
path: string[];
|
|
|
|
value: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BelongsTo {
|
|
|
|
public static result: BelongsTo = null;
|
|
|
|
public static project: BelongsTo = null;
|
|
|
|
public static organization: BelongsTo = null;
|
|
|
|
public static datasource: BelongsTo = null;
|
|
|
|
|
|
|
|
fields: Field[];
|
|
|
|
message: string;
|
|
|
|
|
|
|
|
public static check(element: any, field: Field): boolean {
|
|
|
|
if (field) {
|
|
|
|
field = Object.assign({}, field);
|
|
|
|
let json: any = element;
|
|
|
|
if (field.path.length > 0) {
|
|
|
|
if (Array.isArray(json)) {
|
|
|
|
return json.findIndex(value => BelongsTo.check(value, field)) != -1;
|
|
|
|
} else {
|
|
|
|
json = json[field.path[0]];
|
|
|
|
field.path = field.path.slice(1);
|
|
|
|
return BelongsTo.check(json, field);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return json == field.value;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
export class ResultLandingInfo {
|
2020-08-19 13:01:22 +02:00
|
|
|
relcanId;
|
2021-03-08 15:42:26 +01:00
|
|
|
objIdentifier: string;
|
2019-09-05 10:49:33 +02:00
|
|
|
// PUBLICATION, DATASET, SOFTWARE, ORP
|
|
|
|
record;
|
2024-05-29 12:05:04 +02:00
|
|
|
resultType: "publication" | "dataset" | "other" | "software";
|
2019-09-30 13:02:06 +02:00
|
|
|
// PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE
|
2019-09-05 10:49:33 +02:00
|
|
|
title: string;
|
|
|
|
accessMode: string;
|
2020-03-16 14:09:46 +01:00
|
|
|
authors: Author[];
|
2019-09-05 10:49:33 +02:00
|
|
|
date: string;
|
2020-03-16 14:09:46 +01:00
|
|
|
dateofacceptance: Date;
|
|
|
|
embargoEndDate: Date;
|
2019-09-05 10:49:33 +02:00
|
|
|
types: string[];
|
2019-09-30 13:02:06 +02:00
|
|
|
identifiers: Map<string, string[]>; //key is the classname
|
|
|
|
languages: string[];
|
|
|
|
countries: string[];
|
2022-09-21 12:32:21 +02:00
|
|
|
description: string;
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2020-03-16 14:09:46 +01:00
|
|
|
hostedBy_collectedFrom: HostedByCollectedFrom[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-10-10 13:59:50 +02:00
|
|
|
// PUBLICATION, DATASET, SOFTWARE, ORP
|
2020-03-16 14:09:46 +01:00
|
|
|
fundedByProjects: Project[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-30 13:02:06 +02:00
|
|
|
underCurationMessage: boolean;
|
|
|
|
publisher: string;
|
2020-03-16 14:09:46 +01:00
|
|
|
journal: Journal;
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-30 13:02:06 +02:00
|
|
|
subjects: string[];
|
|
|
|
otherSubjects: Map<string, string[]>;
|
|
|
|
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
|
2024-05-29 12:05:04 +02:00
|
|
|
fos: { "id": string, "label": string }[] = [];
|
2022-03-15 22:31:10 +01:00
|
|
|
sdg: string[];
|
2022-05-12 13:05:54 +02:00
|
|
|
eoscSubjects: any[];
|
2023-12-20 22:55:00 +01:00
|
|
|
|
|
|
|
oaRoutes: OARoutes;
|
|
|
|
publiclyFunded: boolean;
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2022-01-07 11:16:23 +01:00
|
|
|
// // percentage is for trust
|
|
|
|
// relatedResearchResults: RelationResult[];
|
|
|
|
// // percentage is for similarity
|
|
|
|
// similarResearchResults: RelationResult[];
|
|
|
|
// //isSupplementedBy
|
|
|
|
// supplementaryResearchResults: RelationResult[];
|
|
|
|
// //isSupplementTo
|
|
|
|
// supplementedByResearchResults: RelationResult[];
|
|
|
|
//
|
|
|
|
// // IsPartOf
|
|
|
|
// parentResearchResults: RelationResult[];
|
|
|
|
// // HasPart
|
|
|
|
// childrenResearchResults: RelationResult[];
|
|
|
|
// // Reviews
|
|
|
|
// reviewedByResearchResults: RelationResult[];
|
|
|
|
// // IsReviewedBy
|
|
|
|
// reviewerResearchResults: RelationResult[];
|
|
|
|
// // References
|
|
|
|
// referencedByResearchResults: RelationResult[];
|
|
|
|
// // IsReferencedBy
|
|
|
|
// refererResearchResults: RelationResult[];
|
|
|
|
// // IsIdenticalTo
|
|
|
|
// identicalResearchResults: RelationResult[];
|
|
|
|
// // IsContinuedBy
|
|
|
|
// continuatorResearchResults: RelationResult[];
|
|
|
|
// // Continues
|
|
|
|
// continuedByResearchResults: RelationResult[];
|
|
|
|
// // IsDocumentedBy
|
|
|
|
// documentaryResearchResults: RelationResult[];
|
|
|
|
// // Documents
|
|
|
|
// documentedByResearchResults: RelationResult[];
|
|
|
|
// // IsCompiledBy
|
|
|
|
// compilerResearchResults: RelationResult[];
|
|
|
|
// // Compiles
|
|
|
|
// compiledByResearchResults: RelationResult[];
|
|
|
|
// // IsPreviousVersionOf
|
|
|
|
// newerResearchResults: RelationResult[];
|
|
|
|
// // IsNewVersionOf
|
|
|
|
// previousResearchResults: RelationResult[];
|
|
|
|
// // IsVersionOf
|
|
|
|
// versionedByResearchResults: RelationResult[];
|
|
|
|
// // HasVersion
|
|
|
|
// isVersionResearchResults: RelationResult[];
|
|
|
|
// // IsSourceOf
|
|
|
|
// derivedResearchResults: RelationResult[];
|
|
|
|
// // IsDerivedFrom
|
|
|
|
// sourceResearchResults: RelationResult[];
|
|
|
|
// // IsVariantFormOf
|
|
|
|
// originalResearchResults: RelationResult[];
|
|
|
|
// // IsOriginalFormOf
|
|
|
|
// variantResearchResults: RelationResult[];
|
|
|
|
// // IsObsoletedBy
|
|
|
|
// obsoleteResearchResults: RelationResult[];
|
|
|
|
// // Obsolete
|
|
|
|
// obsoletedByResearchResults: RelationResult[];
|
|
|
|
|
|
|
|
relatedResults: RelationResult[];
|
|
|
|
relatedClassFilters: Set<string> = new Set();
|
|
|
|
|
2022-04-12 14:01:45 +02:00
|
|
|
contexts: Context[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
deletedByInferenceIds: string[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
// PUBLICATION, DATASET, ORP
|
2020-03-17 18:48:02 +01:00
|
|
|
references: Reference[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
// PUBLICATION
|
|
|
|
bioentities: Map<string, Map<string, string>>; //<site name, <>>
|
2020-03-16 14:09:46 +01:00
|
|
|
organizations: Organization[];
|
|
|
|
openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[];
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
// DATASET
|
|
|
|
subtitle: string;
|
2024-05-29 12:05:04 +02:00
|
|
|
|
2019-09-05 10:49:33 +02:00
|
|
|
// SOFTWARE
|
|
|
|
programmingLanguages: string[];
|
2023-01-13 07:32:16 +01:00
|
|
|
|
2024-05-29 12:05:04 +02:00
|
|
|
measure: Measure;
|
|
|
|
|
|
|
|
belongsTo: boolean = true;
|
|
|
|
message: string;
|
|
|
|
|
|
|
|
setBelongsTo(typeId: string, id: string) {
|
|
|
|
this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
|
|
|
|
this.message = !this.belongsTo ? BelongsTo.result.message : null;
|
|
|
|
if (this.message) {
|
|
|
|
this.message = this.message.replace('((result))', StringUtils.getEntityName(this.resultType));
|
|
|
|
this.message = this.message.replace('((type_id))', typeId);
|
|
|
|
this.message = this.message.replace('((id))', id);
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 10:49:33 +02:00
|
|
|
}
|