Merge remote-tracking branch 'origin/develop' into umbrella

This commit is contained in:
Konstantinos Triantafyllou 2024-05-31 14:01:21 +03:00
commit 2790530e14
11 changed files with 299 additions and 239 deletions

View File

@ -2,7 +2,9 @@
<schema2jsonld *ngIf="dataProviderInfo" <schema2jsonld *ngIf="dataProviderInfo"
[data]=dataProviderInfo [URL]="canonicalUrl" type="datasource" [data]=dataProviderInfo [URL]="canonicalUrl" type="datasource"
[otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld> [otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld>
<div *ngIf="dataProviderInfo && !dataProviderInfo.belongsTo" [innerHTML]="dataProviderInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div class="uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -389,6 +389,7 @@ export class DataProviderComponent {
this.dataProviderInfo = data; this.dataProviderInfo = data;
this.getProvenanceUrls(); this.getProvenanceUrls();
this.datasourceId = this.dataProviderInfo.objIdentifier; this.datasourceId = this.dataProviderInfo.objIdentifier;
this.dataProviderInfo.setBelongsTo(this.datasourceId);
let pid:Identifier = Identifier.getPIDFromIdentifiers(this.dataProviderInfo.identifiers); let pid:Identifier = Identifier.getPIDFromIdentifiers(this.dataProviderInfo.identifiers);
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)): this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
(this.linkToLandingPage + this.dataProviderInfo.relcanId)); (this.linkToLandingPage + this.dataProviderInfo.relcanId));

View File

@ -3,7 +3,9 @@
[URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId" [URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId"
type="organization"> type="organization">
</schema2jsonld> </schema2jsonld>
<div *ngIf="organizationInfo && !organizationInfo.belongsTo" [innerHTML]="organizationInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div id="tm-main" class="uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div id="tm-main" class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -401,6 +401,7 @@ export class OrganizationComponent {
} else { } else {
this.organizationInfo = data; this.organizationInfo = data;
this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id
this.organizationInfo.setBelongsTo(this.organizationId);
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))'; this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId); this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId);
this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available'))); this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available')));

View File

