Merge branch 'master' of code-repo.d4science.org:MaDgIK/openaire-library

This commit is contained in:
argirok 2021-09-29 14:36:14 +03:00
commit e3e6cbd284
12 changed files with 66 additions and 41 deletions

View File

@ -240,7 +240,7 @@ export class DataProviderService {
for(let i=0; i<length; i++) {
mydata = data[5].length!=undefined ? data[5][i] : data[5];
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class == "isProvidedBy" && mydata['to'].type == "organization") {
if(mydata['to'].class && mydata['to'].class.toLowerCase() == "isprovidedby" && mydata['to'].type == "organization") {
//if(this.dataProviderInfo.organizations == undefined) {
if(this.dataProviderInfo.organizations.length == 0) {
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();

View File

@ -7,6 +7,9 @@ import {Injectable} from '@angular/core';
})
export class ParsingFunctions {
public notebookInSubjects: boolean = false;
private notebookKeyword: string = "eosc jupyter notebook";
private notebook_label: string = "EOSC";
private notebook_value: string = "EOSC Jupyter Notebook";
public open = 'assets/common-assets/unlock.svg';
public closed = 'assets/common-assets/lock.svg';
@ -529,15 +532,46 @@ export class ParsingFunctions {
classifiedSubjects.get(subject.classname).push(subject.content);
} else {
if (subject.classid == "keyword") {
let content: string = subject.content;
console.log("keyword subject: "+content);
if(content && content.toLowerCase().includes(this.notebookKeyword)) {
// console.log("included in keyword subject: "+content);
console.log("included");
this.notebookInSubjects = true;
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(this.notebook_label, new Array<string>());
}
classifiedSubjects.get(this.notebook_label).push(this.notebook_value);
} else {
if (subjects == undefined) {
subjects = new Array<string>();
}
let content: string = subject.content;
if(content && content.toLowerCase().includes("notebook")) {
this.notebookInSubjects = true;
}
subjects.push(content);
}
} else {
let content: string = subject.content;
let classname: string = subject.classname;
console.log("other subject: "+classname + ": " +content);
if( (content && content.toLowerCase().includes(this.notebookKeyword) ||
(classname && classname.toLowerCase().includes(this.notebookKeyword)))) {
// console.log("included in other subject: "+classname + ": "+content);
console.log("included");
this.notebookInSubjects = true;
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(this.notebook_label, new Array<string>());
}
classifiedSubjects.get(this.notebook_label).push(this.notebook_value);
} else {
if (otherSubjects == undefined) {
otherSubjects = new Map<string, string[]>();
@ -546,17 +580,12 @@ export class ParsingFunctions {
if (!otherSubjects.has(subject.classname)) {
otherSubjects.set(subject.classname, new Array<string>());
}
let content: string = subject.content;
let classname: string = subject.classname;
if( (content && content.toLowerCase().includes("notebook") ||
(classname && classname.toLowerCase().includes("notebook")))) {
this.notebookInSubjects = true;
}
otherSubjects.get(classname).push(content);
}
}
}
}
}
return [subjects, otherSubjects, classifiedSubjects];
}

View File

