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";
|
||||
|
@ -8,18 +8,34 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
providedIn: 'root'
|
||||
})
|
||||
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'}
|
||||
]
|
||||
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'
|
||||
}
|
||||
]
|
||||
|
||||
public notebookInSubjects: boolean = false;
|
||||
private notebookKeyword: string = "eosc jupyter notebook";
|
||||
private notebook_label: string = "EOSC";
|
||||
private notebook_value: string = "EOSC Jupyter Notebook";
|
||||
|
||||
|
||||
public open = 'open_access';
|
||||
public closed = 'closed_access';
|
||||
public unknown = 'question_mark';
|
||||
|
@ -28,30 +44,30 @@ export class ParsingFunctions {
|
|||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
|
||||
public ngOnDestroy() {
|
||||
}
|
||||
|
||||
|
||||
public parseFundingByProjects(fundedByProjects: Project[], relation: any): Project[] {
|
||||
if (fundedByProjects == undefined) {
|
||||
fundedByProjects = [];
|
||||
}
|
||||
|
||||
|
||||
let fundedByProject: Project = {
|
||||
"id": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "code": "", "provenanceAction": "", "validated": false
|
||||
};
|
||||
|
||||
|
||||
if (relation.title != 'unidentified') {
|
||||
fundedByProject['id'] = relation['to'].content;
|
||||
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;
|
||||
fundedByProject['provenanceAction'] = relation.provenanceaction;
|
||||
} else {
|
||||
fundedByProject['id'] = "";
|
||||
fundedByProject['acronym'] = "";
|
||||
|
@ -59,11 +75,11 @@ export class ParsingFunctions {
|
|||
fundedByProject['code'] = "";
|
||||
fundedByProject['provenanceAction'] = "";
|
||||
}
|
||||
|
||||
|
||||
if (relation.hasOwnProperty("funding")) {
|
||||
let funding: { "funderName": string, "funderShortname": string, "stream": string };
|
||||
funding = this.parseFundingTrees(relation.funding);
|
||||
|
||||
|
||||
if (funding.funderName) {
|
||||
fundedByProject['funderName'] = funding.funderName;
|
||||
}
|
||||
|
@ -77,7 +93,7 @@ export class ParsingFunctions {
|
|||
fundedByProjects.push(fundedByProject);
|
||||
return fundedByProjects;
|
||||
}
|
||||
|
||||
|
||||
// publication & research data : for fundedByProjects | project landing : for funding
|
||||
public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } {
|
||||
let funding: { "funderName": string, "funderShortname": string, "stream": string } = {
|
||||
|
@ -86,64 +102,64 @@ export class ParsingFunctions {
|
|||
"stream": ""
|
||||
};
|
||||
let length = Array.isArray(fundingTree) ? fundingTree.length : 1;
|
||||
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let fundingData = Array.isArray(fundingTree) ? fundingTree[i] : fundingTree;
|
||||
|
||||
|
||||
if (fundingData.hasOwnProperty("funder")) {
|
||||
funding.funderShortname = fundingData['funder'].shortname;
|
||||
funding.funderName = fundingData['funder'].name;
|
||||
}
|
||||
|
||||
|
||||
funding.stream = this.addFundingLevel0(fundingData, funding.stream);
|
||||
|
||||
|
||||
funding.stream = this.addFundingLevel1(fundingData, funding.stream);
|
||||
|
||||
|
||||
funding.stream = this.addFundingLevel2(fundingData, funding.stream);
|
||||
}
|
||||
return funding;
|
||||
}
|
||||
|
||||
|
||||
addFundingLevel0(parent: string, fundingStream: string): string {
|
||||
if (parent.hasOwnProperty("funding_level_0")) {
|
||||
let level0 = parent['funding_level_0'];
|
||||
|
||||
|
||||
fundingStream += (fundingStream) ? " ; " : "";
|
||||
fundingStream += level0.name;
|
||||
}
|
||||
return fundingStream;
|
||||
}
|
||||
|
||||
|
||||
addFundingLevel1(parent: string, fundingStream: string): string {
|
||||
if (parent.hasOwnProperty("funding_level_1")) {
|
||||
let level1 = parent['funding_level_1'];
|
||||
|
||||
|
||||
// For projects' parsing
|
||||
if (level1.hasOwnProperty("parent")) {
|
||||
fundingStream = this.addFundingLevel0(level1.parent, fundingStream);
|
||||
}
|
||||
|
||||
|
||||
fundingStream += (fundingStream) ? " | " : "";
|
||||
fundingStream += level1.name;
|
||||
}
|
||||
return fundingStream;
|
||||
}
|
||||
|
||||
|
||||
addFundingLevel2(parent: string, fundingStream: string): string {
|
||||
if (parent.hasOwnProperty("funding_level_2")) {
|
||||
let level2 = parent['funding_level_2'];
|
||||
|
||||
|
||||
// For projects' parsing
|
||||
if (level2.hasOwnProperty("parent")) {
|
||||
fundingStream = this.addFundingLevel1(level2.parent, fundingStream);
|
||||
}
|
||||
|
||||
|
||||
fundingStream += (fundingStream) ? " | " : "";
|
||||
fundingStream += level2.name;
|
||||
}
|
||||
return fundingStream;
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset landing : for collectedFrom
|
||||
parseCollectedFrom(collectedFrom: { "name": string, "id": string }[],
|
||||
_collectedFrom: any) {
|
||||
|
@ -152,10 +168,10 @@ export class ParsingFunctions {
|
|||
collectedFrom[length]['name'] = _collectedFrom.name;
|
||||
collectedFrom[length]['id'] = _collectedFrom.id;
|
||||
}
|
||||
|
||||
|
||||
// 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'] == "") {
|
||||
|
@ -188,16 +204,16 @@ export class ParsingFunctions {
|
|||
}
|
||||
return hostedBy_collectedFrom;
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset landing : for downloadFrom
|
||||
parseDownloadFrom(downloadFrom: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, url: string) {
|
||||
let key: string = instance['hostedby'].name;
|
||||
|
||||
|
||||
if (key) {
|
||||
this.addUrlAndAccessMode(downloadFrom, instance, key, url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset landing : for publishedIn
|
||||
parsePublishedIn(publishedIn: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, result: any, url: string, counter: number): number {
|
||||
if (result != null && result.hasOwnProperty("source")) {
|
||||
|
@ -210,7 +226,7 @@ export class ParsingFunctions {
|
|||
} else {
|
||||
key = result['source'];
|
||||
}
|
||||
|
||||
|
||||
if (key) {
|
||||
this.addUrlAndAccessMode(publishedIn, instance, key, url);
|
||||
counter++;
|
||||
|
@ -218,30 +234,30 @@ export class ParsingFunctions {
|
|||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset landing : for downloadFrom and publishedIn
|
||||
addUrlAndAccessMode(mapStructure: Map<string, { "url": string[], "accessMode": string[], "bestAccessMode": string }>, instance: any, key: string, url: string) {
|
||||
if (!mapStructure.has(key)) {
|
||||
mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
}
|
||||
|
||||
|
||||
if (mapStructure.get(key)['url'] == null) {
|
||||
mapStructure.get(key)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
|
||||
if (url) {
|
||||
mapStructure.get(key)['url'].push(url);
|
||||
}
|
||||
|
||||
|
||||
if (mapStructure.get(key)['accessMode'] == null) {
|
||||
mapStructure.get(key)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
|
||||
if (instance.hasOwnProperty("accessright")) {
|
||||
if (url) {
|
||||
mapStructure.get(key)['accessMode'].push(instance['accessright'].classname);
|
||||
}
|
||||
|
||||
|
||||
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
|
||||
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname;
|
||||
}
|
||||
|
@ -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,20 +364,56 @@ 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) {
|
||||
return false;
|
||||
}
|
||||
accessMode = accessMode.classid;
|
||||
|
||||
|
||||
switch (currentAccessMode) {
|
||||
case null:
|
||||
if (accessMode != "UNKNOWN") {
|
||||
|
@ -370,22 +422,22 @@ export class ParsingFunctions {
|
|||
return false;
|
||||
case "CLOSED":
|
||||
if (accessMode == "OPEN" ||
|
||||
accessMode == "OPEN SOURCE" ||
|
||||
accessMode == "EMBARGO" ||
|
||||
accessMode == "RESTRICTED") {
|
||||
accessMode == "OPEN SOURCE" ||
|
||||
accessMode == "EMBARGO" ||
|
||||
accessMode == "RESTRICTED") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "RESTRICTED":
|
||||
if (accessMode == "OPEN" ||
|
||||
accessMode == "OPEN SOURCE" ||
|
||||
accessMode == "EMBARGO") {
|
||||
accessMode == "OPEN SOURCE" ||
|
||||
accessMode == "EMBARGO") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "EMBARGO":
|
||||
if (accessMode == "OPEN" ||
|
||||
accessMode == "OPEN SOURCE") {
|
||||
accessMode == "OPEN SOURCE") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -397,7 +449,7 @@ export class ParsingFunctions {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset & software & orp landing : for relatedResearchResults
|
||||
parseResults(researchResults: RelationResult[], relation, provenanceAction: string, relationName: string): RelationResult[] {
|
||||
if (researchResults == undefined) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -470,17 +522,17 @@ export class ParsingFunctions {
|
|||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
// publication & dataset landing : for identifiers
|
||||
parseIdentifiers(pid: any): Map<string, string[]> {
|
||||
let identifiers = new Map<string, string[]>();
|
||||
|
||||
|
||||
if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
|
||||
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") {
|
||||
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) {
|
||||
|
@ -612,7 +664,7 @@ export class ParsingFunctions {
|
|||
}
|
||||
return {"found": found, "setOfEoscSubject": setOfEoscSubjects, "eoscSubjectsFound": eoscSubjectsFound};
|
||||
}
|
||||
|
||||
|
||||
parseContexts(_contexts: any): Context[] {
|
||||
let contexts = new Array<Context>();
|
||||
|
||||
|
@ -623,7 +675,7 @@ export class ParsingFunctions {
|
|||
for (let i = 0; i < length; i++) {
|
||||
let numOfCategories: number = 0; // count categories with label
|
||||
context = Array.isArray(_contexts) ? _contexts[i] : _contexts;
|
||||
|
||||
|
||||
if (context.label && context.hasOwnProperty("type") && (context['type'] == "community" || context['type'] == "ri")) {
|
||||
if (context.hasOwnProperty("category")) {
|
||||
let category;
|
||||
|
@ -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": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"labelConcept": "", "idConcept": ""};
|
||||
} else if (category.label || (numOfCategories == 0 && z == (length2 - 1))) {
|
||||
contexts[position] = {
|
||||
"labelContext": "", "idContext": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"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": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"labelConcept": "", "idConcept": ""};
|
||||
contexts[position] = {
|
||||
"labelContext": "", "idContext": "",
|
||||
"labelCategory": "", "idCategory": "",
|
||||
"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)) {
|
||||
|
@ -700,7 +760,7 @@ export class ParsingFunctions {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parseLanguages(_languages: any) {
|
||||
var languages = new Array<string>();
|
||||
|
||||
|
@ -717,10 +777,10 @@ export class ParsingFunctions {
|
|||
}
|
||||
return languages;
|
||||
}
|
||||
|
||||
|
||||
parseCountries(_countries: any) {
|
||||
var countries = new Array<string>();
|
||||
|
||||
|
||||
if (!Array.isArray(_countries)) {
|
||||
if (_countries.classname != "Undetermined" && _countries.classname) {
|
||||
countries.push(_countries.classname);
|
||||
|
@ -734,10 +794,10 @@ export class ParsingFunctions {
|
|||
}
|
||||
return countries;
|
||||
}
|
||||
|
||||
|
||||
parseProgrammingLanguages(_pLanguages) {
|
||||
var pLanguages = new Array<string>();
|
||||
|
||||
|
||||
if (!Array.isArray(_pLanguages)) {
|
||||
if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) {
|
||||
pLanguages.push(_pLanguages.classname);
|
||||
|
@ -751,16 +811,16 @@ export class ParsingFunctions {
|
|||
}
|
||||
return pLanguages;
|
||||
}
|
||||
|
||||
|
||||
parseReferences(citations: any): Reference[] {
|
||||
let references: Reference[] = [];
|
||||
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"];
|
||||
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) {
|
||||
return abstracts.join(' ');
|
||||
} else {
|
||||
return abstracts.length > 0 ? ('<p>' + abstracts.join('</p> <p>') + '</p>') : abstracts.join(' ');
|
||||
}
|
||||
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,50 +56,50 @@ export class ResultLandingService {
|
|||
}
|
||||
}
|
||||
|
||||
getResultLandingInfo (id: string, identifier: Identifier, type: string,
|
||||
subjectsVocabulary: any,
|
||||
properties: EnvProperties): any {
|
||||
getResultLandingInfo(id: string, identifier: Identifier, type: string,
|
||||
subjectsVocabulary: any,
|
||||
properties: EnvProperties): any {
|
||||
let url: string = this.buildResultLandingInfoUrl(id, identifier, type);
|
||||
|
||||
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) {
|
||||
throw new HttpErrorResponse({
|
||||
status: 404,
|
||||
statusText: "Not found",
|
||||
url: finalUrl,
|
||||
error: "Http failure response for "+finalUrl+": 404 Not Found"
|
||||
});
|
||||
.pipe(map(res => {
|
||||
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"
|
||||
});
|
||||
}
|
||||
return res['results'][0];
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
return res['results'][0];
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}))
|
||||
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res]))
|
||||
.pipe(map(res => [
|
||||
res[1]['oaf:result'], // 0
|
||||
res[1]['oaf:result']['title'], // 1
|
||||
res[1]['oaf:result']['rels']['rel'], // 2
|
||||
res[1]['oaf:result']['children'], // 3
|
||||
res[1]['oaf:result']['pid'], // 4
|
||||
res[1]['oaf:result']['journal'], // 5
|
||||
res[1]['oaf:result']['language'], // 6
|
||||
res[1]['oaf:result']['eoscifguidelines'], // 7
|
||||
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']['programmingLanguage'], // 12 - software
|
||||
//res[1]['oaf:result']['resulttype'],
|
||||
(res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['references'] !== undefined)
|
||||
? res[1]['extraInfo']['references']['reference'] : null, // 13
|
||||
res[0], // 14
|
||||
res[2], // 15
|
||||
]))
|
||||
.pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties)));
|
||||
}))
|
||||
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res]))
|
||||
.pipe(map(res => [
|
||||
res[1]['oaf:result'], // 0
|
||||
res[1]['oaf:result']['title'], // 1
|
||||
res[1]['oaf:result']['rels']['rel'], // 2
|
||||
res[1]['oaf:result']['children'], // 3
|
||||
res[1]['oaf:result']['pid'], // 4
|
||||
res[1]['oaf:result']['journal'], // 5
|
||||
res[1]['oaf:result']['language'], // 6
|
||||
res[1]['oaf:result']['eoscifguidelines'], // 7
|
||||
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']['programmingLanguage'], // 12 - software
|
||||
//res[1]['oaf:result']['resulttype'],
|
||||
(res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['references'] !== undefined)
|
||||
? res[1]['extraInfo']['references']['reference'] : null, // 13
|
||||
res[0], // 14
|
||||
res[2], // 15
|
||||
]))
|
||||
.pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties)));
|
||||
}
|
||||
|
||||
// getProvenanceActionVocabulary (properties: EnvProperties): any {
|
||||
|
@ -118,15 +118,15 @@ 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');
|
||||
return throwError(error || 'Server error');
|
||||
}
|
||||
|
||||
parseResultLandingInfo (data: any, subjectsVocabulary: any, properties: EnvProperties): any {
|
||||
this.resultLandingInfo = new ResultLandingInfo();
|
||||
parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any {
|
||||
this.resultLandingInfo = new ResultLandingInfo();
|
||||
// res
|
||||
this.resultLandingInfo.record = data[15];
|
||||
this.resultLandingInfo.objIdentifier = data[15]["result"]["header"]["dri:objIdentifier"];
|
||||
|
@ -136,25 +136,25 @@ export class ResultLandingService {
|
|||
// res['result']['metadata']['oaf:entity']['oaf:result']
|
||||
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.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
|
||||
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);
|
||||
})
|
||||
|
@ -356,50 +329,54 @@ 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.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
|
||||
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) {
|
||||
|
@ -407,77 +384,10 @@ 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';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// res['result']['metadata']['oaf:entity']['oaf:result']['measure']
|
||||
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,10 +453,10 @@ 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)
|
||||
// return this.http.get(url)
|
||||
.pipe(map(res => this.parseEnermapsDetails(res)));
|
||||
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)));
|
||||
}
|
||||
|
||||
parseEnermapsDetails(response: any) {
|
||||
|
@ -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">
|
||||
[showSubjects]="showSubjects" [result]="result" [showEnermaps]="showEnermaps"
|
||||
[isCard]="isMobile" [isMobile]="isMobile">
|
||||
</result-preview>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -2,18 +2,19 @@ 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',
|
||||
templateUrl: 'searchResult.component.html'
|
||||
})
|
||||
export class SearchResultComponent implements OnInit, OnChanges {
|
||||
export class SearchResultComponent implements OnInit, OnChanges {
|
||||
@Input() results: SearchResult[];
|
||||
previewResults:ResultPreview[];
|
||||
previewResults: ResultPreview[];
|
||||
@Input() status: number;
|
||||
@Input() type: string;
|
||||
@Input() showLoading: boolean = false;
|
||||
|
@ -22,62 +23,73 @@ 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() {}
|
||||
sub;
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
|
||||
this.isMobile = isMobile;
|
||||
}));
|
||||
console.log(this.results);
|
||||
}
|
||||
|
||||
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 {
|
||||
if (changes.results) {
|
||||
if (changes.results) {
|
||||
this.initialize();
|
||||
}
|
||||
}
|
||||
public getResultPreview(result: SearchResult): ResultPreview {
|
||||
return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public quote(params: string): string {
|
||||
return '"' + params + '"';
|
||||
}
|
||||
|
|
|
@ -7,20 +7,20 @@ 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) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
search(resultType: string, params: string, refineParams: string, page: number, size: number, sortBy: string, refineFields: string[], properties: EnvProperties): any {
|
||||
let link = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true);
|
||||
|
||||
|
||||
let url = link + "?";
|
||||
if (params != null && params != '') {
|
||||
url += params;
|
||||
|
@ -32,21 +32,21 @@ export class SearchResearchResultsService {
|
|||
url += "&sortBy=" + sortBy;
|
||||
}
|
||||
url += "&page=" + (page - 1) + "&size=" + size + "&format=json";
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
}
|
||||
|
||||
|
||||
searchById(resultType: string, id: string, properties: EnvProperties): any {
|
||||
let url = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true) + "/" + id + "?format=json";
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => this.parseResults(resultType, res, properties)));
|
||||
.pipe(map(res => this.parseResults(resultType, res, properties)));
|
||||
}
|
||||
|
||||
|
||||
searchAggregators(resultType: string, id: string, params: string, refineParams: string, page: number, size: number, properties: EnvProperties): any {
|
||||
let link = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true);
|
||||
|
||||
|
||||
let url = link + "?" + "&format=json";
|
||||
if (params != null && params != '') {
|
||||
url += params;
|
||||
|
@ -55,33 +55,33 @@ export class SearchResearchResultsService {
|
|||
url += refineParams;
|
||||
}
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => this.parseRefineResults(id, res['refineResults'])));
|
||||
.pipe(map(res => this.parseRefineResults(id, res['refineResults'])));
|
||||
}
|
||||
|
||||
|
||||
searchByListOfDOI(resultType: string, DOIs: string[], refineParams: string, page: number, size: number, refineFields: string[], properties: EnvProperties): any {
|
||||
let link = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true);
|
||||
|
||||
|
||||
let url = link + "?" + "&format=json&";
|
||||
var doisParams = "";
|
||||
|
||||
|
||||
for (var i = 0; i < DOIs.length; i++) {
|
||||
doisParams += (doisParams.length > 0 ? "&" : "") + 'doi="' + DOIs[i] + '"';
|
||||
}
|
||||
if (doisParams.length > 0) {
|
||||
url += "&" + doisParams;
|
||||
|
||||
|
||||
}
|
||||
if (refineParams != null && refineParams != '') {
|
||||
url += refineParams;
|
||||
}
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
}
|
||||
|
||||
|
||||
advancedSearch(resultType: string, params: string, page: number, size: number, sortBy: string, properties: EnvProperties, refineParams: string = null, refineFields: string[] = null, refineQuery: string = null): any {
|
||||
let url = properties.searchResourcesAPIURL;
|
||||
var basicQuery = "(oaftype exact result) and (resulttypeid exact " + this.getEntityQueryName(resultType, false) + ") ";
|
||||
|
@ -101,14 +101,14 @@ export class SearchResearchResultsService {
|
|||
if (refineQuery) {
|
||||
url += "&" + refineQuery;
|
||||
}
|
||||
|
||||
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
url += "&format=json";
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
}
|
||||
|
||||
|
||||
advancedSearchResults(resultType: string, params: string, page: number, size: number, sortBy: string, properties: EnvProperties, refineParams: string = null, refineFields: string[] = null, refineQuery: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + "resources2/?format=json";
|
||||
if (params != null && params != '') {
|
||||
|
@ -124,30 +124,30 @@ export class SearchResearchResultsService {
|
|||
if (refineQuery) {
|
||||
url += "&" + refineQuery;
|
||||
}
|
||||
|
||||
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
// url += "&format=json";
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||
}
|
||||
|
||||
|
||||
searchResultForEntity(resultType: string, params: string, page: number, size: number, properties: EnvProperties): any {
|
||||
let link = properties.searchAPIURLLAst;
|
||||
//let url = link+params+"/"+this.getEntityQueryName(resultType,true)+ "?format=json";
|
||||
//url += "&page="+(page-1)+"&size="+size;
|
||||
//url += "&sortBy=resultdateofacceptance,descending";
|
||||
|
||||
|
||||
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true);
|
||||
|
||||
|
||||
let url = link + "/" + this.getEntityQueryName(resultType, true);
|
||||
url += "?format=json";
|
||||
url += "&fq=" + params;
|
||||
url += "&sortBy=resultdateofacceptance,descending";
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
}
|
||||
|
||||
//???? why different from above?
|
||||
|
@ -157,9 +157,9 @@ export class SearchResearchResultsService {
|
|||
url += "&sortBy=resultdateofacceptance,descending";
|
||||
url += "&page=" + (page - 1) + "&size=" + size + "&format=json";
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
}
|
||||
|
||||
|
||||
searchForMyOrcidLinks(resultType: string, orcidQuery: string, typeQuery: string, page: number, size: number): any {
|
||||
let url = properties.searchAPIURLLAst + "resources2/?format=json";
|
||||
if (orcidQuery != null && orcidQuery != '') {
|
||||
|
@ -167,14 +167,14 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
url += typeQuery;
|
||||
url += "&page=" + (page - 1) + "&size=" + size;
|
||||
|
||||
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
|
||||
}
|
||||
|
||||
|
||||
parseResults(resultType: string, data: any, properties: EnvProperties): SearchResult[] {
|
||||
let results: SearchResult[] = [];
|
||||
if(data == null) {
|
||||
if (data == null) {
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -182,135 +182,16 @@ export class SearchResearchResultsService {
|
|||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||
|
||||
|
||||
var result: SearchResult = new SearchResult();
|
||||
if (resData['resulttype']) {
|
||||
result.entityType = resData['resulttype']['classname'];
|
||||
} else {
|
||||
result.entityType = resultType;
|
||||
}
|
||||
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);
|
||||
}
|
||||
// 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';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////// 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/", ""));
|
||||
}
|
||||
}
|
||||
} 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.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
|
||||
}
|
||||
/////////////////////////// Athena Code ///////////////////////////
|
||||
if (resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
|
||||
result.programmingLanguages = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['programmingLanguage'])) {
|
||||
if (resData['programmingLanguage'].classname != "Undetermined" && resData['programmingLanguage'].classname) {
|
||||
result.programmingLanguages.push(resData['programmingLanguage'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['programmingLanguage'].length; i++) {
|
||||
if (resData['programmingLanguage'][i].classname != "Undetermined" && resData['programmingLanguage'][i].classname) {
|
||||
result.programmingLanguages.push(resData['programmingLanguage'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resData['language'] && resData['language'] != null) {
|
||||
result.languages = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['language'])) {
|
||||
if (resData['language'].classname != "Undetermined" && resData['language'].classname) {
|
||||
result.languages.push(resData['language'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['language'].length; i++) {
|
||||
if (resData['language'][i].classname != "Undetermined" && resData['language'][i].classname) {
|
||||
result.languages.push(resData['language'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resData['country'] && resData['country'] != null) {
|
||||
result.countriesForResults = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['country'])) {
|
||||
if (resData['country'].classname != "Undetermined" && resData['country'].classname) {
|
||||
result.countriesForResults.push(resData['country'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['country'].length; i++) {
|
||||
if (resData['country'][i].classname != "Undetermined" && resData['country'][i].classname) {
|
||||
result.countriesForResults.push(resData['country'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
|
@ -329,7 +210,107 @@ export class SearchResearchResultsService {
|
|||
} 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 = 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/", ""));
|
||||
}
|
||||
}
|
||||
} 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.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
|
||||
}
|
||||
/////////////////////////// Athena Code ///////////////////////////
|
||||
if (resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
|
||||
result.programmingLanguages = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['programmingLanguage'])) {
|
||||
if (resData['programmingLanguage'].classname != "Undetermined" && resData['programmingLanguage'].classname) {
|
||||
result.programmingLanguages.push(resData['programmingLanguage'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['programmingLanguage'].length; i++) {
|
||||
if (resData['programmingLanguage'][i].classname != "Undetermined" && resData['programmingLanguage'][i].classname) {
|
||||
result.programmingLanguages.push(resData['programmingLanguage'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resData['language'] && resData['language'] != null) {
|
||||
result.languages = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['language'])) {
|
||||
if (resData['language'].classname != "Undetermined" && resData['language'].classname) {
|
||||
result.languages.push(resData['language'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['language'].length; i++) {
|
||||
if (resData['language'][i].classname != "Undetermined" && resData['language'][i].classname) {
|
||||
result.languages.push(resData['language'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resData['country'] && resData['country'] != null) {
|
||||
result.countriesForResults = new Array<string>();
|
||||
|
||||
if (!Array.isArray(resData['country'])) {
|
||||
if (resData['country'].classname != "Undetermined" && resData['country'].classname) {
|
||||
result.countriesForResults.push(resData['country'].classname);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['country'].length; i++) {
|
||||
if (resData['country'][i].classname != "Undetermined" && resData['country'][i].classname) {
|
||||
result.countriesForResults.push(resData['country'][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -337,16 +318,13 @@ export class SearchResearchResultsService {
|
|||
result['id'] = canId;
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
for (let j = 0; j < relLength; j++) {
|
||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||
|
||||
|
||||
if (relation.hasOwnProperty("to")) {
|
||||
if (relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
|
||||
result['projects'] = this.parseProjects(result['projects'], relation);
|
||||
|
@ -354,22 +332,22 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (resData.hasOwnProperty("creator") && resData['creator'] != null) {
|
||||
if (result['authors'] == undefined) {
|
||||
result['authors'] = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
|
||||
}
|
||||
|
||||
|
||||
let authors = resData['creator'];
|
||||
let length = Array.isArray(authors) ? authors.length : 1;
|
||||
|
||||
|
||||
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] = {
|
||||
|
@ -383,20 +361,20 @@ export class SearchResearchResultsService {
|
|||
return (item != undefined && item.fullName != undefined);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer
|
||||
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
|
||||
|
||||
let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
|
||||
result.description = abstracts;
|
||||
result.description = abstracts;
|
||||
// if (result.description && result.description.length > this.sizeOfDescription) {
|
||||
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
|
||||
// }
|
||||
|
||||
|
||||
if (resData.embargoenddate && resData.embargoenddate != '') {
|
||||
result.embargoEndDate = Dates.getDate(resData.embargoenddate);
|
||||
}
|
||||
|
||||
|
||||
if (!Array.isArray(resData.publisher)) {
|
||||
result.publisher = resData.publisher;
|
||||
} else {
|
||||
|
@ -408,14 +386,14 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(resData['context'] != null) {
|
||||
if (resData['context'] != null) {
|
||||
result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context']));
|
||||
}
|
||||
results.push(result);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
parseProjects(projects: {
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
|
@ -432,15 +410,15 @@ export class SearchResearchResultsService {
|
|||
"code": string
|
||||
}>();
|
||||
}
|
||||
|
||||
|
||||
let countProjects = projects.length;
|
||||
|
||||
|
||||
projects[countProjects] = {
|
||||
"id": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"code": ""
|
||||
};
|
||||
|
||||
|
||||
if (relation.title != 'unidentified') {
|
||||
projects[countProjects]['id'] = relation['to'].content;
|
||||
projects[countProjects]['acronym'] = relation.acronym;
|
||||
|
@ -452,36 +430,36 @@ export class SearchResearchResultsService {
|
|||
projects[countProjects]['title'] = "";
|
||||
projects[countProjects]['code'] = "";
|
||||
}
|
||||
|
||||
|
||||
if (relation.hasOwnProperty("funding")) {
|
||||
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
|
||||
|
||||
|
||||
for (let z = 0; z < fundingLength; z++) {
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
|
||||
if (fundingData.hasOwnProperty("funder")) {
|
||||
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
projects[countProjects]['funderName'] = fundingData['funder'].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return projects;
|
||||
}
|
||||
|
||||
|
||||
parseRefineResults(id: string, data: any): any {
|
||||
var results: any = [];
|
||||
if (data.hasOwnProperty("resulthostingdatasource")) {
|
||||
let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1;
|
||||
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let datasource = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'][i] : data['resulthostingdatasource'];
|
||||
|
||||
|
||||
let result: { "name": string, "id": string, "count": number } = {"name": "", "id": "", "count": 0};
|
||||
result['name'] = datasource.name;
|
||||
result['id'] = datasource.id.split("||")[0];
|
||||
result['count'] = datasource.count;
|
||||
|
||||
|
||||
if (result['id'] != id && result['name'] != "Unknown Repository") {
|
||||
results.push(result);
|
||||
}
|
||||
|
@ -489,19 +467,19 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
private numOfResults(url: string, properties: EnvProperties): any {
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['total']));
|
||||
.pipe(map(res => res['total']));
|
||||
}
|
||||
|
||||
|
||||
numOfEntityResults(resultType: string, id: string, entity: string, properties: EnvProperties): any {
|
||||
var parameters: string = "";
|
||||
parameters = this.getEntityQueryName(entity, true) + "/" + id + "/" + this.getEntityQueryName(resultType, true) + "/count";
|
||||
let url = properties.searchAPIURLLAst + parameters + "?format=json";
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
|
||||
numOfResearchOutcomes(params: string, properties: EnvProperties, refineParams: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + "resources2/?format=json&size=0&type=results";
|
||||
if (params.length > 0) {
|
||||
|
@ -518,20 +496,20 @@ export class SearchResearchResultsService {
|
|||
// }
|
||||
url += "&query=" + params;
|
||||
}
|
||||
|
||||
|
||||
if (refineParams != null && refineParams != '') {
|
||||
url += refineParams;
|
||||
}
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
|
||||
|
||||
numOfSearchResults(resultType: string, params: string, properties: EnvProperties, refineParams: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true) + "/count?format=json";
|
||||
if (params.length > 0) {
|
||||
var DOIs: string[] = DOI.getDOIsFromString(params);
|
||||
var doisParams = "";
|
||||
|
||||
|
||||
for (var i = 0; i < DOIs.length; i++) {
|
||||
doisParams += (doisParams.length > 0 ? "&" : "") + 'doi="' + DOIs[i] + '"';
|
||||
}
|
||||
|
@ -541,30 +519,30 @@ export class SearchResearchResultsService {
|
|||
url += "&q=" + StringUtils.URIEncode(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (refineParams != null && refineParams != '') {
|
||||
url += refineParams;
|
||||
}
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
|
||||
numOfSearchResultsLinkedToPub(resultType: string, properties: EnvProperties): any {
|
||||
let url = properties.searchAPIURLLAst + "resources?query=" + encodeURIComponent("( (oaftype exact result) and (resulttypeid exact " + resultType + ") and (relresulttype=publication) )") + "&page=0&size=0&format=json";
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
|
||||
|
||||
countTotalResults(resultType: string, properties: EnvProperties, refineParams: string = null): any {
|
||||
let url = properties.searchAPIURLLAst + this.getEntityQueryName(resultType, true) + "/count?format=json" + refineParams;
|
||||
return this.numOfResults(url, properties);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private quote(word: any): string {
|
||||
return '"'+word+'"';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
private getEntityQueryName(entityType: string, plural: boolean) {
|
||||
if (entityType == "publication" || entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project") {
|
||||
if (plural) {
|
||||
|
@ -578,8 +556,8 @@ 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']));
|
||||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,37 @@
|
|||
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;
|
||||
|
||||
//publications & datasets & orp & software & organizations:
|
||||
projects: Project[];
|
||||
|
||||
|
||||
//datasets & orp & publications & software
|
||||
year: string;
|
||||
embargoEndDate: Date | string;
|
||||
authors: Author[];
|
||||
countriesForResults: string[];
|
||||
languages: string[];
|
||||
|
||||
|
||||
//datasets & orp & software:
|
||||
publisher: string;
|
||||
|
||||
|
||||
//software
|
||||
programmingLanguages: string[];
|
||||
|
||||
|
||||
//dataproviders & projects:
|
||||
organizations: Organization[];
|
||||
|
||||
|
||||
//projects:
|
||||
acronym: string;
|
||||
code: string;
|
||||
|
@ -43,10 +44,10 @@ export class SearchResult {
|
|||
endYear: number;
|
||||
openAccessMandatePublications: boolean;
|
||||
openAccessMandateDatasets: boolean;
|
||||
|
||||
hostedBy_collectedFrom: HostedByCollectedFrom[];
|
||||
//organizations:
|
||||
country: string;
|
||||
|
||||
|
||||
//dataproviders:
|
||||
englishname: string;
|
||||
type: string;
|
||||
|
@ -56,11 +57,12 @@ export class SearchResult {
|
|||
compatibilityUNKNOWN: boolean;
|
||||
countries: string[];
|
||||
subjects: string[];
|
||||
|
||||
|
||||
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">
|
||||
<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 *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">
|
||||
<p>Visit <a
|
||||
class="custom-external uk-margin-right uk-margin-small-top"
|
||||
[href]="properties.enermapsURL + '/?shared_id=' + result.enermapsId" target="_blank" >
|
||||
class="custom-external uk-margin-right uk-margin-small-top"
|
||||
[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">
|
||||
<a *ngIf="!externalUrl && result.id" (click)="onClick()" [queryParams]="createParam()"
|
||||
[routerLink]="url" class="uk-link uk-text-decoration-none uk-width-expand">
|
||||
<div *ngIf="(result.title) || result.acronym">
|
||||
<span *ngIf="result.acronym">
|
||||
{{result.acronym}}
|
||||
|
@ -51,8 +41,9 @@
|
|||
[no title available]
|
||||
</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">
|
||||
<a *ngIf="externalUrl && result.id" (click)="onClick()"
|
||||
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,8 +56,7 @@
|
|||
[no title available]
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div *ngIf="!result.id" class="uk-width-expand">
|
||||
<div *ngIf="!result.id" class="uk-width-expand">
|
||||
<div *ngIf="(result.title) || result.acronym">
|
||||
<span *ngIf="result.acronym">
|
||||
{{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
|
||||
|
@ -93,7 +95,7 @@
|
|||
title="Access Mode">
|
||||
{{result.accessMode}}
|
||||
</span>{{' '}}
|
||||
<span
|
||||
<span
|
||||
*ngIf="result.openAccessMandatePublications && (!result.openAccessMandateDatasets)"
|
||||
class="uk-label uk-label-success uk-text-truncate"
|
||||
title="Open Access mandate for {{openaireEntities.PUBLICATIONS}}">
|
||||
|
@ -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
|
||||
|
@ -118,25 +121,25 @@
|
|||
</span>{{' '}}
|
||||
</span>
|
||||
<span *ngIf="result.programmingLanguages && result.programmingLanguages.length > 0">
|
||||
<span
|
||||
<span
|
||||
*ngFor="let programmingLanguage of result.programmingLanguages"
|
||||
class="uk-label" title="Programming Language">
|
||||
{{programmingLanguage}}
|
||||
</span>{{" "}}
|
||||
</span>
|
||||
<!-- <span -->
|
||||
<!-- *ngIf="result.sc39" class="uk-label" title="Special Clause 39">-->
|
||||
<!-- Special Clause 39-->
|
||||
<!-- </span>{{' '}}-->
|
||||
<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">
|
||||
{{result.compatibility}}
|
||||
</span>{{' '}}
|
||||
<span
|
||||
*ngIf="result.compatibility != undefined && result.compatibility != '' && result.compatibility.toLowerCase() == 'not yet registered'
|
||||
<span
|
||||
*ngIf="result.compatibility != undefined && result.compatibility != '' && result.compatibility.toLowerCase() == 'not yet registered'
|
||||
&& result.resultType != 'service'"
|
||||
class="uk-label" [class.uk-label-danger]="deposit" title="OpenAIRE Compatibility">
|
||||
class="uk-label" [class.uk-label-danger]="deposit" title="OpenAIRE Compatibility">
|
||||
{{result.compatibility}} <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
|
||||
</span>{{' '}}
|
||||
</div>
|
||||
|
@ -151,7 +154,7 @@
|
|||
</span>
|
||||
<span *ngIf="result.code" [class.uk-margin-left]="result.funderShortname">
|
||||
<span class="uk-text-meta">{{openaireEntities.PROJECT}} Code: </span>
|
||||
{{result.code}}
|
||||
{{result.code}}
|
||||
</span>
|
||||
<!-- Currently not parsed -->
|
||||
<!-- <span *ngIf="result.callIdentifier" [class.uk-margin-left]="(result.funderShortname || result.code)">-->
|
||||
|
@ -176,7 +179,7 @@
|
|||
<div *ngIf="result.authors" class="uk-flex uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Authors: </span>
|
||||
<showAuthors [authors]="result.authors" [authorsLimit]=10 [modal]="modal"
|
||||
[showAll]=false></showAuthors>
|
||||
[showAll]=false></showAuthors>
|
||||
</div>
|
||||
<!-- Identifiers -->
|
||||
<div *ngIf="result.identifiers && result.identifiers.size > 0" class="uk-margin-small-bottom">
|
||||
|
@ -189,7 +192,7 @@
|
|||
</div>
|
||||
<!-- Countries -->
|
||||
<div *ngIf="result.countries && result.countries.length > 0"
|
||||
class="uk-margin-small-bottom">
|
||||
class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">{{(result.countries.length == 1) ? 'Country' : 'Countries'}}: </span>
|
||||
<span *ngFor="let country of result.countries.slice(0,10) let i = index">
|
||||
{{country}}{{(i < (result.countries.slice(0, 10).length - 1)) ? ", " : ""}}
|
||||
|
@ -205,7 +208,7 @@
|
|||
</span>
|
||||
<span *ngIf="project.acronym || project.title">
|
||||
| {{ project.acronym ? project.acronym : (project.title.length > 25 ?
|
||||
project.title.substring(0, 25) + '...' : project.title)}}
|
||||
project.title.substring(0, 25) + '...' : project.title)}}
|
||||
</span>
|
||||
<span *ngIf="project.code"> ({{project.code}})</span>
|
||||
<span *ngIf="i < result.projects.length-1">,</span>
|
||||
|
@ -214,7 +217,7 @@
|
|||
</div>
|
||||
<!-- Organizations -->
|
||||
<div *ngIf="showOrganizations && result.organizations && result.organizations.length > 0"
|
||||
class="uk-margin-small-bottom">
|
||||
class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Partners: </span>
|
||||
<span *ngFor="let organization of result.organizations.slice(0,10) let i=index">
|
||||
<span>{{organization.name}}</span>
|
||||
|
@ -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">
|
||||
|
@ -242,7 +246,7 @@
|
|||
</div>
|
||||
<!-- Subjects -->
|
||||
<div *ngIf="showSubjects && result.subjects && result.subjects.length > 0"
|
||||
class="uk-margin-small-bottom">
|
||||
class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Subject: </span>
|
||||
<span *ngFor="let subject of result.subjects.slice(0,10) let i = index">
|
||||
<span>{{subject}}</span>
|
||||
|
@ -252,18 +256,19 @@
|
|||
</div>
|
||||
<!-- Download from-->
|
||||
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
|
||||
class="uk-margin-small-bottom">
|
||||
class="uk-margin-small-bottom">
|
||||
<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')">
|
||||
[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')">
|
||||
<icon [name]="from.accessRightIcon" flex="true" type="outlined"></icon>
|
||||
</span>
|
||||
<span class="uk-width-expand">
|
||||
<span class="uk-margin-right uk-display-inline-block">
|
||||
<span class="uk-text-meta">Download from: </span>
|
||||
<a *ngIf="from.downloadUrl"
|
||||
[href]="from.downloadUrl" target="_blank" class="title">
|
||||
[href]="from.downloadUrl" target="_blank" class="title">
|
||||
<span class="custom-external">{{from.downloadNames.join("; ")}}</span>
|
||||
</a>
|
||||
<span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title">
|
||||
|
@ -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"
|
||||
[queryParams]="{datasourceId: from.collectedNamesAndIds.get(collectedName)}" (click)="onClick();">
|
||||
{{collectedName}}<ng-container *ngIf="(i !== (from.collectedNamesAndIds.size - 1))">; </ng-container>
|
||||
<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>
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
|
@ -292,7 +299,7 @@
|
|||
<div>
|
||||
<span class="uk-width-expand uk-flex-right">
|
||||
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit"
|
||||
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
||||
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon>
|
||||
<span>Go to repository</span>
|
||||
|
@ -304,33 +311,33 @@
|
|||
</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))"
|
||||
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;">
|
||||
<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"
|
||||
transform="translate(-4 -0.67)"/>
|
||||
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"
|
||||
transform="translate(-4 -0.67)"/>
|
||||
</svg>
|
||||
<span class="uk-margin-small-left">
|
||||
{{" " + result.measure[2] + " popularity" }}
|
||||
</span>
|
||||
</a>
|
||||
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
|
||||
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
|
||||
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span class="popularity-{{result.measure[0]}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20.234" height="26.974"
|
||||
viewBox="0 0 20.234 26.974"><defs> </defs><path class="a"
|
||||
d="M16.014.67a27.181,27.181,0,0,1,.936,6.07c0,2.605-1.707,4.717-4.312,4.717A4.6,4.6,0,0,1,8.047,6.74l.038-.455A17.411,17.411,0,0,0,4,17.527a10.117,10.117,0,0,0,20.234,0A21.643,21.643,0,0,0,16.014.67ZM13.75,23.85A4.016,4.016,0,0,1,9.678,19.88c0-2.049,1.328-3.49,3.554-3.946a9.753,9.753,0,0,0,5.843-3.263,17.645,17.645,0,0,1,.746,5.109,6.072,6.072,0,0,1-6.07,6.07Z"
|
||||
transform="translate(-4 -0.67)"/>
|
||||
viewBox="0 0 20.234 26.974"><defs> </defs><path class="a"
|
||||
d="M16.014.67a27.181,27.181,0,0,1,.936,6.07c0,2.605-1.707,4.717-4.312,4.717A4.6,4.6,0,0,1,8.047,6.74l.038-.455A17.411,17.411,0,0,0,4,17.527a10.117,10.117,0,0,0,20.234,0A21.643,21.643,0,0,0,16.014.67ZM13.75,23.85A4.016,4.016,0,0,1,9.678,19.88c0-2.049,1.328-3.49,3.554-3.946a9.753,9.753,0,0,0,5.843-3.263,17.645,17.645,0,0,1,.746,5.109,6.072,6.072,0,0,1-6.07,6.07Z"
|
||||
transform="translate(-4 -0.67)"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="uk-margin-small-left">
|
||||
|
@ -344,32 +351,34 @@
|
|||
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"
|
||||
d="M3.333,7v4.667h2V7Zm4,0v4.667h2V7ZM2,15H14.667V13H2Zm9.333-8v4.667h2V7Zm-3-6L2,4.333V5.667H14.667V4.333Z"
|
||||
transform="translate(-2 -1)"/>
|
||||
d="M3.333,7v4.667h2V7Zm4,0v4.667h2V7ZM2,15H14.667V13H2Zm9.333-8v4.667h2V7Zm-3-6L2,4.333V5.667H14.667V4.333Z"
|
||||
transform="translate(-2 -1)"/>
|
||||
</svg>
|
||||
<span class="uk-margin-small-left">
|
||||
{{" " + result.measure[3] + " influence" }}
|
||||
</span>
|
||||
</a>
|
||||
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
|
||||
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
|
||||
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
|
||||
<span class="uk-flex uk-flex-middle">
|
||||
<span class="influence-{{result.measure[1]}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24.299" height="26.857" viewBox="0 0 24.299 26.857"><defs><style>.a {
|
||||
fill: #464646;
|
||||
}</style></defs><path class="a"
|
||||
d="M4.558,12.51v8.952H8.394V12.51Zm7.673,0v8.952h3.837V12.51ZM2,27.857H26.3V24.02H2ZM19.9,12.51v8.952h3.837V12.51ZM14.149,1,2,7.394V9.952H26.3V7.394Z"
|
||||
transform="translate(-2 -1)"/>
|
||||
fill: #464646;
|
||||
}</style></defs><path class="a"
|
||||
d="M4.558,12.51v8.952H8.394V12.51Zm7.673,0v8.952h3.837V12.51ZM2,27.857H26.3V24.02H2ZM19.9,12.51v8.952h3.837V12.51ZM14.149,1,2,7.394V9.952H26.3V7.394Z"
|
||||
transform="translate(-2 -1)"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class=" uk-margin-small-left">
|
||||
|
@ -383,25 +392,27 @@
|
|||
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>
|
||||
</div>
|
||||
</ng-container>
|
||||
<!-- && loggedIn -->
|
||||
<!-- TODO: change colors/opacity and disabled attr for ORCID buttons -->
|
||||
<!-- && loggedIn -->
|
||||
<!-- TODO: change colors/opacity and disabled attr for ORCID buttons -->
|
||||
<span *ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator')
|
||||
&& showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType"
|
||||
class="uk-margin-auto-left">
|
||||
class="uk-margin-auto-left">
|
||||
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
[resultId]="result.relcanId" [resultTitle]="result.title"
|
||||
[type]="result.resultType" [pageType]="'search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
[resultId]="result.relcanId" [resultTitle]="result.title"
|
||||
[type]="result.resultType" [pageType]="'search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
</orcid-work>
|
||||
</span>
|
||||
<span *ngIf="(properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community') && result.orcidCreationDates?.length > 0"
|
||||
class="uk-width-expand uk-text-right">
|
||||
<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">
|
||||
Added in ORCID:
|
||||
|
@ -415,5 +426,5 @@
|
|||
</span>
|
||||
</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 {
|
||||
fill: #e1920a;
|
||||
|
||||
.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 {
|
||||
fill: #444;
|
||||
}
|
||||
|
||||
.popularity-C, .popularity-C5, .influence-C, .influence-C5 {
|
||||
& svg a {
|
||||
fill: #444;
|
||||
}}
|
|
@ -12,7 +12,7 @@ import {HelperFunctions} from "../HelperFunctions.class";
|
|||
@Component({
|
||||
selector: 'result-preview',
|
||||
templateUrl: 'result-preview.component.html',
|
||||
styleUrls: ['result-preview.component.less']
|
||||
styleUrls: ['result-preview.component.less']
|
||||
})
|
||||
export class ResultPreviewComponent implements OnInit, OnChanges {
|
||||
@Input() result: ResultPreview;
|
||||
|
@ -23,7 +23,8 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
@Input() modal: AlertModal = null;
|
||||
@Input() promoteWebsiteURL: boolean = false;
|
||||
@Input() hasLink: boolean = true;
|
||||
@Input() isCard: boolean = false;
|
||||
@Input() isCard: boolean = false;
|
||||
@Input() isMobile: boolean = false;
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
public urlParam: string;
|
||||
public url: string;
|
||||
|
@ -34,11 +35,11 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
@Input() showOrcid: boolean = true;
|
||||
@Input() showEnermaps: boolean = false;
|
||||
@Input() deposit: boolean = false;
|
||||
@Input() provenanceActionVocabulary = null;
|
||||
@Input() relationsVocabulary = null;
|
||||
@Input() provenanceActionVocabulary = null;
|
||||
@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,100 +81,102 @@ 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) {
|
||||
// this.beforeTitle.push((this.result.relation ? this.result.relation+": " : "") + this.result.percentage.toString() + "%");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public getTypeName(type: string): string {
|
||||
return StringUtils.getEntityName(type, false);
|
||||
}
|
||||
|
||||
|
||||
public removeUnknown(array: string[]): string[] {
|
||||
return array.filter(value => value.toLowerCase() !== 'unknown');
|
||||
}
|
||||
|
||||
|
||||
public removeDuplicates(array: string[]): string[] {
|
||||
return array.filter(value => value.toLowerCase() !== this.result.resultType);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
public get isResultType() {
|
||||
return this.result.resultType == "publication" || this.result.resultType == "dataset" ||
|
||||
this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result";
|
||||
this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,12 +81,12 @@ export class ResultPreview {
|
|||
countries: string[];
|
||||
|
||||
//Impact factor
|
||||
DOI:string;
|
||||
measure: Array<string>;
|
||||
|
||||
DOI: string;
|
||||
measure: Measure;
|
||||
|
||||
//publications & datasets & orp & software & organizations:
|
||||
projects: Project[];
|
||||
|
||||
|
||||
//datasets & orp & publications & software
|
||||
description: string;
|
||||
year: string;
|
||||
|
@ -101,13 +101,13 @@ export class ResultPreview {
|
|||
|
||||
//datasets & orp & software:
|
||||
publisher: string;
|
||||
|
||||
|
||||
//software
|
||||
programmingLanguages: string[];
|
||||
|
||||
|
||||
//dataproviders & projects:
|
||||
organizations: Organization[];
|
||||
|
||||
|
||||
//projects:
|
||||
acronym: string;
|
||||
code: string;
|
||||
|
@ -120,10 +120,10 @@ export class ResultPreview {
|
|||
endYear: number;
|
||||
openAccessMandatePublications: boolean;
|
||||
openAccessMandateDatasets: boolean;
|
||||
|
||||
|
||||
//organizations:
|
||||
country: string;
|
||||
|
||||
|
||||
//dataproviders:
|
||||
englishname: string;
|
||||
websiteURL: string;
|
||||
|
@ -131,10 +131,10 @@ export class ResultPreview {
|
|||
compatibility: string;
|
||||
compatibilityUNKNOWN: boolean;
|
||||
subjects: string[];
|
||||
|
||||
|
||||
resultType: string;
|
||||
types: string[];
|
||||
|
||||
|
||||
// Relation result
|
||||
relationName: string;
|
||||
relation: string;
|
||||
|
@ -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;
|
||||
|
@ -197,18 +198,18 @@ export class ResultPreview {
|
|||
// }
|
||||
resultPreview.identifiers = result.identifiers;
|
||||
resultPreview.enermapsId = result.enermapsId;
|
||||
resultPreview.measure = result.measure;
|
||||
resultPreview.measure = result.measure;
|
||||
return resultPreview;
|
||||
}
|
||||
|
||||
public static resultLandingInfoConvert(result: ResultLandingInfo, type: string): ResultPreview {
|
||||
|
||||
public static resultLandingInfoConvert(result: ResultLandingInfo, type: string): ResultPreview {
|
||||
let resultPreview: ResultPreview = new ResultPreview();
|
||||
resultPreview.title = result.title;
|
||||
resultPreview.accessMode = result.accessMode;
|
||||
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;
|
||||
|
@ -224,13 +225,13 @@ export class ResultPreview {
|
|||
resultPreview.hostedBy_collectedFrom = result.hostedBy_collectedFrom;
|
||||
return resultPreview;
|
||||
}
|
||||
|
||||
|
||||
public static relationResultConvert(result: RelationResult): ResultPreview {
|
||||
let resultPreview: ResultPreview = new 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;
|
||||
|
@ -239,19 +240,19 @@ export class ResultPreview {
|
|||
resultPreview.provenanceAction = result.provenanceAction;
|
||||
return 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;
|
||||
|
@ -260,25 +261,25 @@ export class ResultPreview {
|
|||
resultPreview.resultType = 'organization';
|
||||
return 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