@ -2,7 +2,9 @@
<schema2jsonld *ngIf="projectInfo" <schema2jsonld *ngIf="projectInfo"
[data]=projectInfo [URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId" [data]=projectInfo [URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId"
type="project"></schema2jsonld> type="project"></schema2jsonld>
<div *ngIf="projectInfo && !projectInfo.belongsTo" [innerHTML]="projectInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div class=" uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div class=" uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -466,6 +466,8 @@ export class ProjectComponent {
this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe( this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe(
data => { data => {
this.projectInfo = data; this.projectInfo = data;
this.projectInfo.setBelongsTo(id);
console.log(this.projectInfo);
this.projectInfo.id = this.projectId; this.projectInfo.id = this.projectId;
this.actionsAfterGettingProjectInfo(); this.actionsAfterGettingProjectInfo();

View File

@ -4,254 +4,267 @@ import {throwError} from 'rxjs';
import {ProjectInfo} from '../../utils/entities/projectInfo'; import {ProjectInfo} from '../../utils/entities/projectInfo';
import {EnvProperties} from '../../utils/properties/env-properties';
import{EnvProperties} from '../../utils/properties/env-properties'; import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
import { ParsingFunctions } from '../landing-utils/parsingFunctions.class';
import {map} from "rxjs/operators"; import {map} from "rxjs/operators";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
@Injectable() @Injectable()
export class ProjectService { export class ProjectService {
constructor(private http: HttpClient ) { constructor(private http: HttpClient) {
this.parsingFunctions = new ParsingFunctions(); this.parsingFunctions = new ParsingFunctions();
}
public parsingFunctions: ParsingFunctions;
projectInfo: ProjectInfo;
getProjectInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
getProjectInfoByGrantId(grant: string, funder: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'resources?query=(oaftype exact project)' +
'and (projectcode_nt exact "' + grant + '" ) and (fundershortname exact ' + '"' + funder + '"' + ')' + "&format=json&size=1";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['results'][0]))
.pipe(map(res => [res['result']['metadata']['oaf:entity']['oaf:project'], res['result']['header']['dri:objIdentifier']]))
.pipe(map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'], res[1]]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
/*
get project strtDate and endDate
*/
getProjectDates(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url + '_projectDates';
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectDates(id, res)))
}
getHTMLInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => this.parseHTMLInfo(res)));
}
private handleError(error: HttpErrorResponse) {
console.log(error);
return throwError(error || 'Server error');
}
parseHTMLInfo(data: any): any {
let htmlInfo: { "title": string, "acronym": string, "callIdentifier": string };
if (data != null) {
htmlInfo = {"title": data.title, "acronym": data.acronym, "callIdentifier": data.callidentifier};
}
return htmlInfo;
}
parseProjectInfo(data: any, properties: EnvProperties): any {
this.projectInfo = new ProjectInfo();
this.projectInfo.funding = {
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""
};
// ['result']['header']['dri:objIdentifier']
if (data[3] != null) {
this.projectInfo.id = data[3];
} }
public parsingFunctions: ParsingFunctions; // ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
projectInfo: ProjectInfo; if (data[1] != null) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
getProjectInfo (id: string, properties:EnvProperties):any { funding = this.parsingFunctions.parseFundingTrees(data[1]);
if (funding.funderName) {
let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json"; this.projectInfo.funding.funderName = funding.funderName;
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
getProjectInfoByGrantId (grant: string, funder:string, properties:EnvProperties):any {
let url =properties.searchAPIURLLAst+ 'resources?query=(oaftype exact project)'+
'and (projectcode_nt exact "'+grant+'" ) and (fundershortname exact '+'"'+funder+ '"'+')'+"&format=json&size=1";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['results'][0]))
.pipe(map(res => [res['result']['metadata']['oaf:entity']['oaf:project'],res['result']['header']['dri:objIdentifier']]))
.pipe(map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'],res[1]]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
/*
get project strtDate and endDate
*/
getProjectDates (id: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst+'projects/'+id+"?format=json";
let key = url+'_projectDates';
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectDates(id,res)))
}
getHTMLInfo(id: string, properties:EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => this.parseHTMLInfo(res)));
}
private handleError (error: HttpErrorResponse) {
console.log(error);
return throwError(error || 'Server error');
}
parseHTMLInfo (data: any):any {
let htmlInfo: {"title": string, "acronym": string, "callIdentifier": string};
if(data != null) {
htmlInfo = {"title": data.title, "acronym": data.acronym, "callIdentifier": data.callidentifier};
}
return htmlInfo;
}
parseProjectInfo (data: any, properties:EnvProperties):any {
this.projectInfo = new ProjectInfo();
this.projectInfo.funding = {funderName: "", funderShortName: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""};
// ['result']['header']['dri:objIdentifier']
if(data[3] != null) {
this.projectInfo.id = data[3];
}
// ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
if(data[1] != null) {
let funding: {"funderName": string, "funderShortname": string, "stream": string};
funding = this.parsingFunctions.parseFundingTrees(data[1]);
if(funding.funderName) {
this.projectInfo.funding.funderName = funding.funderName;
}
if(funding.funderShortname) {
this.projectInfo.funding.funderShortName = funding.funderShortname;
}
if(funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
} }
if (funding.funderShortname) {
// ['result']['metadata']['oaf:entity']['oaf:project'] this.projectInfo.funding.funderShortName = funding.funderShortname;
if(data[0] != null) {
this.projectInfo.acronym = data[0].acronym;
if(data[0]['title']) {
this.projectInfo.title = Array.isArray(data[0]['title']) ? StringUtils.HTMLToString(String(data[0].title[0])) : StringUtils.HTMLToString(String(data[0].title));
} else {
this.projectInfo.title = "";
}
this.projectInfo.funding.code = data[0].code;
if(data[0].startdate) {
let date: number = Date.parse(data[0].startdate);
this.projectInfo.startDate = (date ? date : null);
}
if(data[0].enddate) {
let date: number = Date.parse(data[0].enddate);
this.projectInfo.endDate = (date ? date : null);
}
if(this.projectInfo.endDate || this.projectInfo.startDate) {
let todayDate = Date.parse(new Date().toString());
this.projectInfo.currentDate = todayDate;
if(this.projectInfo.startDate) {
let startDate = +(this.projectInfo.startDate);
if (todayDate < startDate) {
this.projectInfo.status = "Not started";
}
}
if(this.projectInfo.endDate && !this.projectInfo.status) {
let endDate = +(this.projectInfo.endDate);
if (todayDate <= endDate) {
this.projectInfo.status = "On going";
} else {
this.projectInfo.status = "Closed";
}
}
}
if(this.projectInfo.funding) {
if(this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39;
if(data[0].hasOwnProperty("projectoamandatedata")) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata;
} else if(data[0].hasOwnProperty("ecarticle29_3")) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3;
}
this.projectInfo.funding.callIdentifier = data[0].callidentifier;
}
this.projectInfo.funding.budget = data[0].totalcost;//"10000";
this.projectInfo.funding.contribution = data[0].fundedamount;//"200100";
this.projectInfo.funding.currency = data[0].currency;//"EUR";
}
// if(!Array.isArray(data[0]['summary'])) {
// this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : "";
// } else {
// this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : "";
// }
this.projectInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].summary?data[0].summary:[]);
} }
if (funding.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
// ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel'] // ['result']['metadata']['oaf:entity']['oaf:project']
if(data[2] != null) { if (data[0] != null) {
this.projectInfo.organizations = [];//new Map<string, string>(); this.projectInfo.acronym = data[0].acronym;
if (data[0]['title']) {
this.projectInfo.title = Array.isArray(data[0]['title']) ? StringUtils.HTMLToString(String(data[0].title[0])) : StringUtils.HTMLToString(String(data[0].title));
} else {
this.projectInfo.title = "";
}
this.projectInfo.funding.code = data[0].code;
if (data[0].startdate) {
let date: number = Date.parse(data[0].startdate);
this.projectInfo.startDate = (date ? date : null);
}
if (data[0].enddate) {
let date: number = Date.parse(data[0].enddate);
this.projectInfo.endDate = (date ? date : null);
}
if (this.projectInfo.endDate || this.projectInfo.startDate) {
let todayDate = Date.parse(new Date().toString());
this.projectInfo.currentDate = todayDate;
if (this.projectInfo.startDate) {
let startDate = +(this.projectInfo.startDate);
if (todayDate < startDate) {
this.projectInfo.status = "Not started";
}
}
if (this.projectInfo.endDate && !this.projectInfo.status) {
let endDate = +(this.projectInfo.endDate);
if (todayDate <= endDate) {
this.projectInfo.status = "On going";
} else {
this.projectInfo.status = "Closed";
}
}
}
if (this.projectInfo.funding) {
if (this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39;
if (data[0].hasOwnProperty("projectoamandatedata")) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata;
} else if (data[0].hasOwnProperty("ecarticle29_3")) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3;
}
this.projectInfo.funding.callIdentifier = data[0].callidentifier;
}
this.projectInfo.funding.budget = data[0].totalcost;//"10000";
this.projectInfo.funding.contribution = data[0].fundedamount;//"200100";
this.projectInfo.funding.currency = data[0].currency;//"EUR";
}
// if(!Array.isArray(data[0]['summary'])) {
// this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : "";
// } else {
// this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : "";
// }
this.projectInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].summary ? data[0].summary : []);
}
if(!Array.isArray(data[2])) { // ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']
if(data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") { if (data[2] != null) {
let acronym: string = ""; this.projectInfo.organizations = [];
let name: string = "";
let id: string = "";
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
}
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
}
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
if (data[2].hasOwnProperty("to")) { if (!Array.isArray(data[2])) {
id = data[2]['to'].content; if (data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") {
} let country: string = "";
let acronym: string = "";
let name: string = "";
let id: string = "";
if(data[2].hasOwnProperty("country")) {
country = data[2].country.classname;
}
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
}
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
}
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id}); if (data[2].hasOwnProperty("to")) {
} id = data[2]['to'].content;
} else { }
for(let i=0; i<data[2].length; i++) {
let acronym: string = "";
let name: string = "";
let id: string = "";
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;
}
if(data[2][i].hasOwnProperty("legalname")) {
name = data[2][i].legalname;
}
if(!acronym && !name){
acronym = "[no title available]";
}
if(data[2][i].hasOwnProperty("to")) { this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
id = data[2][i]['to'].content; }
} } else {
for (let i = 0; i < data[2].length; i++) {
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id}); let country: string = "";
} let acronym: string = "";
} let name: string = "";
let id: string = "";
if (data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
if(data[2][i].hasOwnProperty("country")) {
country = data[2][i].country.classname;
} }
if (data[2][i].hasOwnProperty("legalshortname")) {
acronym = data[2][i].legalshortname;
}
if (data[2][i].hasOwnProperty("legalname")) {
name = data[2][i].legalname;
}
if (!acronym && !name) {
acronym = "[no title available]";
}
if (data[2][i].hasOwnProperty("to")) {
id = data[2][i]['to'].content;
}
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
}
} }
}
if(this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.url = properties.cordisURL+this.projectInfo.funding.code;
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
}
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.projectInfo;
} }
parseProjectDates (id: string, data: any):any { if (this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") {
let project = { id: id, startDate: "", endDate: ""}; this.projectInfo.url = properties.cordisURL + this.projectInfo.funding.code;
if(data[0] != null) { this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
project.startDate = data[0].startdate;
project.endDate = data[0].enddate;
}
return project;
} }
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.projectInfo;
}
parseProjectDates(id: string, data: any): any {
let project = {id: id, startDate: "", endDate: ""};
if (data[0] != null) {
project.startDate = data[0].startdate;
project.endDate = data[0].enddate;
}
return project;
}
} }

