import {Component, Input} from "@angular/core"; import {EnvProperties} from "../../utils/properties/env-properties"; import {properties} from "../../../../environments/environment"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {Organization, Project} from "../../utils/result-preview/result-preview"; @Component({ selector: 'entity-metadata', template: `
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}} Open Access Mandate for {{openaireEntities.PUBLICATIONS}} Open Access Mandate for {{openaireEntities.DATASETS}} {{entityType}} {{removeUnknown(types, true).join(' , ')}} {{year}} {{startYear}} {{endYear}} {{startYear}} - {{endYear}} From {{startDate | date: 'dd MMM yyyy'}} Until {{endDate | date: 'dd MMM yyyy'}} {{startDate | date: 'dd MMM yyyy'}} (Started) - {{endDate | date: 'dd MMM yyyy'}} {{currentDate >= endDate ? '(Ended)' : '(Ending)'}} {{status}} {{date | date: 'dd MMM yyyy': 'UTC'}} Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}} Under curation {{removeUnknown(countries).join(', ')}} {{removeUnknown(languages).join(', ')}} {{removeUnknown(programmingLanguages).join(', ')}} {{compatibility.info}} {{compatibility.name}} {{compatibility.info}} {{compatibility.info}} in OpenAIRE {{compatibility.name}} {{compatibilityString}} OpenAIRE Text Mining Thematic {{projectNames.slice(0,3).join(', ')}} {{organizationNames.slice(0, 3).join(', ')}} {{subjects.slice(0, 3).join(', ')}} {{provenanceAction}} {{relationName}}
`, styleUrls: ['entity-metadata.component.less'] }) export class EntityMetadataComponent { @Input() entityType: string; @Input() types: string[]; @Input() year: string; // search result @Input() startDate: number; // project landing @Input() startYear: string; // search result @Input() endDate: number; // project landing @Input() endYear: string; // search result @Input() currentDate: number; // project landing @Input() status: string; // project landing @Input() openAccessMandatePublications: boolean // project landing @Input() openAccessMandateDatasets: boolean // project landing @Input() date: Date; @Input() embargoEndDate: Date | string; @Input() underCuration: boolean = false; @Input() publisher; // showPublisher component @Input() journal; // showPublisher component @Input() countries; @Input() languages; @Input() programmingLanguages; @Input() compatibilityString: string; @Input() compatibility; // data provider landing @Input() aggregationStatus; // data provider landing @Input() thematic: boolean; // data provider landing @Input() type; // data provider landing @Input() provenanceAction: string; // search result @Input() relationName: string; // search result @Input() projects: Project[]; @Input() organizations: Organization[]; @Input() subjects: string[]; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public removeUnknown(array: string[], type: boolean = false): string[] { if (type) { return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown'); } else { return array.filter(value => value.toLowerCase() !== 'unknown'); } } public removeDuplicates(array: string[]): string[] { return array.filter(value => value.toLowerCase() !== this.entityType); } public buildCurationTooltip(): string { let tooltipContent: string = "
"; tooltipContent += "
Record in preview
"; tooltipContent += "

Bibliographic record accepted by the system, but not yet processed by
OpenAIRE tools for information quality improvement and de-duplication

"; tooltipContent += "
"; return tooltipContent; } get projectNames(): string[] { if (this.projects && this.projects.length > 0) { return this.projects.map(project => { let value = project.funderShortname ? project.funderShortname : project.funderName; if (project.acronym || project.title) { value = value + ' | ' + (project.acronym ? project.acronym : (project.title.length > 25 ? (project.title.slice(0, 25) + '...'): project.title)); } if(project.code) { value = value + ' (' + project.code + ')'; } return value; }); } return []; } get organizationNames(): string[] { if (this.organizations && this.organizations.length > 0) { return this.organizations.map(organization => organization.name); } return []; } }