@ -174,7 +174,7 @@ export class ProjectService {
this.projectInfo.organizations = [];//new Map<string, string>();
if(!Array.isArray(data[2])) {
if(data[2].hasOwnProperty("to") && data[2]['to'].class == "hasParticipant") {
if(data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") {
let acronym: string = "";
let name: string = "";
let id: string = "";
@ -200,7 +200,7 @@ export class ProjectService {
let acronym: string = "";
let name: string = "";
let id: string = "";
if(data[2][i].hasOwnProperty("to") && data[2][i]['to'].class == "hasParticipant") {
if(data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
if(data[2][i].hasOwnProperty("legalshortname")) {
acronym = data[2][i].legalshortname;
}

View File

@ -125,12 +125,12 @@
<li *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore'
&& (properties.environment == 'beta' || properties.environment == 'development')">
<a class="uk-link-text uk-text-bold uk-text-uppercase"
target="_blank" href="https://marketplace.eosc-portal.eu/services/egi-notebooks?q=EGI+Notebook">
<span class="uk-icon-button notebook-button uk-icon">
<img src="assets/common-assets/egi-fed.notebook.png"
loading="lazy" alt="egi_notebook" style="width:30px; height:21px">
target="_blank" [href]="properties.egiNotebookLink">
<span class="uk-icon-button uk-icon">
<img src="assets/common-assets/eosc-logo.png"
loading="lazy" alt="eosc_logo" style="width:28px; height:28px">
</span>
<span class="uk-margin-small-left"><u>EGI Notebook</u></span>
<span class="uk-margin-small-left"><u>EOSC SERVICE: EGI NOTEBOOK</u></span>
<span class="custom-external custom-icon space"></span>
</a>
</li>

View File

@ -27,10 +27,6 @@ import {$e} from "codelyzer/angular/styles/chars";
@Component({
styles: [
'.notebook-button { background-color: #f2f2f2; border: 1px solid #f2f2f2; } ' +
'.notebook-button:hover { background-color: #e5e5e5; border-color: #e5e5e5; } '
],
selector: 'result-landing',
templateUrl: 'resultLanding.component.html',
})

View File

@ -185,22 +185,22 @@ export class ResultLandingService {
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 == "isProducedBy") {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary);
} else if(relation['to'].class == "isRelatedTo") {
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "isrelatedto") {
let provenanceAction: string = "";
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
}
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction);
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") {
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasamongtopnsimilardocuments") {
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.resultLandingInfo.similarResearchResults, relation);
} else if(relation['to'].class == "hasAuthorInstitution") {
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if(relation['to'].class == "isSupplementedBy") {
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "issupplementedby") {
this.resultLandingInfo.supplementaryResearchResults = this.parsingFunctions.parseSupplementaryResearchResults(this.resultLandingInfo.supplementaryResearchResults, relation);
} else if(relation['to'].class == "isSupplementTo") {
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "issupplementto") {
this.resultLandingInfo.supplementedByResearchResults = this.parsingFunctions.parseSupplementedByResearchResults(this.resultLandingInfo.supplementedByResearchResults, relation);
}
}

View File

@ -4,8 +4,6 @@ import {map} from "rxjs/operators";
import {ResultLandingInfo} from "../utils/entities/resultLandingInfo";
import {CustomOptions} from "../services/servicesUtils/customOptions.class";
import {WorkV3_0} from "./orcidWork";
import {encode, toUnicode} from "punycode";
import {Observable} from "rxjs";
import {properties} from "../../../environments/environment";
import {ConnectHelper} from "../connect/connectHelper";
@ -52,6 +50,7 @@ export class OrcidService {
saveWork(resultLandingInfo: ResultLandingInfo, pids: string) {
let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, null);
let portalId: string = ConnectHelper.getCommunityFromDomain(properties.domain);
// if dashboard format changes, check in API the metrics service ("calculateMetrics" method) for orcid KPIs
let dashboard: string = properties.environment + "_" + properties.dashboard + (portalId? "_" + portalId : "");
let result = {
"dashboard": dashboard,

View File

@ -390,7 +390,7 @@ export class SearchDataprovidersService {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isProvidedBy" && relation['to'].type == "organization") {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isprovidedby" && relation['to'].type == "organization") {
if(getOrganizations) {
let item: {"name":string, "id":string} = {"name": "", "id": ""};
//item['name'] = relation.legalname;

View File

@ -113,7 +113,7 @@ export class SearchOrganizationsService {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isParticipant") {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isparticipant") {
if(result['projects'] == undefined) {
result['projects'] = new Array<
{ "id": string, "acronym": string, "title": string,

View File

@ -171,7 +171,7 @@ export class SearchProjectsService {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "hasParticipant") {
if(relation['to'].class && relation['to'].class.toLowerCase() == "hasparticipant") {
if(result['organizations'] == undefined) {
result['organizations'] = new Array<
{ "name": string, "id": string}>();

View File

@ -305,7 +305,7 @@ export class SearchResearchResultsService {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if (relation.hasOwnProperty("to")) {
if (relation['to'].class == "isProducedBy") {
if (relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
result['projects'] = this.parseProjects(result['projects'], relation);
}
}

View File

@ -135,4 +135,5 @@ export interface EnvProperties {
notificationsAPIURL?: string;
myOrcidLinksPage?: string;
footerGrantText?: string;
egiNotebookLink?: string;
}