View File

@ -202,4 +202,15 @@ export class DataProviderInfo {
//relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>; //relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
relatedDatasources: { "id": string, "name": string, "count": number }[] = []; relatedDatasources: { "id": string, "name": string, "count": number }[] = [];
belongsTo: boolean = true;
message: string;
setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.datasource || BelongsTo.datasource.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.datasource.message : null;
if (this.message) {
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -29,4 +29,14 @@ export class OrganizationInfo {
deletedByInferenceIds: string[]; deletedByInferenceIds: string[];
identifiers: Map<string, string[]>; //key is the classname identifiers: Map<string, string[]>; //key is the classname
belongsTo: boolean = true;
message: string;
setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.organization || BelongsTo.organization.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.organization.message : null;
if (this.message) {
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -1,12 +1,29 @@
import {BelongsTo, Measure} from "./resultLandingInfo"; import {BelongsTo, Measure} from "./resultLandingInfo";
import {StringUtils} from "../string-utils.class";
export interface Funding {
funderName: string,
funderShortName: string,
funderJurisdiction: string,
code: string,
callIdentifier: string,
fundingStream: string,
budget: string,
contribution: string,
currency: string
}
export interface ProjectOrganization {
acronym: string,
country: string,
name: string,
id: string
}
export class ProjectInfo { export class ProjectInfo {
id:string; id: string;
acronym: string; acronym: string;
title: string; title: string;
funding: {funderName: string, funderShortName: string, code: string, callIdentifier: string, funding: Funding;
fundingStream: string, budget: string, contribution: string, currency: string};
startDate: number; startDate: number;
endDate: number; endDate: number;
currentDate: number; currentDate: number;
@ -14,7 +31,7 @@ export class ProjectInfo {
openAccessMandatePublications: string; openAccessMandatePublications: string;
openAccessMandateDatasets: string; openAccessMandateDatasets: string;
// specialClause39: string; // specialClause39: string;
organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>; organizations: ProjectOrganization[];
url: string; url: string;
urlInfo: string; urlInfo: string;
description: string; description: string;
@ -29,8 +46,8 @@ export class ProjectInfo {
setBelongsTo(id: string) { setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.project || BelongsTo.project.fields.findIndex(field => BelongsTo.check(this, field)) != -1; this.belongsTo = !BelongsTo.project || BelongsTo.project.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo?BelongsTo.project.message:null; this.message = !this.belongsTo ? BelongsTo.project.message : null;
if(this.message) { if (this.message) {
this.message = this.message.replace('((id))', id); this.message = this.message.replace('((id))', id);
} }
} }

View File

@ -79,7 +79,6 @@ export class BelongsTo {
return BelongsTo.check(json, field); return BelongsTo.check(json, field);
} }
} }
console.log(json, field.value)
return json == field.value; return json == field.value;
} }
return false; return false;