Add measures and hosteby collected from in search result objects
This commit is contained in:
parent
1093027ca1
commit
0a1e0fbd8a
|
@ -1,5 +1,5 @@
|
|||
import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../utils/result-preview/result-preview";
|
||||
import {Context, Reference} from "../../utils/entities/resultLandingInfo";
|
||||
import {Context, Measure, Reference} from "../../utils/entities/resultLandingInfo";
|
||||
import {Injectable} from '@angular/core';
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {StringUtils} from "../../utils/string-utils.class";
|
||||
|
@ -9,10 +9,26 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
})
|
||||
export class ParsingFunctions {
|
||||
public eoscSubjects = [
|
||||
{label: 'EOSC::Jupyter Notebook', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AJupyter+Notebook', value: 'Jupyter Notebook'},
|
||||
{label: 'EOSC::RO-crate', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/datasources/eosc.psnc.6f0470e3bb9203ec3a7553f3a72a7a1f?q=ROHub', value: 'RO-crate'},
|
||||
{label: 'EOSC::Galaxy Workflow', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AGalaxy+Workflow', value: 'Galaxy Workflow'},
|
||||
{label: 'EOSC::Twitter Data', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3ATwitter+Data', value: 'Twitter Data'}
|
||||
{
|
||||
label: 'EOSC::Jupyter Notebook',
|
||||
link: 'https://' + (properties.environment != 'production' ? 'beta.' : '') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AJupyter+Notebook',
|
||||
value: 'Jupyter Notebook'
|
||||
},
|
||||
{
|
||||
label: 'EOSC::RO-crate',
|
||||
link: 'https://' + (properties.environment != 'production' ? 'beta.' : '') + 'marketplace.eosc-portal.eu/datasources/eosc.psnc.6f0470e3bb9203ec3a7553f3a72a7a1f?q=ROHub',
|
||||
value: 'RO-crate'
|
||||
},
|
||||
{
|
||||
label: 'EOSC::Galaxy Workflow',
|
||||
link: 'https://' + (properties.environment != 'production' ? 'beta.' : '') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AGalaxy+Workflow',
|
||||
value: 'Galaxy Workflow'
|
||||
},
|
||||
{
|
||||
label: 'EOSC::Twitter Data',
|
||||
link: 'https://' + (properties.environment != 'production' ? 'beta.' : '') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3ATwitter+Data',
|
||||
value: 'Twitter Data'
|
||||
}
|
||||
]
|
||||
|
||||
public notebookInSubjects: boolean = false;
|
||||
|
@ -48,7 +64,7 @@ export class ParsingFunctions {
|
|||
fundedByProject['acronym'] = relation.acronym;
|
||||
fundedByProject['title'] = relation.title;
|
||||
fundedByProject['code'] = relation.code;
|
||||
if(relation.validated && relation.validated.date) {
|
||||
if (relation.validated && relation.validated.date) {
|
||||
fundedByProject['validated'] = true;
|
||||
}
|
||||
fundedByProject['provenanceAction'] = relation.provenanceaction;
|
||||
|
@ -155,7 +171,7 @@ export class ParsingFunctions {
|
|||
|
||||
// publication & dataset landing : for downloadFrom
|
||||
addPublisherToHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
|
||||
publisher: string, journal: Journal,
|
||||
publisher: string, journal: string,
|
||||
identifiers: Map<string, string[]>/*, title: { "name": string, "url": string, "accessMode": string}*/) {
|
||||
if (!this.instanceWithDoiExists && publisher && identifiers != null && identifiers.has('doi')) {
|
||||
if (hostedBy_collectedFrom == null) {
|
||||
|
@ -171,13 +187,13 @@ export class ParsingFunctions {
|
|||
accessRightIcon: ""
|
||||
};
|
||||
|
||||
if (journal && journal.journal) {
|
||||
if (journal) {
|
||||
available.downloadNames.push(publisher + "/ " + journal['journal']);
|
||||
} else {
|
||||
available.downloadNames.push(publisher);
|
||||
}
|
||||
|
||||
available.downloadUrl = properties.doiURL + identifiers.get("doi")[0];;
|
||||
available.downloadUrl = properties.doiURL + identifiers.get("doi")[0];
|
||||
available.accessRightIcon = this.unknown;
|
||||
/*
|
||||
if(title != undefined && title['url'] == "") {
|
||||
|
@ -252,7 +268,7 @@ export class ParsingFunctions {
|
|||
|
||||
parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
|
||||
instance: any, url: string, globalAccessRight: string) {
|
||||
if(!url) {
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -287,7 +303,7 @@ export class ParsingFunctions {
|
|||
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
|
||||
for (let i = 0; i < length; i++) {
|
||||
let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
|
||||
if(collectedFrom.name && collectedFrom.id) {
|
||||
if (collectedFrom.name && collectedFrom.id) {
|
||||
available.collectedNamesAndIds.set(String(collectedFrom.name), collectedFrom.id);
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +314,7 @@ export class ParsingFunctions {
|
|||
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
|
||||
for (let i = 0; i < length; i++) {
|
||||
let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
|
||||
if(instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
|
||||
if (instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
|
||||
types.add(instanceType.classname);
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +333,7 @@ export class ParsingFunctions {
|
|||
}
|
||||
|
||||
available['downloadUrl'] = url;
|
||||
if(url.includes("doi.org/")) {
|
||||
if (url.includes("doi.org/")) {
|
||||
this.instanceWithDoiExists = true;
|
||||
}
|
||||
|
||||
|
@ -348,13 +364,49 @@ export class ParsingFunctions {
|
|||
available.accessRightIcon = this.unknown;
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("license")) {
|
||||
if (instance.hasOwnProperty("license")) {
|
||||
available.license = Array.isArray(instance['license']) ? instance['license'][0] : instance['license'];
|
||||
}
|
||||
|
||||
hostedBy_collectedFrom.push(available);
|
||||
}
|
||||
|
||||
compareHostedByCollectedFrom(a: HostedByCollectedFrom, b: HostedByCollectedFrom) {
|
||||
let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
|
||||
let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
|
||||
|
||||
if (firstAccessRight === secondAccessRight) {
|
||||
return 0;
|
||||
} else {
|
||||
if (firstAccessRight === 'open access') {
|
||||
return -1;
|
||||
} else if (secondAccessRight === 'open access') {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "open source") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "open source") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "embargo") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "embargo") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "restricted") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "restricted") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "closed access") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "closed access") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "not available") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "not available") {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for downloadFrom and publishedIn
|
||||
changeBestAccessMode(currentAccessMode: string, accessMode: any): boolean {
|
||||
if (!accessMode) {
|
||||
|
@ -417,7 +469,7 @@ export class ParsingFunctions {
|
|||
|
||||
// researchResult.relationName = relation.to.class;
|
||||
|
||||
if(relation['resulttype']) {
|
||||
if (relation['resulttype']) {
|
||||
if (relation['resulttype'].classname == "publication") {
|
||||
researchResult['class'] = "publication";
|
||||
} else if (relation['resulttype'].classname == "dataset") {
|
||||
|
@ -429,10 +481,10 @@ export class ParsingFunctions {
|
|||
}
|
||||
}
|
||||
researchResult['id'] = relation['to'].content;
|
||||
if(Array.isArray(relation['title'])) {
|
||||
for(let i=0; i<relation['title'].length; i++) {
|
||||
if(relation['title'][i] && relation['title'][i].content) {
|
||||
if(!researchResult['name'] || relation['title'][i].classid == "main title") {
|
||||
if (Array.isArray(relation['title'])) {
|
||||
for (let i = 0; i < relation['title'].length; i++) {
|
||||
if (relation['title'][i] && relation['title'][i].content) {
|
||||
if (!researchResult['name'] || relation['title'][i].classid == "main title") {
|
||||
researchResult['name'] = String(relation['title'][i].content);
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +492,7 @@ export class ParsingFunctions {
|
|||
} else {
|
||||
researchResult['name'] = (relation['title'] && relation['title'].content) ? String(relation['title'].content) : "";
|
||||
}
|
||||
if(!researchResult['name']) {
|
||||
if (!researchResult['name']) {
|
||||
researchResult['name'] = "[no title available]";
|
||||
}
|
||||
if (relation.hasOwnProperty("dateofacceptance")) {
|
||||
|
@ -449,12 +501,12 @@ export class ParsingFunctions {
|
|||
}
|
||||
//researchResult['date'] = relation.dateofacceptance.substring(0,4);;
|
||||
let percentageName: string;
|
||||
if(relation.trust) {
|
||||
if (relation.trust) {
|
||||
percentageName = "trust";
|
||||
} else if(relation.similarity) {
|
||||
} else if (relation.similarity) {
|
||||
percentageName = "similarity";
|
||||
}
|
||||
if(percentageName) {
|
||||
if (percentageName) {
|
||||
researchResult['percentage'] = Math.round(relation[percentageName] * 100);
|
||||
researchResult['percentageName'] = percentageName;
|
||||
}
|
||||
|
@ -480,7 +532,7 @@ export class ParsingFunctions {
|
|||
if (!identifiers.has(pid.classid)) {
|
||||
identifiers.set(pid.classid, new Array<string>());
|
||||
}
|
||||
identifiers.get(pid.classid).push(pid.content+"");
|
||||
identifiers.get(pid.classid).push(pid.content + "");
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < pid.length; i++) {
|
||||
|
@ -488,7 +540,7 @@ export class ParsingFunctions {
|
|||
if (!identifiers.has(pid[i].classid)) {
|
||||
identifiers.set(pid[i].classid, new Array<string>());
|
||||
}
|
||||
identifiers.get(pid[i].classid).push(pid[i].content+"");
|
||||
identifiers.get(pid[i].classid).push(pid[i].content + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -505,10 +557,10 @@ export class ParsingFunctions {
|
|||
|
||||
for (let i = 0; i < length; i++) {
|
||||
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
|
||||
let content: string = subject.code+"";
|
||||
let content: string = subject.code + "";
|
||||
let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
||||
let found: boolean = checkAndAddEoscSubjectResp["found"];
|
||||
if(found) {
|
||||
if (found) {
|
||||
setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
|
||||
eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
|
||||
}
|
||||
|
@ -518,7 +570,7 @@ export class ParsingFunctions {
|
|||
}
|
||||
|
||||
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
|
||||
parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[], ] {
|
||||
parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[],] {
|
||||
// let eoscSubjectsFound = [];
|
||||
let subjects: string[];
|
||||
let otherSubjects: Map<string, string[]>;
|
||||
|
@ -535,7 +587,7 @@ export class ParsingFunctions {
|
|||
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
|
||||
if (subject.classid != "") {
|
||||
if (subject.classid == "keyword") {
|
||||
let content: string = subject.content+"";
|
||||
let content: string = subject.content + "";
|
||||
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
||||
// let found: boolean = checkAndAddEoscSubjectResp["found"];
|
||||
// if(found) {
|
||||
|
@ -549,22 +601,22 @@ export class ParsingFunctions {
|
|||
// }
|
||||
} else if (!vocabulary || vocabulary[subject.classid] || subject.classid === "SDG" || subject.classid === "FOS") {
|
||||
// if (subject.inferred && subject.inferred == true) {
|
||||
if(subject.classid === "SDG") {
|
||||
if (subject.classid === "SDG") {
|
||||
if (sdg == undefined) {
|
||||
sdg = new Array<string>();
|
||||
}
|
||||
sdg.push(subject.content+"");
|
||||
} else if(subject.classid === "FOS") {
|
||||
sdg.push(subject.content + "");
|
||||
} else if (subject.classid === "FOS") {
|
||||
if (fos == undefined) {
|
||||
fos = new Array<string>();
|
||||
}
|
||||
fos.push(subject.content+"");
|
||||
fos.push(subject.content + "");
|
||||
} else {
|
||||
if (classifiedSubjects == undefined) {
|
||||
classifiedSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
let content: string = subject.content+"";
|
||||
let content: string = subject.content + "";
|
||||
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
||||
// let found: boolean = checkAndAddEoscSubjectResp["found"];
|
||||
// if(found) {
|
||||
|
@ -578,7 +630,7 @@ export class ParsingFunctions {
|
|||
// }
|
||||
}
|
||||
} else {
|
||||
let content: string = subject.content+"";
|
||||
let content: string = subject.content + "";
|
||||
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
|
||||
// let found: boolean = checkAndAddEoscSubjectResp["found"];
|
||||
// if(found) {
|
||||
|
@ -600,7 +652,7 @@ export class ParsingFunctions {
|
|||
checkAndAddEoscSubject(setOfEoscSubjects: Set<string>, eoscSubjectsFound, subject, content) {
|
||||
let found: boolean = false;
|
||||
|
||||
if(!setOfEoscSubjects.has(content)) {
|
||||
if (!setOfEoscSubjects.has(content)) {
|
||||
// looping through our declared array
|
||||
this.eoscSubjects.forEach(item => {
|
||||
if (content && content == item.label) {
|
||||
|
@ -639,7 +691,7 @@ export class ParsingFunctions {
|
|||
|
||||
// initalize if there is concept label or this is the last concept of the category and there were no concepts
|
||||
// otherwise we could have multiple entries for the same category but without concepts
|
||||
if(categoryConcept.label || (numOfConcepts == 0 && j == (length1 - 1))) {
|
||||
if (categoryConcept.label || (numOfConcepts == 0 && j == (length1 - 1))) {
|
||||
contexts[position] = {
|
||||
"labelContext": "", "idContext": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
|
@ -656,10 +708,12 @@ export class ParsingFunctions {
|
|||
numOfConcepts++;
|
||||
}
|
||||
}
|
||||
} else if(category.label || (numOfCategories == 0 && z == (length2 - 1))) {
|
||||
contexts[position] = {"labelContext": "", "idContext": "",
|
||||
} else if (category.label || (numOfCategories == 0 && z == (length2 - 1))) {
|
||||
contexts[position] = {
|
||||
"labelContext": "", "idContext": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"labelConcept": "", "idConcept": ""};
|
||||
"labelConcept": "", "idConcept": ""
|
||||
};
|
||||
contexts[position]['labelContext'] = context.label;
|
||||
contexts[position]['idContext'] = context.id;
|
||||
contexts[position]['labelCategory'] = category.label ? category.label : null;
|
||||
|
@ -671,9 +725,11 @@ export class ParsingFunctions {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
contexts[position] = {"labelContext": "", "idContext": "",
|
||||
contexts[position] = {
|
||||
"labelContext": "", "idContext": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"labelConcept": "", "idConcept": ""};
|
||||
"labelConcept": "", "idConcept": ""
|
||||
};
|
||||
contexts[position]['labelContext'] = context.label;
|
||||
contexts[position]['idContext'] = context.id;
|
||||
contexts[position]['labelCategory'] = null;
|
||||
|
@ -687,11 +743,15 @@ export class ParsingFunctions {
|
|||
}
|
||||
return contexts;
|
||||
}
|
||||
public static getEnermapsConceptId(contexts: any): string{
|
||||
let enermapsconcepts = contexts.filter(c=> {return c.idCategory == "enermaps::selection" && c.idConcept});
|
||||
return enermapsconcepts && enermapsconcepts.length > 0?enermapsconcepts[0].idConcept.split("enermaps::selection::")[1]:null;
|
||||
|
||||
public static getEnermapsConceptId(contexts: any): string {
|
||||
let enermapsconcepts = contexts.filter(c => {
|
||||
return c.idCategory == "enermaps::selection" && c.idConcept
|
||||
});
|
||||
return enermapsconcepts && enermapsconcepts.length > 0 ? enermapsconcepts[0].idConcept.split("enermaps::selection::")[1] : null;
|
||||
// return "hotmaps_heat_tot_curr_density"
|
||||
}
|
||||
|
||||
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
|
||||
if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
|
||||
if (!uniqueTypes.has(instance['instancetype'].classname)) {
|
||||
|
@ -757,10 +817,10 @@ export class ParsingFunctions {
|
|||
citations = Array.isArray(citations) ? citations : [citations];
|
||||
citations.forEach(citation => {
|
||||
let reference: Reference = {name: null, ids: []};
|
||||
if(citation.rawText) {
|
||||
if (citation.rawText) {
|
||||
reference.name = citation.rawText;
|
||||
}
|
||||
if(citation.id) {
|
||||
if (citation.id) {
|
||||
let ids: any[] = Array.isArray(citation.id) ? citation.id : [citation.id];
|
||||
ids.forEach(id => {
|
||||
reference.ids.push({
|
||||
|
@ -774,35 +834,117 @@ export class ParsingFunctions {
|
|||
});
|
||||
return references;
|
||||
}
|
||||
static parseRelCanonicalId(record, type){
|
||||
try{
|
||||
if(record["result"]["metadata"]["oaf:entity"][("oaf:"+type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:"+type)]["children"][type]){
|
||||
for(let child of record["result"]["metadata"]["oaf:entity"][("oaf:"+type)]["children"][type]){
|
||||
|
||||
static parseRelCanonicalId(record, type) {
|
||||
try {
|
||||
if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
|
||||
for (let child of record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
|
||||
return child["objidentifier"];
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
// console.error(e);
|
||||
}
|
||||
return record["result"]["header"]["dri:objIdentifier"];
|
||||
|
||||
}
|
||||
|
||||
parseDescription(description, stripHTML: boolean = false):string {
|
||||
parseDescription(description, stripHTML: boolean = false): string {
|
||||
let abstracts = [];
|
||||
if(!Array.isArray(description)) {
|
||||
if (!Array.isArray(description)) {
|
||||
abstracts = [description ? String(description) : ""];
|
||||
} else {
|
||||
abstracts = description.map( x => String(x));
|
||||
abstracts = description.map(x => String(x));
|
||||
}
|
||||
try{
|
||||
abstracts = abstracts.map( x => StringUtils.HTMLToString(x));
|
||||
} catch (e) {}
|
||||
abstracts = abstracts.sort((a,b) => b.length - a.length);
|
||||
if(stripHTML) {
|
||||
try {
|
||||
abstracts = abstracts.map(x => StringUtils.HTMLToString(x));
|
||||
} catch (e) {
|
||||
}
|
||||
abstracts = abstracts.sort((a, b) => b.length - a.length);
|
||||
if (stripHTML) {
|
||||
return abstracts.join(' ');
|
||||
} else {
|
||||
return abstracts.length > 0 ? ('<p>' + abstracts.join('</p> <p>') + '</p>') : abstracts.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
parseMeasures(measures: any[]): Measure {
|
||||
if (measures.length) {
|
||||
let parsed: Measure = {
|
||||
"downloads": null,
|
||||
"views": null,
|
||||
"popularity": null,
|
||||
"influence": null,
|
||||
"citations": null,
|
||||
"impulse": null
|
||||
};
|
||||
measures.forEach(measure => {
|
||||
if (measure.id == 'downloads') {
|
||||
// parsed.downloads = measure.count == 0 ? ' - ' : measure.count;
|
||||
parsed.downloads = measure.count;
|
||||
}
|
||||
if (measure.id == 'views') {
|
||||
// parsed.views = measure.count == 0 ? ' - ' : measure.count;
|
||||
parsed.views = measure.count;
|
||||
}
|
||||
if (measure.id == 'influence') {
|
||||
if (measure.class == 'C1') {
|
||||
parsed.influence = 'Top 0.01%';
|
||||
} else if (measure.class == 'C2') {
|
||||
parsed.influence = 'Top 0.1%';
|
||||
} else if (measure.class == 'C3') {
|
||||
parsed.influence = 'Top 1%';
|
||||
} else if (measure.class == 'C4') {
|
||||
parsed.influence = 'Top 10%';
|
||||
} else if (measure.class == 'A') {
|
||||
parsed.influence = 'Exceptional';
|
||||
} else if (measure.class == 'B') {
|
||||
parsed.influence = 'Substantial';
|
||||
} else {
|
||||
parsed.influence = 'Average';
|
||||
}
|
||||
}
|
||||
if (measure.id == 'popularity') {
|
||||
if (measure.class == 'C1') {
|
||||
parsed.popularity = 'Top 0.01%';
|
||||
} else if (measure.class == 'C2') {
|
||||
parsed.popularity = 'Top 0.1%';
|
||||
} else if (measure.class == 'C3') {
|
||||
parsed.popularity = 'Top 1%';
|
||||
} else if (measure.class == 'C4') {
|
||||
parsed.popularity = 'Top 10%';
|
||||
} else if (measure.class == 'A') {
|
||||
parsed.popularity = 'Exceptional';
|
||||
} else if (measure.class == 'B') {
|
||||
parsed.popularity = 'Substantial';
|
||||
} else {
|
||||
parsed.popularity = 'Average';
|
||||
}
|
||||
}
|
||||
if (measure.id == 'influence_alt') {
|
||||
// parsed['citations'] = measure.score == 0 ? ' - ' : measure.score;
|
||||
parsed.citations = measure.score;
|
||||
}
|
||||
if (measure.id == 'impulse') {
|
||||
if (measure.class == 'C1') {
|
||||
parsed.impulse = 'Top 0.01%';
|
||||
} else if (measure.class == 'C2') {
|
||||
parsed.impulse = 'Top 0.1%';
|
||||
} else if (measure.class == 'C3') {
|
||||
parsed.impulse = 'Top 1%';
|
||||
} else if (measure.class == 'C4') {
|
||||
parsed.impulse = 'Top 10%';
|
||||
} else if (measure.class == 'A') {
|
||||
parsed.impulse = 'Exceptional';
|
||||
} else if (measure.class == 'B') {
|
||||
parsed.impulse = 'Substantial';
|
||||
} else {
|
||||
parsed.impulse = 'Average';
|
||||
}
|
||||
}
|
||||
});
|
||||
return parsed;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
|||
@Injectable()
|
||||
export class ResultLandingService {
|
||||
|
||||
constructor(private http: HttpClient ) {
|
||||
constructor(private http: HttpClient) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ export class ResultLandingService {
|
|||
} else if (identifier) {
|
||||
// pid = "10.3389/fphys.2014.00466";
|
||||
let url = properties.searchAPIURLLAst + "resources2";
|
||||
url += "?pid="+encodeURIComponent(identifier.id) + "&pidtype=" + identifier.class + "&type=";
|
||||
url += "?pid=" + encodeURIComponent(identifier.id) + "&pidtype=" + identifier.class + "&type=";
|
||||
if (type === 'publication') {
|
||||
url += 'publications';
|
||||
} else if (type === 'dataset') {
|
||||
|
@ -56,7 +56,7 @@ export class ResultLandingService {
|
|||
}
|
||||
}
|
||||
|
||||
getResultLandingInfo (id: string, identifier: Identifier, type: string,
|
||||
getResultLandingInfo(id: string, identifier: Identifier, type: string,
|
||||
subjectsVocabulary: any,
|
||||
properties: EnvProperties): any {
|
||||
let url: string = this.buildResultLandingInfoUrl(id, identifier, type);
|
||||
|
@ -64,13 +64,13 @@ export class ResultLandingService {
|
|||
let finalUrl: string = (properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url;
|
||||
return this.http.get(finalUrl)
|
||||
.pipe(map(res => {
|
||||
if(!id && identifier) {
|
||||
if(!res['results'] || res['results'].length == 0) {
|
||||
if (!id && identifier) {
|
||||
if (!res['results'] || res['results'].length == 0) {
|
||||
throw new HttpErrorResponse({
|
||||
status: 404,
|
||||
statusText: "Not found",
|
||||
url: finalUrl,
|
||||
error: "Http failure response for "+finalUrl+": 404 Not Found"
|
||||
error: "Http failure response for " + finalUrl + ": 404 Not Found"
|
||||
});
|
||||
}
|
||||
return res['results'][0];
|
||||
|
@ -91,7 +91,7 @@ export class ResultLandingService {
|
|||
res[1]['oaf:result']['subject'], // 8
|
||||
res[1]['oaf:result']['context'], // 9
|
||||
res[1]['oaf:result']['creator'], // 10
|
||||
res[1]['oaf:result']['country'] , // 11
|
||||
res[1]['oaf:result']['country'], // 11
|
||||
res[1]['oaf:result']['programmingLanguage'], // 12 - software
|
||||
//res[1]['oaf:result']['resulttype'],
|
||||
(res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['references'] !== undefined)
|
||||
|
@ -118,14 +118,14 @@ export class ResultLandingService {
|
|||
// return provenanceActionVocabulary;
|
||||
// }
|
||||
|
||||
private handleError (error: HttpErrorResponse) {
|
||||
private handleError(error: HttpErrorResponse) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return throwError(error || 'Server error');
|
||||
}
|
||||
|
||||
parseResultLandingInfo (data: any, subjectsVocabulary: any, properties: EnvProperties): any {
|
||||
parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any {
|
||||
this.resultLandingInfo = new ResultLandingInfo();
|
||||
// res
|
||||
this.resultLandingInfo.record = data[15];
|
||||
|
@ -137,24 +137,24 @@ export class ResultLandingService {
|
|||
if (data[0] != null) {
|
||||
let date: string = (data[0].dateofacceptance ? data[0].dateofacceptance : '') + ''; // transform to string in case it is an integer
|
||||
this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
|
||||
this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance?Dates.getDate(data[0].dateofacceptance):null;
|
||||
this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance ? Dates.getDate(data[0].dateofacceptance) : null;
|
||||
this.resultLandingInfo.publisher = data[0].publisher;
|
||||
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description?data[0].description:[]);
|
||||
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate?Dates.getDate(data[0].embargoenddate):null;
|
||||
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description ? data[0].description : []);
|
||||
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate ? Dates.getDate(data[0].embargoenddate) : null;
|
||||
}
|
||||
|
||||
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) {
|
||||
if (data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) {
|
||||
this.resultLandingInfo.accessMode = data[0]['bestaccessright'].classname;
|
||||
}
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['title']
|
||||
if(data[1] != null) {
|
||||
if(Array.isArray(data[1])) {
|
||||
for(let i=0; i<data[1].length; i++) {
|
||||
if(data[1][i] && data[1][i].content) {
|
||||
if(!this.resultLandingInfo.title || data[1][i].classid == "main title") {
|
||||
if (data[1] != null) {
|
||||
if (Array.isArray(data[1])) {
|
||||
for (let i = 0; i < data[1].length; i++) {
|
||||
if (data[1][i] && data[1][i].content) {
|
||||
if (!this.resultLandingInfo.title || data[1][i].classid == "main title") {
|
||||
this.resultLandingInfo.title = StringUtils.HTMLToString(String(data[1][i].content));
|
||||
}
|
||||
if(!this.resultLandingInfo.subtitle && data[1][i].classid === 'subtitle') {
|
||||
if (!this.resultLandingInfo.subtitle && data[1][i].classid === 'subtitle') {
|
||||
this.resultLandingInfo.subtitle = StringUtils.HTMLToString(String(data[1][i].content));
|
||||
}
|
||||
// if(data[1][i].classid == "main title") {
|
||||
|
@ -162,10 +162,10 @@ export class ResultLandingService {
|
|||
// }
|
||||
}
|
||||
}
|
||||
if(this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
|
||||
if (this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
|
||||
this.resultLandingInfo.subtitle = "";
|
||||
}
|
||||
if(!this.resultLandingInfo.title) {
|
||||
if (!this.resultLandingInfo.title) {
|
||||
this.resultLandingInfo.title = "";
|
||||
}
|
||||
// this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : "";
|
||||
|
@ -175,26 +175,26 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel']
|
||||
if(data[2] != null) {
|
||||
if (data[2] != null) {
|
||||
let relation;
|
||||
let length = Array.isArray(data[2]) ? data[2].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
relation = Array.isArray(data[2]) ? data[2][i] : data[2];
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
|
||||
if (relation.hasOwnProperty("to")) {
|
||||
if (relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
|
||||
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation);
|
||||
}
|
||||
if(relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
|
||||
if (relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
|
||||
let relationName: string = relation.to.class;
|
||||
if(!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
|
||||
if (!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
|
||||
this.resultLandingInfo.relatedClassFilters.add(relationName);
|
||||
}
|
||||
|
||||
let provenanceAction: string = relation.provenanceaction;
|
||||
|
||||
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
|
||||
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
|
||||
} else if (relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
|
||||
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
|
||||
}
|
||||
}
|
||||
|
@ -202,19 +202,19 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['children']
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("result")) {
|
||||
if (data[3] != null) {
|
||||
if (data[3].hasOwnProperty("result")) {
|
||||
this.resultLandingInfo.deletedByInferenceIds = [];
|
||||
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
|
||||
this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
if (data[3].hasOwnProperty("instance")) {
|
||||
this.resultLandingInfo.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
|
||||
|
||||
|
||||
|
@ -226,26 +226,24 @@ export class ResultLandingService {
|
|||
|
||||
let length = Array.isArray(data[3]['instance']) ? data[3]['instance'].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance);
|
||||
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
if (instance.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(!Array.isArray(instance['webresource'])) {
|
||||
if (!Array.isArray(instance['webresource'])) {
|
||||
url = instance['webresource'].url;
|
||||
} else {
|
||||
url = instance['webresource'][0].url;
|
||||
}
|
||||
if(url.includes('&')) {
|
||||
let regExp = /&/gmu;
|
||||
let newUrl = url.replace(regExp, '&');
|
||||
url = newUrl;
|
||||
if (url.includes('&')) {
|
||||
url = url.replace(/&/gmu, '&');
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
if (instance.hasOwnProperty("hostedby")) {
|
||||
this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode);
|
||||
}
|
||||
/**********************************************************/
|
||||
|
@ -253,57 +251,32 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
/* Order Download from via openness*/
|
||||
this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => {
|
||||
let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
|
||||
let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
|
||||
|
||||
if (firstAccessRight === secondAccessRight) {
|
||||
return 0;
|
||||
} else {
|
||||
if (firstAccessRight === 'open access') {
|
||||
return -1;
|
||||
} else if (secondAccessRight === 'open access') {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "open source") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "open source") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "embargo") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "embargo") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "restricted") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "restricted") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "closed access") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "closed access") {
|
||||
return 1;
|
||||
} else if (firstAccessRight === "not available") {
|
||||
return -1;
|
||||
} else if (secondAccessRight === "not available") {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
this.resultLandingInfo.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
|
||||
}
|
||||
|
||||
if(data[3].hasOwnProperty("externalreference")) {
|
||||
if (data[3].hasOwnProperty("externalreference")) {
|
||||
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(data[3]);
|
||||
this.resultLandingInfo.bioentities = externalResults;
|
||||
}
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['pid']
|
||||
if(data[4] != null) {
|
||||
if (data[4] != null) {
|
||||
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['journal']
|
||||
if(data[5] != null) {
|
||||
this.resultLandingInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": "", "issue": "", "volume": "", "start_page": "", "end_page": ""}
|
||||
if (data[5] != null) {
|
||||
this.resultLandingInfo.journal = {
|
||||
"journal": "",
|
||||
"issn": "",
|
||||
"lissn": "",
|
||||
"eissn": "",
|
||||
"issue": "",
|
||||
"volume": "",
|
||||
"start_page": "",
|
||||
"end_page": ""
|
||||
}
|
||||
|
||||
this.resultLandingInfo.journal['journal'] = data[5].content;
|
||||
this.resultLandingInfo.journal['issn'] = data[5].issn;
|
||||
|
@ -316,7 +289,7 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['language']
|
||||
if(data[6] != null) {
|
||||
if (data[6] != null) {
|
||||
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(data[6]);
|
||||
// let languagesAndCodes: string[][] = this.parsingFunctions.parseLanguages(data[6]);
|
||||
// this.resultLandingInfo.languages = languagesAndCodes[0];
|
||||
|
@ -324,27 +297,27 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['country']
|
||||
if(data[11] != null) {
|
||||
if (data[11] != null) {
|
||||
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(data[11]);
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['eoscifguidelines']
|
||||
if(data[7] != null) {
|
||||
if (data[7] != null) {
|
||||
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(data[7]);
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['subject']
|
||||
if(data[8] != null) {
|
||||
if (data[8] != null) {
|
||||
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary);
|
||||
this.resultLandingInfo.subjects = subjectResults[0];
|
||||
this.resultLandingInfo.otherSubjects = subjectResults[1];
|
||||
this.resultLandingInfo.classifiedSubjects = subjectResults[2];
|
||||
this.resultLandingInfo.fos = subjectResults[3];
|
||||
if(this.resultLandingInfo.fos) {
|
||||
if (this.resultLandingInfo.fos) {
|
||||
this.resultLandingInfo.fos.sort((a, b) => a.localeCompare(b))
|
||||
}
|
||||
this.resultLandingInfo.sdg = subjectResults[4];
|
||||
if(this.resultLandingInfo.sdg) {
|
||||
if (this.resultLandingInfo.sdg) {
|
||||
this.resultLandingInfo.sdg.sort((a, b) => {
|
||||
return HelperFunctions.sortSDGs(a, b);
|
||||
})
|
||||
|
@ -357,49 +330,53 @@ export class ResultLandingService {
|
|||
|
||||
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
|
||||
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
|
||||
this.resultLandingInfo.journal, this.resultLandingInfo.identifiers);
|
||||
this.resultLandingInfo.journal.journal, this.resultLandingInfo.identifiers);
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['programmingLanguage']
|
||||
if(data[12] != null) {
|
||||
if (data[12] != null) {
|
||||
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(data[12]);
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['extraInfo']['references']['reference']
|
||||
if(data[13] != null) {
|
||||
if (data[13] != null) {
|
||||
this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]);
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['context']
|
||||
if(data[9] != null) {
|
||||
if (data[9] != null) {
|
||||
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data[9]);
|
||||
}
|
||||
|
||||
// res['result']['header']['dri:status']
|
||||
if(data[14] != null && data[14] == "under curation") {
|
||||
if (data[14] != null && data[14] == "under curation") {
|
||||
this.resultLandingInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.resultLandingInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['creator']
|
||||
if(data[10] != null) {
|
||||
if(this.resultLandingInfo.authors == undefined) {
|
||||
this.resultLandingInfo.authors = new Array<{"fullName": string, "orcid": string, "orcid_pending": string}>();
|
||||
if (data[10] != null) {
|
||||
if (this.resultLandingInfo.authors == undefined) {
|
||||
this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
|
||||
}
|
||||
|
||||
let authors = data[10];
|
||||
let length = Array.isArray(authors) ? authors.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||
if(author) {
|
||||
if(author.orcid) {
|
||||
if (author) {
|
||||
if (author.orcid) {
|
||||
author.orcid = author.orcid.toUpperCase();
|
||||
}
|
||||
if(author.orcid_pending) {
|
||||
if (author.orcid_pending) {
|
||||
author.orcid_pending = author.orcid_pending.toUpperCase();
|
||||
}
|
||||
this.resultLandingInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending};
|
||||
this.resultLandingInfo['authors'][author.rank] = {
|
||||
"fullName": author.content,
|
||||
"orcid": author.orcid,
|
||||
"orcid_pending": author.orcid_pending
|
||||
};
|
||||
}
|
||||
}
|
||||
this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) {
|
||||
|
@ -408,75 +385,8 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['measure']
|
||||
if (data[0] != null) {
|
||||
if (data[0].measure?.length) {
|
||||
this.resultLandingInfo.measure = {"downloads": null, "views": null, "popularity": null, "influence": null, "citations": null, "impulse": null};
|
||||
for (let i = 0; i < data[0].measure.length; i++) {
|
||||
if (data[0].measure[i].id == 'downloads') {
|
||||
// this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count;
|
||||
this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count;
|
||||
}
|
||||
if (data[0].measure[i].id == 'views') {
|
||||
// this.resultLandingInfo.measure['views'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count;
|
||||
this.resultLandingInfo.measure['views'] = data[0].measure[i].count;
|
||||
}
|
||||
if (data[0].measure[i].id == 'influence') {
|
||||
if (data[0].measure[i].class == 'C1') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Top 0.01%';
|
||||
} else if (data[0].measure[i].class == 'C2') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Top 0.1%';
|
||||
} else if (data[0].measure[i].class == 'C3') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Top 1%';
|
||||
} else if (data[0].measure[i].class == 'C4') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Top 10%';
|
||||
} else if (data[0].measure[i].class == 'A') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Exceptional';
|
||||
} else if (data[0].measure[i].class == 'B') {
|
||||
this.resultLandingInfo.measure['influence'] = 'Substantial';
|
||||
} else {
|
||||
this.resultLandingInfo.measure['influence'] = 'Average';
|
||||
}
|
||||
}
|
||||
if (data[0].measure[i].id == 'popularity') {
|
||||
if (data[0].measure[i].class == 'C1') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Top 0.01%';
|
||||
} else if (data[0].measure[i].class == 'C2') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Top 0.1%';
|
||||
} else if (data[0].measure[i].class == 'C3') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Top 1%';
|
||||
} else if (data[0].measure[i].class == 'C4') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Top 10%';
|
||||
} else if (data[0].measure[i].class == 'A') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Exceptional';
|
||||
} else if (data[0].measure[i].class == 'B') {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Substantial';
|
||||
} else {
|
||||
this.resultLandingInfo.measure['popularity'] = 'Average';
|
||||
}
|
||||
}
|
||||
if (data[0].measure[i].id == 'influence_alt') {
|
||||
// this.resultLandingInfo.measure['citations'] = data[0].measure[i].score == 0 ? ' - ' : data[0].measure[i].score;
|
||||
this.resultLandingInfo.measure['citations'] = data[0].measure[i].score;
|
||||
}
|
||||
if (data[0].measure[i].id == 'impulse') {
|
||||
if (data[0].measure[i].class == 'C1') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Top 0.01%';
|
||||
} else if (data[0].measure[i].class == 'C2') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Top 0.1%';
|
||||
} else if (data[0].measure[i].class == 'C3') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Top 1%';
|
||||
} else if (data[0].measure[i].class == 'C4') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Top 10%';
|
||||
} else if (data[0].measure[i].class == 'A') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Exceptional';
|
||||
} else if (data[0].measure[i].class == 'B') {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Substantial';
|
||||
} else {
|
||||
this.resultLandingInfo.measure['impulse'] = 'Average';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data[0]?.measure) {
|
||||
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
|
||||
}
|
||||
|
||||
this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
|
||||
|
@ -485,11 +395,12 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
parseRelatedOrganizations(organizations: Organization[], relation: any): Organization[] {
|
||||
if(organizations == undefined) {
|
||||
if (organizations == undefined) {
|
||||
organizations = []
|
||||
}
|
||||
|
||||
let organization: { "name": string, "shortname": string,
|
||||
let organization: {
|
||||
"name": string, "shortname": string,
|
||||
"id": string, "websiteUrl": string,
|
||||
"country": string, "trust": number
|
||||
} = {
|
||||
|
@ -502,34 +413,34 @@ export class ResultLandingService {
|
|||
organization.name = relation.legalname;
|
||||
organization.shortname = relation.legalshortname;
|
||||
organization.websiteUrl = relation.websiteurl;
|
||||
if(relation.country) {
|
||||
if (relation.country) {
|
||||
organization.country = relation.country.classname;
|
||||
}
|
||||
if(relation.trust) {
|
||||
organization.trust = Math.round(relation.trust*100);
|
||||
if (relation.trust) {
|
||||
organization.trust = Math.round(relation.trust * 100);
|
||||
}
|
||||
|
||||
organizations.push(organization);
|
||||
return organizations;
|
||||
}
|
||||
|
||||
parseBioentitiesAndSoftware(children: any) : Map<string, Map<string, string>> {
|
||||
parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> {
|
||||
let bioentities: Map<string, Map<string, string>>;
|
||||
|
||||
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1;
|
||||
|
||||
let externalreference;
|
||||
for(let i=0; i<length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference'];
|
||||
|
||||
if(externalreference.hasOwnProperty("qualifier")) {
|
||||
if(externalreference['qualifier'].classid == "accessionNumber") {
|
||||
if (externalreference.hasOwnProperty("qualifier")) {
|
||||
if (externalreference['qualifier'].classid == "accessionNumber") {
|
||||
|
||||
if(bioentities == undefined) {
|
||||
if (bioentities == undefined) {
|
||||
bioentities = new Map<string, Map<string, string>>();
|
||||
}
|
||||
|
||||
if(!bioentities.has(externalreference.sitename)) {
|
||||
if (!bioentities.has(externalreference.sitename)) {
|
||||
bioentities.set(externalreference.sitename, new Map<string, string>());
|
||||
}
|
||||
bioentities.get(externalreference.sitename).set(externalreference.refidentifier, externalreference.url);
|
||||
|
@ -542,8 +453,8 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
getEnermapsDetails(id: string) {
|
||||
let url = properties.enermapsURL+"/api/db/metadata?shared_id=eq."+id;
|
||||
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||
let url = properties.enermapsURL + "/api/db/metadata?shared_id=eq." + id;
|
||||
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
// return this.http.get(url)
|
||||
.pipe(map(res => this.parseEnermapsDetails(res)));
|
||||
}
|
||||
|
@ -554,9 +465,9 @@ export class ResultLandingService {
|
|||
|
||||
let entries = [];
|
||||
let keys = metadata ? Object.keys(metadata) : null;
|
||||
for(let key of keys) {
|
||||
if(key != "shared_id" && key && metadata[key]) {
|
||||
entries.push([key+"", metadata[key]+""]);
|
||||
for (let key of keys) {
|
||||
if (key != "shared_id" && key && metadata[key]) {
|
||||
entries.push([key + "", metadata[key] + ""]);
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<ul class="uk-list uk-list-xlarge uk-margin" [ngClass]="custom_class">
|
||||
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
|
||||
<li *ngFor="let result of previewResults">
|
||||
<li *ngFor="let result of previewResults" [class.uk-border-bottom]="!isMobile">
|
||||
<result-preview [properties]="properties" [showOrganizations]="showOrganizations"
|
||||
[showSubjects]="showSubjects" [result]="result" [showEnermaps]="showEnermaps"
|
||||
[isCard]="true">
|
||||
[isCard]="isMobile" [isMobile]="isMobile">
|
||||
</result-preview>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -2,10 +2,11 @@ import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'
|
|||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {OrcidService} from "../../orcid/orcid.service";
|
||||
import {Session} from "../../login/utils/helper.class";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'search-result',
|
||||
|
@ -13,7 +14,7 @@ import {properties} from "../../../../environments/environment";
|
|||
})
|
||||
export class SearchResultComponent implements OnInit, OnChanges {
|
||||
@Input() results: SearchResult[];
|
||||
previewResults:ResultPreview[];
|
||||
previewResults: ResultPreview[];
|
||||
@Input() status: number;
|
||||
@Input() type: string;
|
||||
@Input() showLoading: boolean = false;
|
||||
|
@ -22,50 +23,26 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
@Input() custom_class: string = "";
|
||||
@Input() properties: EnvProperties;
|
||||
@Input() showEnermaps: boolean;
|
||||
public isMobile: boolean = false;
|
||||
private subscriptions: any[] = [];
|
||||
|
||||
constructor( private http: HttpClient/*ATHENA CODE*/
|
||||
, private orcidService: OrcidService) {
|
||||
constructor(private orcidService: OrcidService,
|
||||
private layoutService: LayoutService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
|
||||
this.isMobile = isMobile;
|
||||
}));
|
||||
console.log(this.results);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
sub;
|
||||
ngOnDestroy() {
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
initialize(){
|
||||
this.previewResults = [];
|
||||
for(let result of this.results){
|
||||
this.previewResults.push(this.getResultPreview(result));
|
||||
}
|
||||
|
||||
if((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator")
|
||||
&& Session.isLoggedIn() && this.results && this.results.length > 0
|
||||
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
|
||||
) {
|
||||
this.orcidService.getPutCodes(this.previewResults.map(
|
||||
previewResult => {
|
||||
if(previewResult.identifiers) {
|
||||
let pidsArray: string[] = [];
|
||||
for(let key of Array.from(previewResult.identifiers.keys())) {
|
||||
pidsArray = pidsArray.concat(previewResult.identifiers.get(key));
|
||||
}
|
||||
return pidsArray;//.join();
|
||||
}
|
||||
})).subscribe(
|
||||
putCodes => {
|
||||
for (let i = 0; i < this.previewResults.length; i++) {
|
||||
if(this.previewResults[i].identifiers) {
|
||||
this.previewResults[i].orcidPutCodes = putCodes[i];
|
||||
// console.debug(i, this.previewResults[i].orcidPutCodes);
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
|
||||
}
|
||||
);
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if(subscription instanceof Subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
|
@ -73,8 +50,43 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
this.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.previewResults = [];
|
||||
for (let result of this.results) {
|
||||
this.previewResults.push(this.getResultPreview(result));
|
||||
}
|
||||
|
||||
if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator")
|
||||
&& Session.isLoggedIn() && this.results && this.results.length > 0
|
||||
&& (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other")
|
||||
) {
|
||||
this.subscriptions.push(this.orcidService.getPutCodes(this.previewResults.map(
|
||||
previewResult => {
|
||||
if (previewResult.identifiers) {
|
||||
let pidsArray: string[] = [];
|
||||
for (let key of Array.from(previewResult.identifiers.keys())) {
|
||||
pidsArray = pidsArray.concat(previewResult.identifiers.get(key));
|
||||
}
|
||||
return pidsArray;//.join();
|
||||
}
|
||||
})).subscribe(
|
||||
putCodes => {
|
||||
for (let i = 0; i < this.previewResults.length; i++) {
|
||||
if (this.previewResults[i].identifiers) {
|
||||
this.previewResults[i].orcidPutCodes = putCodes[i];
|
||||
// console.debug(i, this.previewResults[i].orcidPutCodes);
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public getResultPreview(result: SearchResult): ResultPreview {
|
||||
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
|
||||
return ResultPreview.searchResultConvert(result, (result.entityType) ? result.entityType : this.type);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import {ParsingFunctions} from '../landingPages/landing-utils/parsingFunctions.c
|
|||
import {EnvProperties} from '../utils/properties/env-properties';
|
||||
import {map} from "rxjs/operators";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {HostedByCollectedFrom} from "../utils/result-preview/result-preview";
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class SearchResearchResultsService {
|
||||
private sizeOfDescription: number = 270;
|
||||
public parsingFunctions: ParsingFunctions = new ParsingFunctions();
|
||||
|
||||
constructor(private http: HttpClient=null) {
|
||||
constructor(private http: HttpClient = null) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,7 +174,7 @@ export class SearchResearchResultsService {
|
|||
|
||||
parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] {
|
||||
let results: SearchResult[] = [];
|
||||
if(data == null) {
|
||||
if (data == null) {
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -189,71 +189,73 @@ export class SearchResearchResultsService {
|
|||
} else {
|
||||
result.entityType = resultType;
|
||||
}
|
||||
|
||||
result['title'] = {"name": '', "accessMode": ''};
|
||||
|
||||
if (Array.isArray(resData['title'])) {
|
||||
for (let i = 0; i < resData['title'].length; i++) {
|
||||
if (resData['title'][i] && resData['title'][i].content) {
|
||||
if (!result.title.name || resData['title'][i].classid == "main title") {
|
||||
result['title'].name = StringUtils.HTMLToString(String(resData['title'][i].content));
|
||||
}
|
||||
if (resData['title'][i].classid == "main title") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result.title.name) {
|
||||
result['title'].name = "";
|
||||
}
|
||||
// result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : "";
|
||||
} else {
|
||||
result['title'].name = (resData['title'] && resData['title'].content) ? StringUtils.HTMLToString(String(resData['title'].content)) : "";
|
||||
}
|
||||
|
||||
if (resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
|
||||
result['title'].accessMode = resData['bestaccessright'].classname;
|
||||
}
|
||||
|
||||
result.types = new Array<string>();
|
||||
let types = new Set<string>();
|
||||
|
||||
let instance;
|
||||
let length = Array.isArray(resData['children']['instance']) ? resData['children']['instance'].length : 1;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance'];
|
||||
this.parsingFunctions.parseTypes(result.types, types, instance);
|
||||
if(instance?.hasOwnProperty("hostedby")) {
|
||||
result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
let url = Array.isArray(instance['webresource'])?instance['webresource'][0].url:instance['webresource'].url;
|
||||
if(url.includes('&')) {
|
||||
url = url.replace(/&/gmu, '&');
|
||||
}
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.title.accessMode);
|
||||
}
|
||||
result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
|
||||
}
|
||||
}
|
||||
let journal = resData['journal']?resData['journal'].content:null;
|
||||
result.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
|
||||
result.hostedBy_collectedFrom, result.publisher,
|
||||
journal, result.identifiers);
|
||||
}
|
||||
// Measure
|
||||
result.measure = new Array<string>();
|
||||
if (resData['measure'] && Array.isArray(resData['measure'])) {
|
||||
for (let i = 0; i < resData['measure'].length; i++) {
|
||||
if (resData['measure'][i].id == 'influence') {
|
||||
result.measure[1] = resData['measure'][i].class;
|
||||
if (resData['measure'][i].class == 'C1') {
|
||||
result.measure[3] = 'Top 0.01% in';
|
||||
} else if (resData['measure'][i].class == 'C2') {
|
||||
result.measure[3] = 'Top 0.1% in';
|
||||
} else if (resData['measure'][i].class == 'C3') {
|
||||
result.measure[3] = 'Top 1% in';
|
||||
} else if (resData['measure'][i].class == 'C4') {
|
||||
result.measure[3] = 'Top 10% in';
|
||||
} else if (resData['measure'][i].class == 'A') {
|
||||
result.measure[3] = 'Exceptional';
|
||||
} else if (resData['measure'][i].class == 'B') {
|
||||
result.measure[3] = 'Substantial';
|
||||
} else {
|
||||
result.measure[3] = 'Average';
|
||||
}
|
||||
}
|
||||
if (resData['measure'][i].id == 'popularity') {
|
||||
result.measure[0] = resData['measure'][i].class;
|
||||
if (resData['measure'][i].class == 'C1') {
|
||||
result.measure[2] = 'Top 0.01% in';
|
||||
} else if (resData['measure'][i].class == 'C2') {
|
||||
result.measure[2] = 'Top 0.1% in';
|
||||
} else if (resData['measure'][i].class == 'C3') {
|
||||
result.measure[2] = 'Top 1% in';
|
||||
} else if (resData['measure'][i].class == 'C4') {
|
||||
result.measure[2] = 'Top 10% in';
|
||||
} else if (resData['measure'][i].class == 'A') {
|
||||
result.measure[2] = 'Exceptional';
|
||||
} else if (resData['measure'][i].class == 'B') {
|
||||
result.measure[2] = 'Substantial';
|
||||
} else {
|
||||
result.measure[2] = 'Average';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
|
||||
/////////////////////////// Athena Code ///////////////////////////
|
||||
if (resData['pid']) {
|
||||
if (!Array.isArray(resData['pid'])) {
|
||||
if (resData['pid'].classid && resData['pid'].classid == 'doi') {
|
||||
if (resData['pid'].content != '' && resData['pid'].content != null) {
|
||||
result.DOIs.push((resData['pid'].content+"").replace("https://doi.org/", ""));
|
||||
result.DOIs.push((resData['pid'].content + "").replace("https://doi.org/", ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['pid'].length; i++) {
|
||||
if (resData['pid'][i].classid == 'doi') {
|
||||
if (resData['pid'][i].content != '' && resData['pid'][i].content != null && resData['pid'][i].content) {
|
||||
result.DOIs.push((resData['pid'][i].content+"").replace("https://doi.org/", ""));
|
||||
result.DOIs.push((resData['pid'][i].content + "").replace("https://doi.org/", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,27 +311,6 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
}
|
||||
|
||||
result['title'] = {"name": '', "accessMode": ''};
|
||||
|
||||
if (Array.isArray(resData['title'])) {
|
||||
for (let i = 0; i < resData['title'].length; i++) {
|
||||
if (resData['title'][i] && resData['title'][i].content) {
|
||||
if (!result.title.name || resData['title'][i].classid == "main title") {
|
||||
result['title'].name = StringUtils.HTMLToString(String(resData['title'][i].content));
|
||||
}
|
||||
if (resData['title'][i].classid == "main title") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result.title.name) {
|
||||
result['title'].name = "";
|
||||
}
|
||||
// result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : "";
|
||||
} else {
|
||||
result['title'].name = (resData['title'] && resData['title'].content) ? StringUtils.HTMLToString(String(resData['title'].content)) : "";
|
||||
}
|
||||
|
||||
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
result['objId'] = result['id'];
|
||||
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result");
|
||||
|
@ -338,9 +319,6 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
result['relcanId'] = result['id'];
|
||||
|
||||
if (resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
|
||||
result['title'].accessMode = resData['bestaccessright'].classname;
|
||||
}
|
||||
if (resData['rels'].hasOwnProperty("rel")) {
|
||||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
|
@ -366,10 +344,10 @@ export class SearchResearchResultsService {
|
|||
for (let i = 0; i < length; i++) {
|
||||
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||
if (author) {
|
||||
if(author.orcid) {
|
||||
if (author.orcid) {
|
||||
author.orcid = author.orcid.toUpperCase();
|
||||
}
|
||||
if(author.orcid_pending) {
|
||||
if (author.orcid_pending) {
|
||||
author.orcid_pending = author.orcid_pending.toUpperCase();
|
||||
}
|
||||
result['authors'][author.rank] = {
|
||||
|
@ -408,7 +386,7 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(resData['context'] != null) {
|
||||
if (resData['context'] != null) {
|
||||
result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context']));
|
||||
}
|
||||
results.push(result);
|
||||
|
@ -578,7 +556,7 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
|
||||
public countCollectedResultsWithFundingInfo(datasourceId: string) {
|
||||
let url = properties.searchAPIURLLAst + "resources?query=" + encodeURIComponent("(oaftype=result and collectedfromdatasourceid exact \""+datasourceId+"\" and relprojectid=*)") + "&page=0&size=0&format=json";
|
||||
let url = properties.searchAPIURLLAst + "resources?query=" + encodeURIComponent("(oaftype=result and collectedfromdatasourceid exact \"" + datasourceId + "\" and relprojectid=*)") + "&page=0&size=0&format=json";
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import {Author, Organization, Project, ResultTitle} from "../result-preview/result-preview";
|
||||
import {Author, HostedByCollectedFrom, Organization, Project, ResultTitle} from "../result-preview/result-preview";
|
||||
import {Measure} from "./resultLandingInfo";
|
||||
|
||||
export class SearchResult {
|
||||
title: ResultTitle;
|
||||
id: string;
|
||||
relcanId: string;
|
||||
objId: string;
|
||||
DOIs: string[]=[];
|
||||
DOIs: string[] = [];
|
||||
identifiers: Map<string, string[]>;
|
||||
measure: Array<string>;
|
||||
measure: Measure;
|
||||
|
||||
//publications & datasets & orp & software & projects & dataproviders:
|
||||
description: string;
|
||||
|
@ -43,7 +44,7 @@ export class SearchResult {
|
|||
endYear: number;
|
||||
openAccessMandatePublications: boolean;
|
||||
openAccessMandateDatasets: boolean;
|
||||
|
||||
hostedBy_collectedFrom: HostedByCollectedFrom[];
|
||||
//organizations:
|
||||
country: string;
|
||||
|
||||
|
@ -59,7 +60,8 @@ export class SearchResult {
|
|||
|
||||
entityType: string;
|
||||
types: string[];
|
||||
enermapsId:string;
|
||||
enermapsId: string;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
<div *ngIf="result" [ngClass]="{'uk-card uk-card-default': isCard}">
|
||||
<div [ngClass]="{'uk-card-body': isCard}">
|
||||
<div class="uk-grid uk-flex uk-flex-middle">
|
||||
<div *ngIf="properties.enermapsURL && showEnermaps && result.enermapsId" class=" uk-inline uk-width-auto uk-text-center uk-visible-toggle">
|
||||
<div *ngIf="properties.enermapsURL && showEnermaps && result.enermapsId"
|
||||
class=" uk-inline uk-width-auto uk-text-center uk-visible-toggle">
|
||||
<img class="uk-width-medium" [src]="properties.enermapsURL +'/images/datasets/' + result.enermapsId + '.png'"
|
||||
alt="Enermaps tool preview" loading="lazy">
|
||||
<div class="uk-overlay uk-margin-medium-left uk-overlay-default uk-position-bottom uk-hidden-hover uk-padding-small">
|
||||
<div
|
||||
class="uk-overlay uk-margin-medium-left uk-overlay-default uk-position-bottom uk-hidden-hover uk-padding-small">
|
||||
<p>Visit <a
|
||||
class="custom-external uk-margin-right uk-margin-small-top"
|
||||
[href]="properties.enermapsURL + '/?shared_id=' + result.enermapsId" target="_blank" >
|
||||
[href]="properties.enermapsURL + '/?shared_id=' + result.enermapsId" target="_blank">
|
||||
Enermaps tool
|
||||
</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-expand">
|
||||
<!-- 1st section (small title, mail title and deposit link) -->
|
||||
<div class="section1 uk-margin-bottom">
|
||||
<!-- 1st section (title, subtitle and deposit link) -->
|
||||
<div class="uk-margin-bottom">
|
||||
<!-- Deposit searchPage URL -->
|
||||
<!-- <span class="uk-width-expand uk-flex-right">
|
||||
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit"
|
||||
|
@ -22,23 +24,11 @@
|
|||
<span><span>Visit repository to deposit</span><span uk-icon="arrow-right"></span></span>
|
||||
</a>
|
||||
</span> -->
|
||||
<!-- Small subtitle above title -->
|
||||
<div class="uk-text-small uk-margin-xsmall-bottom">
|
||||
<span *ngIf="type" class="uk-text-capitalize type">{{type}}</span>
|
||||
<span *ngIf="type && beforeTitle.length > 0"> . </span>
|
||||
<span *ngIf="beforeTitle.length > 0" class="uk-text-capitalize">
|
||||
{{beforeTitle.join(' . ')}}
|
||||
</span>
|
||||
<span *ngIf="result.embargoEndDate && result.embargoEndDate != ''">
|
||||
<span
|
||||
*ngIf="beforeTitle.length > 0"> . </span> Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
|
||||
</span>
|
||||
</div>
|
||||
<!-- Title -->
|
||||
<div>
|
||||
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
|
||||
<a *ngIf="!externalUrl && result.id" (click)="onClick()" [queryParams]="createParam()"
|
||||
[routerLink]="url" class="uk-link uk-link-heading uk-width-expand">
|
||||
[routerLink]="url" class="uk-link uk-text-decoration-none uk-width-expand">
|
||||
<div *ngIf="(result.title) || result.acronym">
|
||||
<span *ngIf="result.acronym">
|
||||
{{result.acronym}}
|
||||
|
@ -52,7 +42,8 @@
|
|||
</div>
|
||||
</a>
|
||||
<a *ngIf="externalUrl && result.id" (click)="onClick()"
|
||||
target="_blank" [href]="externalUrl+result.id" class="custom-external uk-link uk-link-heading uk-width-expand">
|
||||
target="_blank" [href]="externalUrl+result.id"
|
||||
class="custom-external uk-link uk-text-decoration-none uk-width-expand">
|
||||
<span *ngIf="(result.title) || result.acronym">
|
||||
<span *ngIf="result.acronym">
|
||||
{{result.acronym}}
|
||||
|
@ -65,7 +56,6 @@
|
|||
[no title available]
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div *ngIf="!result.id" class="uk-width-expand">
|
||||
<div *ngIf="(result.title) || result.acronym">
|
||||
<span *ngIf="result.acronym">
|
||||
|
@ -82,9 +72,21 @@
|
|||
<!-- <hr class="uk-margin-remove-bottom" *ngIf="result.websiteURL && promoteWebsiteURL"> -->
|
||||
</h2>
|
||||
</div>
|
||||
<!-- Small subtitle above title -->
|
||||
<div class="uk-text-small uk-margin-xsmall-bottom">
|
||||
<span *ngIf="type" class="uk-text-capitalize type">{{type}}</span>
|
||||
<span *ngIf="type && beforeTitle.length > 0"> . </span>
|
||||
<span *ngIf="beforeTitle.length > 0" class="uk-text-capitalize">
|
||||
{{beforeTitle.join(' . ')}}
|
||||
</span>
|
||||
<span *ngIf="result.embargoEndDate && result.embargoEndDate != ''">
|
||||
<span
|
||||
*ngIf="beforeTitle.length > 0"> . </span> Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 2nd section (labels only) -->
|
||||
<div class="section2 uk-margin-bottom">
|
||||
<div class="uk-margin-bottom">
|
||||
<!-- Labels -->
|
||||
<div>
|
||||
<span
|
||||
|
@ -101,7 +103,8 @@
|
|||
</span>{{' '}}
|
||||
<span
|
||||
*ngIf="result.openAccessMandateDatasets != undefined && result.openAccessMandateDatasets && (result.openAccessMandatePublications == undefined || !result.openAccessMandatePublications)"
|
||||
class="uk-label uk-label-success uk-text-truncate " title="Open Access mandate for {{openaireEntities.DATASETS}}">
|
||||
class="uk-label uk-label-success uk-text-truncate "
|
||||
title="Open Access mandate for {{openaireEntities.DATASETS}}">
|
||||
Open Access mandate for {{openaireEntities.DATASETS}}
|
||||
</span>{{' '}}
|
||||
<span
|
||||
|
@ -124,10 +127,10 @@
|
|||
{{programmingLanguage}}
|
||||
</span>{{" "}}
|
||||
</span>
|
||||
<!-- <span -->
|
||||
<!-- *ngIf="result.sc39" class="uk-label" title="Special Clause 39">-->
|
||||
<!-- Special Clause 39-->
|
||||
<!-- </span>{{' '}}-->
|
||||
<!-- <span -->
|
||||
<!-- *ngIf="result.sc39" class="uk-label" title="Special Clause 39">-->
|
||||
<!-- Special Clause 39-->
|
||||
<!-- </span>{{' '}}-->
|
||||
<span
|
||||
*ngIf="result.compatibility && result.compatibility != '' && result.compatibility.toLowerCase() != 'not yet registered'"
|
||||
class="uk-label" title="Compatibility">
|
||||
|
@ -223,7 +226,8 @@
|
|||
<span *ngIf="result.organizations.length > 10">...</span>
|
||||
</div>
|
||||
<!-- Website URL -->
|
||||
<div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL" class="uk-margin-small-bottom">
|
||||
<div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL"
|
||||
class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Website URL: </span>
|
||||
<span>
|
||||
<a href="{{result.websiteURL}}" target="_blank" class="custom-external">
|
||||
|
@ -256,7 +260,8 @@
|
|||
<div *ngFor="let from of result.hostedBy_collectedFrom"
|
||||
[title]="from.accessRight ? from.accessRight : 'Not available'"
|
||||
class="uk-flex uk-flex-middle">
|
||||
<span [class]="'uk-margin-small-right ' + (from.accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')">
|
||||
<span
|
||||
[class]="'uk-margin-small-right ' + (from.accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')">
|
||||
<icon [name]="from.accessRightIcon" flex="true" type="outlined"></icon>
|
||||
</span>
|
||||
<span class="uk-width-expand">
|
||||
|
@ -272,9 +277,11 @@
|
|||
</span>
|
||||
<span class="provider uk-display-inline-block">
|
||||
<span class="uk-text-meta">Provider: </span>
|
||||
<a *ngFor="let collectedName of from.collectedNamesAndIds.keys(); let i=index" [routerLink]="dataProviderUrl"
|
||||
<a *ngFor="let collectedName of from.collectedNamesAndIds.keys(); let i=index"
|
||||
[routerLink]="dataProviderUrl"
|
||||
[queryParams]="{datasourceId: from.collectedNamesAndIds.get(collectedName)}" (click)="onClick();">
|
||||
{{collectedName}}<ng-container *ngIf="(i !== (from.collectedNamesAndIds.size - 1))">; </ng-container>
|
||||
{{collectedName}}
|
||||
<ng-container *ngIf="(i !== (from.collectedNamesAndIds.size - 1))">; </ng-container>
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
|
@ -304,16 +311,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--&& loggedIn (card footer)-->
|
||||
<div *ngIf="result.measure?.length ||
|
||||
((properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator') &&
|
||||
((showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType) || result.orcidCreationDates?.length > 0))"
|
||||
<div *ngIf="result.measure ||((properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator')
|
||||
&& ((showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType) || result.orcidCreationDates?.length > 0))"
|
||||
class="uk-text-small"
|
||||
[ngClass]="{'uk-card-footer': isCard}">
|
||||
<!-- Impact Factors-->
|
||||
<span class="uk-flex uk-flex-top uk-flex-wrap" style="grid-gap: 10px;">
|
||||
<ng-container *ngIf="result.measure?.length">
|
||||
<!--Popularity -->
|
||||
<a title="Popularity" class="popularity-{{result.measure[0]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
|
||||
<a title="Popularity"
|
||||
class="popularity-{{result.measure[0]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10.749" height="14.33" viewBox="0 0 10.749 14.33"><defs><!--<style>.a{fill:#d51717;}</style>--></defs><path
|
||||
class="a"
|
||||
d="M10.382.67a14.44,14.44,0,0,1,.5,3.225A2.331,2.331,0,0,1,8.589,6.4,2.445,2.445,0,0,1,6.15,3.895l.02-.242A9.25,9.25,0,0,0,4,9.625a5.375,5.375,0,0,0,10.749,0A11.5,11.5,0,0,0,10.382.67ZM9.18,12.985a2.134,2.134,0,0,1-2.163-2.11A2.1,2.1,0,0,1,8.9,8.779a5.181,5.181,0,0,0,3.1-1.733,9.374,9.374,0,0,1,.4,2.714A3.226,3.226,0,0,1,9.18,12.985Z"
|
||||
|
@ -344,13 +351,15 @@
|
|||
Popularity: Citation-based measure reflecting the current impact.
|
||||
</div>
|
||||
<div>
|
||||
<a title="Link to Bip!Finder" class="uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
|
||||
<a title="Link to Bip!Finder" class="uk-float-right" target="_blank"
|
||||
href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
|
||||
View more details
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--Influence -->
|
||||
<a title="Influence" class="influence-{{result.measure[1]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
|
||||
<a title="Influence"
|
||||
class="influence-{{result.measure[1]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12.667" height="14" viewBox="0 0 12.667 14">
|
||||
<defs><!--<style>.a{fill:#e1920a;}</style>--></defs>
|
||||
<path class="a"
|
||||
|
@ -383,7 +392,8 @@
|
|||
Influence: Citation-based measure reflecting the total impact.
|
||||
</div>
|
||||
<div>
|
||||
<a title="Link to Bip!Finder" class=" uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
|
||||
<a title="Link to Bip!Finder" class=" uk-float-right" target="_blank"
|
||||
href="https://bip.imis.athena-innovation.gr/site/details?id={{result.objId}}">
|
||||
View more details
|
||||
</a>
|
||||
</div>
|
||||
|
@ -400,7 +410,8 @@
|
|||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
</orcid-work>
|
||||
</span>
|
||||
<span *ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community') && result.orcidCreationDates?.length > 0"
|
||||
<span
|
||||
*ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community') && result.orcidCreationDates?.length > 0"
|
||||
class="uk-width-expand uk-text-right">
|
||||
<span *ngIf="result.orcidCreationDates?.length > 0" class="uk-display-inline-block">
|
||||
<span class="uk-text-meta">
|
||||
|
@ -416,4 +427,4 @@
|
|||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
// Impact Factors
|
||||
.popularity-A svg .a, .popularity-C1 svg .a, .popularity-C2 svg .a, .influence-A svg .a, .influence-C1 svg .a, .influence-C2 svg .a {
|
||||
fill:#d51717;
|
||||
.popularity-A, .popularity-C1, .popularity-C2, .influence-A, .influence-C1, .influence-C2 {
|
||||
& svg a {
|
||||
fill: #d51717;
|
||||
}
|
||||
}
|
||||
.popularity-B svg .a, .popularity-C3 svg .a, .popularity-C4 svg .a, .influence-B svg .a, .influence-C3 svg .a, .influence-C4 svg .a {
|
||||
|
||||
.popularity-B, .popularity-C3, .popularity-C4, .influence-B, .influence-C3, .influence-C4 {
|
||||
& svg a {
|
||||
fill: #e1920a;
|
||||
}
|
||||
}
|
||||
.popularity-C svg .a, .popularity-C5 svg .a, .influence-C svg .a, .influence-C5 svg .a {
|
||||
|
||||
.popularity-C, .popularity-C5, .influence-C, .influence-C5 {
|
||||
& svg a {
|
||||
fill: #444;
|
||||
}
|
||||
}}
|
|
@ -24,6 +24,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
@Input() promoteWebsiteURL: boolean = false;
|
||||
@Input() hasLink: boolean = true;
|
||||
@Input() isCard: boolean = false;
|
||||
@Input() isMobile: boolean = false;
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
public urlParam: string;
|
||||
public url: string;
|
||||
|
@ -38,7 +39,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
@Input() relationsVocabulary = null;
|
||||
|
||||
ngOnInit(): void {
|
||||
if(this.hasLink) {
|
||||
if (this.hasLink) {
|
||||
if (this.result.resultType === "publication") {
|
||||
this.urlParam = "articleId";
|
||||
this.url = properties.searchLinkToPublication.split('?')[0];
|
||||
|
@ -52,9 +53,9 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
this.urlParam = "orpId";
|
||||
this.url = properties.searchLinkToOrp.split('?')[0];
|
||||
} else if (this.result.resultType == "project") {
|
||||
if(this.result.id) {
|
||||
if (this.result.id) {
|
||||
this.urlParam = "projectId";
|
||||
}else if(this.result.code && this.result.funderShortname){
|
||||
} else if (this.result.code && this.result.funderShortname) {
|
||||
this.result.id = this.result.code;
|
||||
this.urlParam = "grantId";
|
||||
}
|
||||
|
@ -63,7 +64,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
this.urlParam = "organizationId";
|
||||
this.url = properties.searchLinkToOrganization.split('?')[0];
|
||||
} else if (this.result.resultType == "dataprovider") {
|
||||
if(this.result.compatibilityUNKNOWN && properties.adminToolsPortalType == "eosc") {
|
||||
if (this.result.compatibilityUNKNOWN && properties.adminToolsPortalType == "eosc") {
|
||||
this.urlParam = "serviceId";
|
||||
this.url = properties.searchLinkToService.split('?')[0];
|
||||
} else {
|
||||
|
@ -80,55 +81,56 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
this.checkPID();
|
||||
}
|
||||
this.initBeforeTitle();
|
||||
if(this.result.languages) {
|
||||
if (this.result.languages) {
|
||||
this.result.languages = this.removeUnknown(this.result.languages);
|
||||
}
|
||||
if(this.result.countries) {
|
||||
if (this.result.countries) {
|
||||
this.result.countries = this.removeUnknown(this.result.countries);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if(changes.result && this.hasLink) {
|
||||
if (changes.result && this.hasLink) {
|
||||
this.checkPID();
|
||||
}
|
||||
}
|
||||
|
||||
checkPID() {
|
||||
// if result has a pid use it as parameter instead of openaireId
|
||||
let pid:Identifier =this.getPID();
|
||||
if(pid){
|
||||
let pid: Identifier = this.getPID();
|
||||
if (pid) {
|
||||
this.urlParam = "pid";
|
||||
this.result.id = pid.id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getPID() {
|
||||
return Identifier.getPIDFromIdentifiers(this.result.identifiers);
|
||||
}
|
||||
|
||||
public initBeforeTitle() {
|
||||
if(this.result.resultType && this.result.resultType !== 'dataprovider') {
|
||||
if (this.result.resultType && this.result.resultType !== 'dataprovider') {
|
||||
this.type = this.getTypeName(this.result.resultType);
|
||||
}
|
||||
if(this.result.types) {
|
||||
if (this.result.types) {
|
||||
this.removeUnknown(this.removeDuplicates(this.result.types)).forEach(type => {
|
||||
this.beforeTitle.push(type);
|
||||
});
|
||||
}
|
||||
if(this.result.year) {
|
||||
if (this.result.year) {
|
||||
this.beforeTitle.push(this.result.year.toString());
|
||||
}
|
||||
if(this.result.startYear && this.result.endYear) {
|
||||
if (this.result.startYear && this.result.endYear) {
|
||||
this.beforeTitle.push(this.result.startYear.toString() + ' - ' + this.result.endYear.toString());
|
||||
}
|
||||
if(this.result.provenanceAction) {
|
||||
if (this.result.provenanceAction) {
|
||||
let value = HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary, false);
|
||||
if(value) {
|
||||
if (value) {
|
||||
this.beforeTitle.push(value);
|
||||
}
|
||||
}
|
||||
if(this.result.relationName) {
|
||||
if (this.result.relationName) {
|
||||
this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.relationName, this.relationsVocabulary));
|
||||
}
|
||||
// if(this.result.percentage) {
|
||||
|
@ -149,9 +151,9 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
public accessClass(accessMode: string): string {
|
||||
if(accessMode.toLowerCase().indexOf('open') !== -1) {
|
||||
if (accessMode.toLowerCase().indexOf('open') !== -1) {
|
||||
return 'success';
|
||||
} else if(accessMode.toLowerCase() === 'not available') {
|
||||
} else if (accessMode.toLowerCase() === 'not available') {
|
||||
return 'disabled'; // unknown
|
||||
} else {
|
||||
return 'disabled'; // closed
|
||||
|
@ -159,16 +161,17 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
public onClick() {
|
||||
if(this.modal) {
|
||||
if (this.modal) {
|
||||
this.modal.cancel();
|
||||
}
|
||||
}
|
||||
createParam(){
|
||||
if(this.urlParam == "grantId" ){
|
||||
return this.routerHelper.createQueryParams([this.urlParam,"funder"],[this.result.id,this.result.funderShortname])
|
||||
|
||||
createParam() {
|
||||
if (this.urlParam == "grantId") {
|
||||
return this.routerHelper.createQueryParams([this.urlParam, "funder"], [this.result.id, this.result.funderShortname])
|
||||
|
||||
}
|
||||
return this.routerHelper.createQueryParam(this.urlParam,this.result.id)
|
||||
return this.routerHelper.createQueryParam(this.urlParam, this.result.id)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {SearchResult} from "../entities/searchResult";
|
||||
import {ResultLandingInfo} from "../entities/resultLandingInfo";
|
||||
import {Measure, ResultLandingInfo} from "../entities/resultLandingInfo";
|
||||
import {OrganizationInfo} from "../entities/organizationInfo";
|
||||
|
||||
export interface HostedByCollectedFrom {
|
||||
|
@ -81,8 +81,8 @@ export class ResultPreview {
|
|||
countries: string[];
|
||||
|
||||
//Impact factor
|
||||
DOI:string;
|
||||
measure: Array<string>;
|
||||
DOI: string;
|
||||
measure: Measure;
|
||||
|
||||
//publications & datasets & orp & software & organizations:
|
||||
projects: Project[];
|
||||
|
@ -142,7 +142,8 @@ export class ResultPreview {
|
|||
provenanceAction: string;
|
||||
|
||||
//enermaps id - image
|
||||
enermapsId:string;
|
||||
enermapsId: string;
|
||||
|
||||
public static searchResultConvert(result: SearchResult, type: string): ResultPreview {
|
||||
let resultPreview: ResultPreview = new ResultPreview();
|
||||
resultPreview.id = result.id;
|
||||
|
@ -151,9 +152,9 @@ export class ResultPreview {
|
|||
resultPreview.title = result.title.name;
|
||||
resultPreview.accessMode = result.title.accessMode;
|
||||
// resultPreview.sc39 = result.title.sc39;
|
||||
if(result.countriesForResults) {
|
||||
if (result.countriesForResults) {
|
||||
resultPreview.countries = result.countriesForResults;
|
||||
} else if(result.country) {
|
||||
} else if (result.country) {
|
||||
resultPreview.countries = [result.country];
|
||||
} else {
|
||||
resultPreview.countries = result.countries;
|
||||
|
@ -179,7 +180,7 @@ export class ResultPreview {
|
|||
resultPreview.openAccessMandatePublications = result.openAccessMandatePublications;
|
||||
resultPreview.openAccessMandateDatasets = result.openAccessMandateDatasets;
|
||||
resultPreview.englishname = result.englishname;
|
||||
if(result.type) {
|
||||
if (result.type) {
|
||||
resultPreview.types = [result.type];
|
||||
} else {
|
||||
resultPreview.types = result.types;
|
||||
|
@ -208,7 +209,7 @@ export class ResultPreview {
|
|||
resultPreview.countries = result.countries;
|
||||
resultPreview.projects = result.fundedByProjects;
|
||||
resultPreview.description = result.description;//.length > 0 ? result.description[0] : "";
|
||||
if(result.dateofacceptance) {
|
||||
if (result.dateofacceptance) {
|
||||
resultPreview.year = new Date(result.dateofacceptance).getFullYear().toString();
|
||||
}
|
||||
resultPreview.embargoEndDate = result.embargoEndDate;
|
||||
|
@ -230,7 +231,7 @@ export class ResultPreview {
|
|||
resultPreview.id = result.id;
|
||||
resultPreview.title = result.name;
|
||||
resultPreview.resultType = result.class;
|
||||
if(result.date) {
|
||||
if (result.date) {
|
||||
resultPreview.year = result.date.toString();
|
||||
}
|
||||
resultPreview.relationName = result.relationName;
|
||||
|
@ -243,15 +244,15 @@ export class ResultPreview {
|
|||
public static organizationConvert(result: Organization, relation: string = 'trust'): ResultPreview {
|
||||
let resultPreview: ResultPreview = new ResultPreview();
|
||||
resultPreview.id = result.id;
|
||||
if(result.name) {
|
||||
if (result.name) {
|
||||
resultPreview.title = result.name;
|
||||
if(result.shortname) {
|
||||
if (result.shortname) {
|
||||
resultPreview.title += ' (' + result.shortname + ')';
|
||||
}
|
||||
} else if(result.shortname) {
|
||||
} else if (result.shortname) {
|
||||
resultPreview.title = result.shortname;
|
||||
}
|
||||
if(result.country) {
|
||||
if (result.country) {
|
||||
resultPreview.countries = [result.country];
|
||||
}
|
||||
resultPreview.relation = relation;
|
||||
|
@ -263,22 +264,22 @@ export class ResultPreview {
|
|||
|
||||
public static organizationInfoConvert(result: OrganizationInfo): ResultPreview {
|
||||
let resultPreview: ResultPreview = new ResultPreview();
|
||||
if(result.title && result.title.name) {
|
||||
if (result.title && result.title.name) {
|
||||
resultPreview.title = result.title.name;
|
||||
if(result.name) {
|
||||
if (result.name) {
|
||||
resultPreview.title += ' (' + result.name + ')';
|
||||
}
|
||||
} else if(result.name) {
|
||||
} else if (result.name) {
|
||||
resultPreview.title = result.name;
|
||||
}
|
||||
if(result.country) {
|
||||
if (result.country) {
|
||||
resultPreview.countries = [result.country];
|
||||
}
|
||||
if(result.title && result.title.url) {
|
||||
if (result.title && result.title.url) {
|
||||
resultPreview.websiteURL = result.title.url;
|
||||
}
|
||||
resultPreview.resultType = 'organization';
|
||||
return resultPreview;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue