[Develop | ADDED]: Add belongsTo configuration for all entities and initialize it in results.

This commit is contained in:
Konstantinos Triantafyllou 2024-05-29 13:05:04 +03:00
parent 59fc73bf4d
commit 65a60ddad1
8 changed files with 274 additions and 211 deletions

View File

@ -39,7 +39,7 @@ export class ParsingFunctions {
let fundedByProject: Project = { let fundedByProject: Project = {
"id": "", "acronym": "", "title": "", "id": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "", "funderShortname": "", "funderName": "", "funderJurisdiction": "",
"funding": "", "code": "", "provenanceAction": "", "validated": false "funding": "", "code": "", "provenanceAction": "", "validated": false
}; };
@ -61,8 +61,7 @@ export class ParsingFunctions {
} }
if (relation.hasOwnProperty("funding")) { if (relation.hasOwnProperty("funding")) {
let funding: { "funderName": string, "funderShortname": string, "stream": string }; let funding = this.parseFundingTrees(relation.funding);
funding = this.parseFundingTrees(relation.funding);
if (funding.funderName) { if (funding.funderName) {
fundedByProject['funderName'] = funding.funderName; fundedByProject['funderName'] = funding.funderName;
@ -70,6 +69,9 @@ export class ParsingFunctions {
if (funding.funderShortname) { if (funding.funderShortname) {
fundedByProject['funderShortname'] = funding.funderShortname; fundedByProject['funderShortname'] = funding.funderShortname;
} }
if(funding.funderJurisdiction) {
fundedByProject['funderJurisdiction'] = funding.funderJurisdiction;
}
if (funding.stream) { if (funding.stream) {
fundedByProject['funding'] = funding.stream; fundedByProject['funding'] = funding.stream;
} }
@ -79,10 +81,11 @@ export class ParsingFunctions {
} }
// publication & research data : for fundedByProjects | project landing : for funding // publication & research data : for fundedByProjects | project landing : for funding
public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } { public parseFundingTrees(fundingTree: any): any {
let funding: { "funderName": string, "funderShortname": string, "stream": string } = { let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string } = {
"funderName": "", "funderName": "",
"funderShortname": "", "funderShortname": "",
"funderJurisdiction": "",
"stream": "" "stream": ""
}; };
let length = Array.isArray(fundingTree) ? fundingTree.length : 1; let length = Array.isArray(fundingTree) ? fundingTree.length : 1;
@ -93,6 +96,7 @@ export class ParsingFunctions {
if (fundingData.hasOwnProperty("funder")) { if (fundingData.hasOwnProperty("funder")) {
funding.funderShortname = fundingData['funder'].shortname; funding.funderShortname = fundingData['funder'].shortname;
funding.funderName = fundingData['funder'].name; funding.funderName = fundingData['funder'].name;
funding.funderJurisdiction = fundingData['funder'].jurisdiction;
} }
funding.stream = this.addFundingLevel0(fundingData, funding.stream); funding.stream = this.addFundingLevel0(fundingData, funding.stream);

View File

@ -2,7 +2,9 @@
<schema2jsonld *ngIf="resultLandingInfo && resultLandingInfo.record" <schema2jsonld *ngIf="resultLandingInfo && resultLandingInfo.record"
[data]=resultLandingInfo.record [URL]="canonicalUrl" [data]=resultLandingInfo.record [URL]="canonicalUrl"
[searchActionRoute]="properties.searchLinkToResults"></schema2jsonld> [searchActionRoute]="properties.searchLinkToResults"></schema2jsonld>
<div *ngIf="resultLandingInfo && !resultLandingInfo.belongsTo" [innerHTML]="resultLandingInfo.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 *ngIf="!isMobile" id="tm-main" class="landing uk-section uk-padding-remove tm-middle"> <div *ngIf="!isMobile" id="tm-main" class="landing uk-section uk-padding-remove tm-middle">
<div class="tm-main"> <div class="tm-main">
@ -1200,4 +1202,4 @@
<fs-modal *ngIf="resultLandingInfo" #addThisFsModal classTitle="uk-tile-default uk-border-bottom" classBody="uk-flex uk-flex-center uk-flex-middle"> <fs-modal *ngIf="resultLandingInfo" #addThisFsModal classTitle="uk-tile-default uk-border-bottom" classBody="uk-flex uk-flex-center uk-flex-middle">
<addThis *ngIf="addThisClicked"></addThis> <addThis *ngIf="addThisClicked"></addThis>
</fs-modal> </fs-modal>
</ng-container> </ng-container>

View File

@ -515,6 +515,9 @@ export class ResultLandingComponent {
this.resultLandingInfo = data; this.resultLandingInfo = data;
this.id = this.resultLandingInfo.objIdentifier; this.id = this.resultLandingInfo.objIdentifier;
let typeId = this.identifier?.id?'pid':'id';
let id = this.identifier?.id?this.identifier.id:this.id;
this.resultLandingInfo.setBelongsTo(typeId, id);
//old //old
// this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; // this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
// this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; // this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
@ -592,7 +595,6 @@ export class ResultLandingComponent {
this.setActiveTab(); this.setActiveTab();
this.cdr.detectChanges(); this.cdr.detectChanges();
if (contexts) { if (contexts) {
if (this.communityId && this.communityId == "enermaps" && properties.enermapsURL) { if (this.communityId && this.communityId == "enermaps" && properties.enermapsURL) {
this.enermapsId = ParsingFunctions.getEnermapsConceptId(contexts); this.enermapsId = ParsingFunctions.getEnermapsConceptId(contexts);

View File

@ -1,202 +1,205 @@
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {Measure} from "./resultLandingInfo"; import {BelongsTo, Measure} from "./resultLandingInfo";
export class DataproviderProvenance { export class DataproviderProvenance {
provenance: Map<string, {"urlPrefix": string, "name": string}>; provenance: Map<string, { "urlPrefix": string, "name": string }>;
constructor() { constructor() {
this.provenance = new Map(); this.provenance = new Map();
this.provenance.set("opendoar____::", {"urlPrefix": properties.openDoarURL, "name": "OpenDOAR"});//, "idRegexPrefix": ""}); this.provenance.set("opendoar____::", {"urlPrefix": properties.openDoarURL, "name": "OpenDOAR"});//, "idRegexPrefix": ""});
this.provenance.set("re3data_____::", {"urlPrefix": properties.r3DataURL, "name": "re3data.org"}); this.provenance.set("re3data_____::", {"urlPrefix": properties.r3DataURL, "name": "re3data.org"});
this.provenance.set("fairsharing_::", {"urlPrefix": properties.fairSharingURL, "name": "FAIRsharing"}); this.provenance.set("fairsharing_::", {"urlPrefix": properties.fairSharingURL, "name": "FAIRsharing"});
this.provenance.set("eosc________::", {"urlPrefix": properties.eoscMarketplaceURL, "name": "EOSC Service Catalogue"}); this.provenance.set("eosc________::", {
"urlPrefix": properties.eoscMarketplaceURL,
"name": "EOSC Service Catalogue"
});
} }
} }
export class DataProviderInfo { export class DataProviderInfo {
relcanId; relcanId;
objIdentifier: string; objIdentifier: string;
record; record;
title: { "name": string, "url": string }; title: { "name": string, "url": string };
officialName: string; officialName: string;
type: string; type: string;
registry: boolean; registry: boolean;
compatibility: { "info": string, "name": string, "id": string }; compatibility: { "info": string, "name": string, "id": string };
oaiPmhURL: string; oaiPmhURL: string;
openDoarId: string; openDoarId: string;
r3DataId: string; r3DataId: string;
provenance: Map<string, {"url": string[]}>; provenance: Map<string, { "url": string[] }>;
originalId: string; originalId: string;
countries: string[]; countries: string[];
journal: {"journal": "", "issn": string, "lissn": string, "eissn": string}; journal: { "journal": "", "issn": string, "lissn": string, "eissn": string };
description: string; description: string;
subjects: string[]; subjects: string[];
jurisdiction: string; jurisdiction: string;
thematic: boolean; thematic: boolean;
contentpolicy: string; contentpolicy: string;
identifiers: Map<string, string[]>; //key is the classname identifiers: Map<string, string[]>; //key is the classname
fundedContent: string; // search query fundedContent: string; // search query
measure: Measure; measure: Measure;
//collected from datasource api //collected from datasource api
// aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; // aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string};
aggregationStatus: {"fulltexts": string}; aggregationStatus: { "fulltexts": string };
tabs: {"name": string, "content": string}[]; tabs: { "name": string, "content": string }[];
tabs2: string[] =[]; tabs2: string[] = [];
tabsInTypes = { tabsInTypes = {
"publicationsTab": new Set<string>( "publicationsTab": new Set<string>(
[ "aggregator::datarepository", ["aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"infospace", "infospace",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"scholarcomminfra", "scholarcomminfra",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"orprepository" "orprepository"
]), ]),
"datasetsTab": new Set<string>( "datasetsTab": new Set<string>(
[ "aggregator::datarepository", ["aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"infospace", "infospace",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"scholarcomminfra", "scholarcomminfra",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"orprepository" "orprepository"
]), ]),
"statisticsTab": new Set<string>( "statisticsTab": new Set<string>(
[ "aggregator::datarepository", ["aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"orprepository" "orprepository"
]), ]),
// "organizationsTab": new Set<string>( // "organizationsTab": new Set<string>(
// [ "entityregistry::projects", // [ "entityregistry::projects",
// "entityregistry::repositories" // "entityregistry::repositories"
// ]), // ]),
"projectsTab": new Set<string>(["entityregistry::projects"]), "projectsTab": new Set<string>(["entityregistry::projects"]),
"datasourcesTab": new Set<string>(["entityregistry::repositories"]), "datasourcesTab": new Set<string>(["entityregistry::repositories"]),
"relatedDatasourcesTab": new Set<string>( "relatedDatasourcesTab": new Set<string>(
[ "aggregator::pubsrepository::unknown", ["aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::datarepository" "aggregator::datarepository"
]), ]),
"softwareTab": new Set<string>( "softwareTab": new Set<string>(
[ [
"aggregator::datarepository", "aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"infospace", "infospace",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"scholarcomminfra", "scholarcomminfra",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"softwarerepository", "softwarerepository",
"aggregator::softwarerepository", "aggregator::softwarerepository",
"orprepository" "orprepository"
]), ]),
"orpsTab": new Set<string>( "orpsTab": new Set<string>(
[ [
"aggregator::datarepository", "aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"infospace", "infospace",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"scholarcomminfra", "scholarcomminfra",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"softwarerepository", "softwarerepository",
"aggregator::softwarerepository", "aggregator::softwarerepository",
"orprepository" "orprepository"
]), ]),
"metricsTab": new Set<string>( "metricsTab": new Set<string>(
[ "aggregator::datarepository", ["aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"crissystem", "crissystem",
"datarepository::unknown", "datarepository::unknown",
"infospace", "infospace",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"websource", "websource",
"pubsrepository::unknown", "pubsrepository::unknown",
"scholarcomminfra", "scholarcomminfra",
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"softwarerepository", "softwarerepository",
"aggregator::softwarerepository", "aggregator::softwarerepository",
"orprepository" "orprepository"
]) ])
}; };
resultsBy: string; resultsBy: string;
resultTypes = { resultTypes = {
"collectedFrom": new Set<string>( "collectedFrom": new Set<string>(
[ "aggregator::datarepository", ["aggregator::datarepository",
"aggregator::pubsrepository::institutional", "aggregator::pubsrepository::institutional",
"aggregator::pubsrepository::unknown", "aggregator::pubsrepository::unknown",
"aggregator::pubsrepository::journals", "aggregator::pubsrepository::journals",
"entityregistry::projects", "entityregistry::projects",
"entityregistry::repositories", "entityregistry::repositories",
"infospace", "infospace",
"scholarcomminfra", "scholarcomminfra",
"pubscatalogue::unknown", "pubscatalogue::unknown",
"aggregator::softwarerepository" "aggregator::softwarerepository"
]), ]),
"hostedBy": new Set<string>( "hostedBy": new Set<string>(
[ "crissystem", ["crissystem",
"datarepository::unknown", "datarepository::unknown",
"pubsrepository::institutional", "pubsrepository::institutional",
"pubsrepository::journal", "pubsrepository::journal",
"pubsrepository::unknown", "pubsrepository::unknown",
"pubsrepository::thematic", "pubsrepository::thematic",
"softwarerepository", "softwarerepository",
"orprepository" "orprepository"
]) ])
}; };
organizations: {"acronym": string, "name": string, "id": string}[] = []; organizations: { "acronym": string, "name": string, "id": string }[] = [];
//publications: any; //publications: any;
//datasets: any; //datasets: any;
statistics: any; statistics: any;
//projects: any; //projects: any;
datasources: any; datasources: any;
//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 }[] = [];
} }

View File

@ -1,3 +1,5 @@
import {BelongsTo} from "./resultLandingInfo";
export interface OrganizationProject { export interface OrganizationProject {
name: string; name: string;
id: string; id: string;

View File

@ -1,4 +1,5 @@
import {Measure} from "./resultLandingInfo"; import {BelongsTo, Measure} from "./resultLandingInfo";
import {StringUtils} from "../string-utils.class";
export class ProjectInfo { export class ProjectInfo {
id:string; id:string;
@ -23,4 +24,14 @@ export class ProjectInfo {
totalDatasets: number; totalDatasets: number;
publicationsStatus: any; publicationsStatus: any;
measure: Measure; measure: Measure;
belongsTo: boolean = true;
message: string;
setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.project || BelongsTo.project.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo?BelongsTo.project.message:null;
if(this.message) {
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -6,6 +6,9 @@ import {
Project, Project,
RelationResult RelationResult
} from "../result-preview/result-preview"; } from "../result-preview/result-preview";
import {isArray} from "rxjs/internal-compatibility";
import {OpenaireEntities} from "../properties/searchFields";
import {StringUtils} from "../string-utils.class";
export interface Id { export interface Id {
type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid"; type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid";
@ -30,18 +33,6 @@ export interface Context {
} }
export interface Measure { export interface Measure {
// /** @deprecated*/
// downloads?: string;
// /** @deprecated*/
// views?: string;
// /** @deprecated*/
// influence?: string;
// /** @deprecated*/
// popularity?: string;
// /** @deprecated*/
// citations?: string;
// /** @deprecated*/
// impulse?: string;
bip?: Metric[] bip?: Metric[]
counts?: Metric[] counts?: Metric[]
countsPerDatasource?: MetricPerDatasource[]; countsPerDatasource?: MetricPerDatasource[];
@ -61,12 +52,46 @@ export interface Metric {
value: any value: any
} }
class Field {
path: string[];
value: string;
}
export class BelongsTo {
public static result: BelongsTo = null;
public static project: BelongsTo = null;
public static organization: BelongsTo = null;
public static datasource: BelongsTo = null;
fields: Field[];
message: string;
public static check(element: any, field: Field): boolean {
if (field) {
field = Object.assign({}, field);
let json: any = element;
if (field.path.length > 0) {
if (Array.isArray(json)) {
return json.findIndex(value => BelongsTo.check(value, field)) != -1;
} else {
json = json[field.path[0]];
field.path = field.path.slice(1);
return BelongsTo.check(json, field);
}
}
console.log(json, field.value)
return json == field.value;
}
return false;
}
}
export class ResultLandingInfo { export class ResultLandingInfo {
relcanId; relcanId;
objIdentifier: string; objIdentifier: string;
// PUBLICATION, DATASET, SOFTWARE, ORP // PUBLICATION, DATASET, SOFTWARE, ORP
record; record;
resultType: "publication"|"dataset"|"other"|"software"; resultType: "publication" | "dataset" | "other" | "software";
// PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE // PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE
title: string; title: string;
accessMode: string; accessMode: string;
@ -79,26 +104,26 @@ export class ResultLandingInfo {
languages: string[]; languages: string[];
countries: string[]; countries: string[];
description: string; description: string;
hostedBy_collectedFrom: HostedByCollectedFrom[]; hostedBy_collectedFrom: HostedByCollectedFrom[];
// PUBLICATION, DATASET, SOFTWARE, ORP // PUBLICATION, DATASET, SOFTWARE, ORP
fundedByProjects: Project[]; fundedByProjects: Project[];
underCurationMessage: boolean; underCurationMessage: boolean;
publisher: string; publisher: string;
journal: Journal; journal: Journal;
subjects: string[]; subjects: string[];
otherSubjects: Map<string, string[]>; otherSubjects: Map<string, string[]>;
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects> classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
fos: {"id": string, "label": string}[] = []; fos: { "id": string, "label": string }[] = [];
sdg: string[]; sdg: string[];
eoscSubjects: any[]; eoscSubjects: any[];
oaRoutes: OARoutes; oaRoutes: OARoutes;
publiclyFunded: boolean; publiclyFunded: boolean;
// // percentage is for trust // // percentage is for trust
// relatedResearchResults: RelationResult[]; // relatedResearchResults: RelationResult[];
// // percentage is for similarity // // percentage is for similarity
@ -159,22 +184,35 @@ export class ResultLandingInfo {
relatedClassFilters: Set<string> = new Set(); relatedClassFilters: Set<string> = new Set();
contexts: Context[]; contexts: Context[];
deletedByInferenceIds: string[]; deletedByInferenceIds: string[];
// PUBLICATION, DATASET, ORP // PUBLICATION, DATASET, ORP
references: Reference[]; references: Reference[];
// PUBLICATION // PUBLICATION
bioentities: Map<string, Map<string, string>>; //<site name, <>> bioentities: Map<string, Map<string, string>>; //<site name, <>>
organizations: Organization[]; organizations: Organization[];
openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[]; openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[];
// DATASET // DATASET
subtitle: string; subtitle: string;
// SOFTWARE // SOFTWARE
programmingLanguages: string[]; programmingLanguages: string[];
measure: Measure; measure: Measure;
belongsTo: boolean = true;
message: string;
setBelongsTo(typeId: string, id: string) {
this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.result.message : null;
if (this.message) {
this.message = this.message.replace('((result))', StringUtils.getEntityName(this.resultType));
this.message = this.message.replace('((type_id))', typeId);
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -43,6 +43,7 @@ export interface Project {
title: string; title: string;
funderShortname: string; funderShortname: string;
funderName: string; funderName: string;
funderJurisdiction?: string
funding?: string; funding?: string;
code: string; code: string;
validated?: boolean; validated?: boolean;