Compare commits

...

26 Commits

Author SHA1 Message Date
Konstantina Galouni 5335e9a247 Merge remote-tracking branch 'origin/develop' into new-search-json 2024-11-25 17:33:25 +02:00
argirok 503ab40616 [develop | DONE | CHANGED ] update material icons link 2024-11-05 15:04:04 +02:00
argirok b044383f33 [develop | DONE | CHANGED ] update catalogue services Ids 2024-11-04 13:51:42 +02:00
argirok 44452ac9ee [develop | DONE | CHANGED ] disable links in plugin form. Add a tooltip when disabled 2024-11-04 13:20:17 +02:00
argirok b74dd06c8e Merge remote-tracking branch 'origin/develop' into develop 2024-11-04 13:12:19 +02:00
argirok 54624cd5dd [develop | CHANGED | DONE] Plugins: add pluginUrl Component, replace code in plugin-card, plugin-graph-info, plugin search/link/deposit 2024-11-04 13:12:10 +02:00
argirok 8083e7a531 [develop | DONE | ADDED ] ADD clear cache component in plugins for admins 2024-11-04 10:46:46 +02:00
argirok 236522145c Merge remote-tracking branch 'origin/develop' into develop 2024-11-04 10:04:32 +02:00
argirok e5ff78224e [develop | DONE | FIXED ] fix initialization from template for PluginCardInfo / ParagraphInfo 2024-11-04 10:04:20 +02:00
argirok 4d670e416d [develop | FIXED | DONE] in display claims - fix project title for unidentified 2024-11-01 12:28:31 +02:00
Konstantina Galouni 387692c03a [new-search-json | DONE | CHANGED]: searchFields.base.ts: Removed from facets and advanced filters fields "projectkeywords", "datasourceodcontenttypes", "datasourceodsubjects". 2024-10-30 13:45:43 +02:00
Konstantina Galouni c697f4b27d Merge develop branch into new-search-json 2024-10-29 16:25:17 +02:00
Konstantina Galouni 83f547aca5 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema - parsingFunctions.class.ts & deletedByInference.component.ts: Parse header.recordType field instead of result.resulttype. 2024-10-29 15:18:48 +02:00
Konstantina Galouni 01ccbb9d68 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProviderInfo.ts: Updated field "contentpolicy: string;" to "contentpolicies: string[];".
2. dataProvider.service.ts: Parse contentPolicies field as array.
3. dataProvider.component.html: Display contentpolicies array.
4. searchResearchResults.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype.
5. resultLanding.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype | Parse header.status (not yet available field) for under curation records | [BUG] Parse field externalReference instead of externalreference.
6. searchOrganizations.service.ts: [BUG] Get "pid" field from correct path.
7. parsingFunctions.class.ts: [BUG] Fix parsing of measures - unit is an array.
2024-10-29 14:08:54 +02:00
argirok 61c60eff60 [develop | ADDED| CHANGED ] add test search API, add local widget url 2024-10-29 13:19:26 +02:00
argirok 6a4ffbe875 [new-search-json | CHANGED | DONE ] fix claims date, update check if claim is pending or available 2024-10-29 10:05:58 +02:00
argirok 25bae3caeb [develop | CHANGED | DONE] add in properties new claims api with new json parse 2024-10-25 18:01:07 +03:00
Konstantina Galouni 6b0c581920 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. open-aire-jsonld-converter.service.ts: On method "getLicense()", added statically schema: "dnet:access_modes" for bestaccessright.
2. searchResearchResults.service.ts: [BUG] Removed "/" after search service url (duplicate /) | Updated parsing of "measures" field | Updated parsing of "pid" field | Added parsing of orcid_pending.
3. searchProjects.service.ts: Updated parsing of "measures" field.
4. searchOrganizations.service.ts: Updated parsing of project links (relations).
5. searchDataproviders.service.ts: Updated parsing of "measures" field.
6. resultLanding.service.ts: Added parsing of orcid_pending | Added parsing of "externalreference" field and updated method "parseBioentitiesAndSoftware()" | Updated parsing of "measures" field | Added parsing of resultService links (relation).
7. project.service.ts: Updated parsing of "measures" field.
8. dataProvider.service.ts: Updated parsing of "measures" field | Updated parsing of "contentpolicies" field.
9. parsingFunctions.class.ts: Use identifierTypes array with ids/codes | Updated parsing of "accessRight" field | Updated parsing in method "parseDatasources()" | Updated parsing of "pid" field in method "parseIdentifiers()" | Updated parsing of "measures" field in method "parseMeasures()".
2024-10-23 18:57:15 +03:00
Konstantina Galouni 945a8b1c90 [new-search-json | WIP | CHANGED]: open-aire-jsonld-converter.service.ts: Updated parsing according to new json schema. 2024-10-22 13:20:10 +03:00
Konstantina Galouni a8e2a509d5 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProvider.service.ts: Parse jurisdiction (label instead of classname) according to new schema.
2. organization/deletedByInference/deletedByInference.service.ts & result/deletedByInference/deletedByInference.service.ts: Not used - added @deprecated annotation to methods "getDeletedByInferenceResults()" and "parseDeletedByInferenceResults()".
3. project.service.ts: Added @deprecated annotation to method "getHTMLInfo()".
4. result/deletedByInference/deletedByInference.component.ts: Updated parsing of versions (previously children, now links with relations "merges") according to new json schema.
5. resultLanding.component.html: In <deletedByInference> updated parameter [id]="resultLandingInfo.record['header']['id']".
6. resultLanding.service.ts: Exclude relation "merges" from the related research.
7. organization.service.ts: Updated parsing according to new json schema for methods "getOrganizationNameAndUrlById()" and "parseOrganizationNameAndUrl()".
8. searchDataproviders.service.ts: Updated parsing of "eosctype" field and added TODO comment to check if parsing is correct.
9. searchOrganizations.service.ts: Added @deprecated annotation to method "parseResultsForDeposit()".
10. searchProjects.service.ts: Removed a console.log.
11. entitiesAutoComplete.component.ts: Commented @Input() public depositType:string and everything related to it.
12. entitySearch.service.ts: Added @deprecated annotation to method "searchByDepositType()" | Updated parsing according to new json schema for methods "searchByType()", "fetchByType()", "parse()".
2024-10-21 15:30:44 +03:00
Konstantina Galouni ccdf2f16dc Merge remote-tracking branch 'origin/develop' into new-search-json 2024-10-17 14:56:41 +03:00
Konstantina Galouni 7f7d0f859b [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProvider.component.ts: [BUG] Added check if provenanceUrls exist.
2. dataProvider.service.ts: Updated parsing of datasource by id according to new json schema.
3. entity-metadata.component.ts: [BUG] Updated checks to show label for openAccessMandatePublications and openAccessMandateDatasets.
4. parsingFunctions.class.ts: Updated parsing methods according to the new json schema.
5. project.component.ts: [BUG] Html downloaded file headers consistency issue.
6. project.service.ts: Updated parsing of project by id according to new json schema.
7. resultLanding.service.ts: Updated parsing of result by id according to new json schema.
8. organization.service.ts & searchDataproviders.service.ts & searchOrganizations.service.ts & searchProjects.service.ts: Updated parsing checks for consistency.
9. searchResearchResults.service.ts: Updated parsing methods according to the new json schema.
2024-10-17 13:14:52 +03:00
argirok f675fba83b [new-search-json | WIP ] continue parsing research results, start parsing result landing 2024-10-09 09:54:41 +03:00
argirok 187444bb09 [new-search-json | WIP ] continue parsing research results 2024-10-08 15:28:30 +03:00
argirok 89dcbb7c8f [new-search-json| WIP ] start parsing for search research results 2024-10-08 12:04:33 +03:00
Konstantina Galouni 82e8551129 [new-search-json | WIP | CHANGED]: Updated parsing of organizations, projects (landing & search) and search data sources according to new JSON response schema. 2024-10-07 16:20:12 +03:00
44 changed files with 1846 additions and 1901 deletions

View File

@ -102,7 +102,7 @@
</div> </div>
<div> <div>
<span class="uk-text-meta">Claimed date:</span> <span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span> <span class="uk-margin-xsmall-left">{{claim.date | date :'MMM d, y h:mm:ss a'}}</span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -373,7 +373,9 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
if (claimDateStr < lastUpdateDateStr) { if (claimDateStr < lastUpdateDateStr) {
return true; return true;
} else { } else {
return claim.target.collectedFrom != "infrastruct_::openaire"; //TODO uncomment when direct index API supports json
// return claim.target.collectedFrom != "infrastruct_::openaire";
return false;
} }
} }

View File

@ -7,21 +7,19 @@ import {properties} from "../../../../../environments/environment";
@Component({ @Component({
selector: 'project-title', selector: 'project-title',
template: ` template: `
<ng-container>
<h6 class="uk-margin-remove multi-line-ellipsis lines-2"> <h6 class="uk-margin-remove multi-line-ellipsis lines-2">
<p class="uk-margin-remove"> <p class="uk-margin-remove">
<a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'"> <a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'">
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span> <span *ngIf="project['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}}</span> <span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}}</span>
</a> </a>
<a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'"> <a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'">
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span> <span *ngIf="project['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}} </span> <span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}} </span>
</a> </a>
</p> </p>
</h6> </h6>
</ng-container> <span *ngIf="project['funderName'] && project['name'] != 'unidentified'" class="uk-margin-small-top">
<span *ngIf="project['funderName'] && project['code'] != 'unidentified'" class="uk-margin-small-top">
<span class="uk-text-meta">Funder: </span>{{project['funderName']}} <span class="uk-text-meta">Funder: </span>{{project['funderName']}}
</span> </span>
` `
@ -40,5 +38,6 @@ export class ProjectTitleFormatter {
ngOnInit() { ngOnInit() {
this.url = this.searchLink + "?projectId=" + this.project["openaireId"]; this.url = this.searchLink + "?projectId=" + this.project["openaireId"];
console.log(this.project)
} }
} }

View File

@ -67,7 +67,7 @@ import {PluginCardInfo} from "./plugin-card-info.component";
<hr class="uk-margin-left"> <hr class="uk-margin-left">
<div class="uk-margin-top" title="Use material icons to update the card icon"> <div class="uk-margin-top" title="Use material icons to update the card icon">
<div class="uk-width-1-1 uk-text-right"> <div class="uk-width-1-1 uk-text-right">
<a href="https://fonts.google.com/icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a> <a href="https://fonts.google.com/icons?icon.set=Material+Icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a>
</div> </div>
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].icon" <plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].icon"
type="text" field="icon" placeholder="Material icon" type="text" field="icon" placeholder="Material icon"

View File

@ -18,11 +18,14 @@
<div class="uk-text-center uk-margin-bottom description"> <div class="uk-text-center uk-margin-bottom description">
{{card.description}} {{card.description}}
</div> </div>
<a *ngFor="let url of card.urlsArray" [href]="card.url" [class.uk-hidden]="!(url.url && url.url.length > 0)" <ng-container *ngFor="let url of card.urlsArray">
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" <plugin-url [url]="url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"></plugin-url>
[target]="url.target" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin> </ng-container>
<!--<a *ngFor="let url of card.urlsArray" [route]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"
[class.uk-hidden]="!(url.url && url.url.length > 0)" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin>
{{url.linkText}} {{url.linkText}}
</a> </a>-->
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>

View File

@ -9,10 +9,11 @@ import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginCardInfoComponent} from "./plugin-card-info.component"; import {PluginCardInfoComponent} from "./plugin-card-info.component";
import {PluginUrlComponent} from "../../utils/pluginUrl.component";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, PluginUrlComponent
], ],
providers:[PluginsService], providers:[PluginsService],
declarations: [PluginCardInfoComponent], declarations: [PluginCardInfoComponent],

View File

@ -4,7 +4,7 @@ import {HttpClient} from "@angular/common/http";
export class PluginOpenAIREProducts extends PluginBaseInfo{ export class PluginOpenAIREProducts extends PluginBaseInfo{
title:string ="OpenAIRE services for your community"; title:string ="OpenAIRE services for your community";
serviceIdsArray = ["argos","zenodo","amnesia"]; serviceIdsArray = ["openaire.argos","cern.zenodo","athenarc.amnesia"];
compare(oldObject): any { compare(oldObject): any {
return super.compare(oldObject); return super.compare(oldObject);
} }

View File

@ -38,17 +38,13 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent<PluginOpenAIREProducts>{ export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent<PluginOpenAIREProducts>{
default = new PluginOpenAIREProducts(); default = new PluginOpenAIREProducts();
services = []; services = [];
excludedServiceIds = ["openaire_login","research_community_dashboard"] excludedServiceIds = ["openaire.aai","openaire.connect"]
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name"; api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
showErrorMessage = false; showErrorMessage = false;
constructor(http:HttpClient) { constructor(http:HttpClient) {
super() super()
this.subscriptions.push(http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{ this.subscriptions.push(http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> { this.services = res["results"].filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
x.id = x.id.split("openaire.")[1]
return x;
});
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
}, error => { }, error => {
this.showErrorMessage = true; this.showErrorMessage = true;
})) }))

View File

@ -23,10 +23,8 @@
<div [innerHTML]="pluginObject.paragraph2"></div> <div [innerHTML]="pluginObject.paragraph2"></div>
<div class="uk-margin-top"> <div class="uk-margin-top">
<a [href]="pluginObject.url.url" [target]="pluginObject.url.target" <plugin-url [url]="pluginObject.url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"></plugin-url>
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
{{pluginObject.url.linkText}}
</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -6,10 +6,11 @@ import {PluginsService} from "../../../../services/plugins.service";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {InputModule} from "../../../../sharedComponents/input/input.module"; import {InputModule} from "../../../../sharedComponents/input/input.module";
import {PluginGraphInfoComponent} from "./plugin-graph-info.component"; import {PluginGraphInfoComponent} from "./plugin-graph-info.component";
import {PluginUrlComponent} from "../../utils/pluginUrl.component";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, FormsModule, PluginFieldEditModule, InputModule CommonModule, RouterModule, FormsModule, PluginFieldEditModule, InputModule, PluginUrlComponent
], ],
providers: [ providers: [
PluginsService PluginsService

View File

@ -16,10 +16,9 @@
{{card.title}} {{card.title}}
</div> </div>
<div class="uk-text-small">{{card.description}}</div> <div class="uk-text-small">{{card.description}}</div>
<a *ngFor="let url of card.urlsArray" [route]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target" <ng-container *ngFor="let url of card.urlsArray">
[class.uk-hidden]="!(url.url && url.url.length > 0)" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin> <plugin-url [url]="url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"></plugin-url>
{{url.linkText}} </ng-container>
</a>
</slider-nav-item> </slider-nav-item>
</ng-container> </ng-container>
</slider-column> </slider-column>

View File

@ -10,11 +10,12 @@ import {SearchResearchResultsServiceModule} from "../../../../services/searchRes
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginSearchDepositLinkComponent} from './plugin-search-deposit-link.component'; import {PluginSearchDepositLinkComponent} from './plugin-search-deposit-link.component';
import {SliderUtilsModule} from "../../../../sharedComponents/slider-utils/slider-utils.module"; import {SliderUtilsModule} from "../../../../sharedComponents/slider-utils/slider-utils.module";
import {PluginUrlComponent} from "../../utils/pluginUrl.component";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule,
PluginFieldEditModule, SliderUtilsModule PluginFieldEditModule, SliderUtilsModule, PluginUrlComponent
], ],
providers:[PluginsService], providers:[PluginsService],
declarations: [PluginSearchDepositLinkComponent], declarations: [PluginSearchDepositLinkComponent],

View File

@ -96,7 +96,7 @@
<plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate" <plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate"
[plugin]="this.templateForm.getRawValue()" [plugin]="this.templateForm.getRawValue()"
[pluginObject]="this.selectedPlugin.object" [pluginObject]="this.selectedPlugin.object"
class="uk-width-1-1"></plugin-wrapper> class="uk-width-1-1" [previewInAdmin]="true"></plugin-wrapper>
</div> </div>
</div> </div>
</div> </div>

View File

@ -118,7 +118,7 @@ export class PluginsFormComponent implements OnInit {
}else{ }else{
this.selectedPlugin = new Plugin(this.page._id,this.selectedCommunityPid, template); this.selectedPlugin = new Plugin(this.page._id,this.selectedCommunityPid, template);
// this.selectedPlugin.order = this.pluginsByPlacement.get(this.selectedPlacementView).length; // this.selectedPlugin.order = this.pluginsByPlacement.get(this.selectedPlacementView).length;
this.selectedPlugin.object = PluginUtils.initializeObjectAndCompare(template.code,null); this.selectedPlugin.object = PluginUtils.initializeObjectAndCompare(template.code,this.selectedPlugin.object);
this.edit(this.selectedPlugin, this.selectedTemplate); this.edit(this.selectedPlugin, this.selectedTemplate);
} }

View File

@ -68,6 +68,7 @@
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No plugins found</div> <div>No plugins found</div>
</div> </div>
<clear-cache *ngIf="clearCacheRequests && showClearCache()" [requests]="clearCacheRequests"></clear-cache>
<ng-container *ngFor="let placement of pluginUtils.placementsOptions"> <ng-container *ngFor="let placement of pluginUtils.placementsOptions">
<ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'"> <ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'">

View File

@ -1,7 +1,7 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {HelpContentService} from "../../services/help-content.service"; import {HelpContentService} from "../../services/help-content.service";
import {FormArray, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn} from "@angular/forms"; import {UntypedFormBuilder, ValidatorFn} from "@angular/forms";
import {Page} from "../../utils/entities/adminTool/page"; import {Page} from "../../utils/entities/adminTool/page";
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperFunctions} from "../../utils/HelperFunctions.class";
@ -21,6 +21,8 @@ import {PluginUtils} from "./utils/pluginUtils";
import {CommunityService} from "../../connect/community/community.service"; import {CommunityService} from "../../connect/community/community.service";
import {CommunityInfo} from "../../connect/community/communityInfo"; import {CommunityInfo} from "../../connect/community/communityInfo";
import {AlertModal} from "../../utils/modal/alert"; import {AlertModal} from "../../utils/modal/alert";
import {Session} from "../../login/utils/helper.class";
import {UserManagementService} from "../../services/user-management.service";
@Component({ @Component({
selector: 'plugins', selector: 'plugins',
@ -62,12 +64,13 @@ export class PluginsComponent implements OnInit {
// editSubmenuOpen = false; // editSubmenuOpen = false;
filterActive = false; filterActive = false;
@ViewChild('deleteModal') deleteModal: AlertModal; @ViewChild('deleteModal') deleteModal: AlertModal;
clearCacheRequests = [];
user;
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
private communityService: CommunityService, private communityService: CommunityService,
private title: Title, private _helpContentService: HelpContentService, private title: Title, private _helpContentService: HelpContentService,
private _pluginsService: PluginsService, private _fb: UntypedFormBuilder, private _pluginsService: PluginsService, private _fb: UntypedFormBuilder,
private _clearCacheService: ClearCacheService) { private _clearCacheService: ClearCacheService, private _userManagementService:UserManagementService) {
} }
ngOnInit() { ngOnInit() {
@ -76,11 +79,24 @@ export class PluginsComponent implements OnInit {
community => { community => {
this.communityInfo = community; this.communityInfo = community;
})); }));
this.subscriptions.push(this._userManagementService.getUserInfo().subscribe( user =>{
this.user = user;
}))
this.subscriptions.push(this.route.params.subscribe(params => { this.subscriptions.push(this.route.params.subscribe(params => {
this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
this.selectedCommunityPid = params.community; this.selectedCommunityPid = params.community;
//initiate requests for clear cache prompt
this.clearCacheRequests = [];
if (properties.deleteBrowserCacheUrl) {
this.clearCacheRequests.push(properties.deleteBrowserCacheUrl + "/" + this.selectedCommunityPid)
}
if (this.properties.deleteCacheUrl) {
this.clearCacheRequests.push(properties.deleteCacheUrl + "?url=" + encodeURIComponent(properties.utilsService +
"/portals/countResults?field=communityId&value=" + encodeURIComponent(this.selectedCommunityPid)));
}
console.log(this.clearCacheRequests)
this.subscriptions.push(this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
HelperFunctions.scroll(); HelperFunctions.scroll();
this.selectedPageId = params['pageId']; this.selectedPageId = params['pageId'];
@ -370,4 +386,8 @@ export class PluginsComponent implements OnInit {
)); ));
this.showLoading = false; this.showLoading = false;
} }
showClearCache(){
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user));
}
} }

View File

@ -27,6 +27,7 @@ import {PluginWrapperModule} from "./wrapper/plugin-wrapper.module";
import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module"; import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module";
import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module"; import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module";
import {TransitionGroupModule} from "../../utils/transition-group/transition-group.module"; import {TransitionGroupModule} from "../../utils/transition-group/transition-group.module";
import {ClearCacheComponent} from "../sharedComponents/clearCache.component";
@NgModule({ @NgModule({
@ -34,7 +35,7 @@ import {TransitionGroupModule} from "../../utils/transition-group/transition-gro
CommonModule, RouterModule, FormsModule, CommonModule, RouterModule, FormsModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule, MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule,
MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule, TransitionGroupModule MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule, TransitionGroupModule, ClearCacheComponent
], ],
providers:[PluginsService], providers:[PluginsService],
declarations: [PluginsComponent], declarations: [PluginsComponent],

View File

@ -0,0 +1,36 @@
import {Component, Input} from '@angular/core';
import {PluginURL} from "./base-plugin.component";
import {CommonModule} from "@angular/common";
import {RouterModule} from "@angular/router";
@Component({
imports:[CommonModule, RouterModule],
selector: 'plugin-url',
template: `
<span title="{{previewInAdmin?'Note: links are disabled in administration dashboard':''}}">
<a *ngIf="url.route"
[class]="classAttribute"
[routerLink]="url.url" [class.uk-disabled]=previewInAdmin>
{{url.linkText}}
</a>
<a *ngIf="!url.route" [href]="url.url" [class.uk-hidden]="!(url.url && url.url.length > 0)"
[class]="classAttribute"
[target]="url.target" [class.uk-disabled]=previewInAdmin>
{{url.linkText}}
</a>
</span>
`,
standalone :true
})
export class PluginUrlComponent {
@Input() url:PluginURL;
@Input() previewInAdmin:boolean;
@Input() classAttribute;
htmlEditorView = false;
}

View File

@ -0,0 +1,47 @@
import {Component, Input, ViewChild} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {AlertModal} from "../../utils/modal/alert";
import {AlertModalModule} from "../../utils/modal/alertModal.module";
import {CommonModule} from "@angular/common";
@Component({
standalone: true,
selector: 'clear-cache',
imports: [AlertModalModule, CommonModule],
template: `
<ng-container *ngIf="requests && requests.length > 0">
<div class="uk-alert uk-padding-xsmall uk-text-small uk-text-center">
Made changes but can't see them?
<a (click)="promtToClear()">Try to clear the cache</a> to resolve the issue.
</div>
<modal-alert #deleteCacheModal [overflowBody]="false" (alertOutput)="clear()"
classTitle="uk-background-primary uk-light"></modal-alert>
</ng-container>
`,
})
export class ClearCacheComponent {
@Input() requests:string[] ;
@ViewChild('deleteCacheModal') deleteCacheModal: AlertModal;
constructor(private http: HttpClient ) {
}
promtToClear(){
this.deleteCacheModal.alertTitle = 'Confirm Cache Clear';
this.deleteCacheModal.message = 'Are you sure you want to clear the service cache?';
this.deleteCacheModal.okButtonText = 'Yes';
this.deleteCacheModal.open();
}
clear(){
for( let request of this.requests){
this.http.get(request).subscribe( res => {
console.log( res);
});
}
}
}

View File

@ -617,9 +617,9 @@
{{dataProviderInfo.jurisdiction}} {{dataProviderInfo.jurisdiction}}
</div> </div>
<div *ngIf="dataProviderInfo.contentpolicy" class="uk-margin-medium-bottom"> <div *ngIf="dataProviderInfo.contentpolicies?.length > 0" class="uk-margin-medium-bottom">
<div class="uk-text-meta uk-margin-small-bottom">Content policy</div> <div class="uk-text-meta uk-margin-small-bottom">Content policy</div>
{{dataProviderInfo.contentpolicy}} {{dataProviderInfo.contentpolicies.join(", ")}}
</div> </div>
</ng-container> </ng-container>

View File

@ -921,7 +921,7 @@ export class DataProviderComponent {
} }
public getProvenanceUrls() { public getProvenanceUrls() {
this.provenanceUrls = Array.from(this.dataProviderInfo.provenance.values()).map(res => res['url']).reduce((acc, val) => acc.concat(val), []); this.provenanceUrls = this.dataProviderInfo.provenance ? Array.from(this.dataProviderInfo.provenance.values()).map(res => res['url']).reduce((acc, val) => acc.concat(val), []) : [];
} }
public getTypeName(): string { public getTypeName(): string {

View File

@ -47,17 +47,6 @@ export class DataProviderService {
return res; return res;
} }
})) }))
.pipe(map(res => [res['result']['metadata']['oaf:entity'], res]))
.pipe(map(res => [
res[0]['oaf:datasource'], // 0
res[0]['oaf:datasource']['datasourcetype'], // 1
res[0]['oaf:datasource']['openairecompatibility'], // 2
res[0]['oaf:datasource']['collectedfrom'], // 3
res[0]['oaf:datasource']['accessinfopackage'], // 4
res[0]['oaf:datasource']['rels']['rel'], // 5
res[0]['oaf:datasource']['journal'], // 6
res[1] // 7
]))
.pipe(map(res => this.parseDataProviderInfo(res))); .pipe(map(res => this.parseDataProviderInfo(res)));
} }
@ -136,24 +125,33 @@ export class DataProviderService {
} }
parseDataProviderInfo (data: any):any { parseDataProviderInfo (data: any):any {
this.dataProviderInfo = new DataProviderInfo(); if(data == null) {
return null;
this.dataProviderInfo.record = data[7];
this.dataProviderInfo.objIdentifier = data[7]["result"]["header"]["dri:objIdentifier"];
this.dataProviderInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.dataProviderInfo.record, "datasource");
if(data[0] != null) {
this.dataProviderInfo.title = {"name": "", "url": data[0].websiteurl};
if(data[0].officialname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(data[0].officialname));
this.dataProviderInfo.officialName = StringUtils.HTMLToString(String(data[0].officialname));
} }
if(data[0].englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(data[0].englishname)); this.dataProviderInfo = new DataProviderInfo();
this.dataProviderInfo.record = data;
if(data["header"]) {
this.dataProviderInfo.objIdentifier = data["header"]["id"];
// TODO: type for canonnical should be datasource or service???
this.dataProviderInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.dataProviderInfo.record, "datasource");
}
if(data["datasource"]) {
let datasource = data["datasource"];
this.dataProviderInfo.title = {"name": "", "url": datasource.websiteurl};
if(datasource.officialname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(datasource.officialname));
this.dataProviderInfo.officialName = StringUtils.HTMLToString(String(datasource.officialname));
}
if(datasource.englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(datasource.englishname));
} }
var pattern = /.{12}::.+/; var pattern = /.{12}::.+/;
var originalIds =(data[0].originalId)?data[0].originalId:""; var originalIds =(datasource.originalId)?datasource.originalId:"";
if(originalIds) { if(originalIds) {
let provenances = new DataproviderProvenance().provenance; let provenances = new DataproviderProvenance().provenance;
this.dataProviderInfo.provenance = new Map<string, { "url": string[], "name" }>(); this.dataProviderInfo.provenance = new Map<string, { "url": string[], "name" }>();
@ -167,12 +165,6 @@ export class DataProviderService {
var matched = originalId.match(pattern); var matched = originalId.match(pattern);
if (matched && originalId && originalId != "") { if (matched && originalId && originalId != "") {
// if (originalId.indexOf("opendoar____::") != -1) {
// this.dataProviderInfo.openDoarId = originalId.split("opendoar____::")[1];
// } else if (originalId.indexOf("re3data_____::") != -1) {
// this.dataProviderInfo.r3DataId = originalId.split("re3data_____::")[1];
// }
let prefix = originalId.substr(0, 14); let prefix = originalId.substr(0, 14);
if(provenances.has(prefix)) { if(provenances.has(prefix)) {
let provenance = provenances.get(prefix); let provenance = provenances.get(prefix);
@ -181,12 +173,6 @@ export class DataProviderService {
} else { } else {
this.dataProviderInfo.provenance.set(provenance.name, {"url": [provenance.urlPrefix + idRegex.exec(originalId)[0]]}) this.dataProviderInfo.provenance.set(provenance.name, {"url": [provenance.urlPrefix + idRegex.exec(originalId)[0]]})
} }
// var replace = "/[^"+"::"+"]*$/";
// var re = new RegExp(replace,"g");
//
// console.log(re.exec(originalId)[0]);
} }
this.dataProviderInfo.originalId = originalId; this.dataProviderInfo.originalId = originalId;
} }
@ -194,162 +180,174 @@ export class DataProviderService {
} }
this.dataProviderInfo.subjects = []; this.dataProviderInfo.subjects = [];
if(data[0].subjects) { if(datasource.subjects) {
let length = Array.isArray(data[0]['subjects']) ? data[0]['subjects'].length : 1; let length = Array.isArray(datasource['subjects']) ? datasource['subjects'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let subject = Array.isArray(data[0]['subjects']) ? data[0]['subjects'][i] : data[0]['subjects']; let subject = Array.isArray(datasource['subjects']) ? datasource['subjects'][i] : datasource['subjects'];
if (subject && subject.content) { if (subject && subject.content) {
this.dataProviderInfo.subjects.push(subject.content); this.dataProviderInfo.subjects.push(subject.content);
} }
} }
} }
// if(!Array.isArray(data[0]['description'])) { this.dataProviderInfo.description = this.parsingFunctions.parseDescription(datasource && datasource.description?datasource.description:[]);
// this.dataProviderInfo.description = (data[0]['description']) ? String(data[0]['description']) : "";
// } else {
// this.dataProviderInfo.description = (data[0]['description'][0]) ? String(data[0]['description'][0]) : "";
// }
this.dataProviderInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description?data[0].description:[]);
this.dataProviderInfo.thematic = data[0].thematic; this.dataProviderInfo.thematic = datasource.thematic;
if(data[0].jurisdiction != null) { if(datasource.jurisdiction) {
this.dataProviderInfo.jurisdiction = data[0].jurisdiction.classname; this.dataProviderInfo.jurisdiction = datasource.jurisdiction.label;
} }
if(data[0].contentpolicy != null) { if(datasource.contentpolicies) {
this.dataProviderInfo.contentpolicy = data[0].contentpolicy.classname; this.dataProviderInfo.contentpolicies = [];
datasource.contentpolicies.forEach(contentpolicy => {
if(contentpolicy.label) {
this.dataProviderInfo.contentpolicies.push(contentpolicy.label);
}
})
} }
if(data[0].pid != null) { if(datasource['datasourcetype']) {
this.dataProviderInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[0].pid); let datasourcetype = datasource['datasourcetype'];
} this.dataProviderInfo.type = datasourcetype.label;
}
if(data[1] != null) { if(datasourcetype.code == "entityregistry" || datasourcetype.code == "entityregistry::projects" || datasourcetype.code == "entityregistry::repositories") {
this.dataProviderInfo.type = data[1].classname;
if(data[1].classid == "entityregistry" || data[1].classid == "entityregistry::projects" || data[1].classid == "entityregistry::repositories") {
this.dataProviderInfo.registry = true; this.dataProviderInfo.registry = true;
} else { } else {
this.dataProviderInfo.registry = false; this.dataProviderInfo.registry = false;
} }
if(this.dataProviderInfo.tabs == undefined) { // if(this.dataProviderInfo.tabs == undefined) {
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>(); // this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
} // }
this.dataProviderInfo.tabs = []; // this.dataProviderInfo.tabs = [];
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) { // if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"}); // this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS); // this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS);
} // }
if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) { // if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"}); // this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASETS); // this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASETS);
} // }
//
// if(this.dataProviderInfo.tabsInTypes.projectsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PROJECTS, "content": "projectsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.PROJECTS);
// }
// if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASOURCES, "content": "datasourcesTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASOURCES);
// }
//
// if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Related "+OpenaireEntities.DATASOURCES, "content": "relatedDatasourcesTab"});
// this.dataProviderInfo.tabs2.push("Related "+OpenaireEntities.DATASOURCES);
// }
//
// if(this.dataProviderInfo.tabsInTypes.statisticsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Statistics", "content": "statisticsTab"});
// this.dataProviderInfo.tabs2.push("Statistics");
// }
//
// if(this.dataProviderInfo.tabsInTypes.softwareTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.SOFTWARE, "content": "softwareTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.SOFTWARE);
// }
//
// if(this.dataProviderInfo.tabsInTypes.orpsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.OTHER, "content": "orpsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.OTHER);
// }
//
// if(this.dataProviderInfo.tabsInTypes.metricsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
// this.dataProviderInfo.tabs2.push("Metrics");
// }
if(this.dataProviderInfo.tabsInTypes.projectsTab.has(data[1].classid)) { if(this.dataProviderInfo.resultTypes.collectedFrom.has(datasourcetype.code)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PROJECTS, "content": "projectsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.PROJECTS);
}
if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASOURCES, "content": "datasourcesTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASOURCES);
}
if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Related "+OpenaireEntities.DATASOURCES, "content": "relatedDatasourcesTab"});
this.dataProviderInfo.tabs2.push("Related "+OpenaireEntities.DATASOURCES);
}
if(this.dataProviderInfo.tabsInTypes.statisticsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Statistics", "content": "statisticsTab"});
this.dataProviderInfo.tabs2.push("Statistics");
}
if(this.dataProviderInfo.tabsInTypes.softwareTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.SOFTWARE, "content": "softwareTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.SOFTWARE);
}
if(this.dataProviderInfo.tabsInTypes.orpsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.OTHER, "content": "orpsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.OTHER);
}
if(this.dataProviderInfo.tabsInTypes.metricsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
this.dataProviderInfo.tabs2.push("Metrics");
}
if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "collectedFrom"; this.dataProviderInfo.resultsBy = "collectedFrom";
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(data[1].classid)) { } else if(this.dataProviderInfo.resultTypes.hostedBy.has(datasourcetype.code)) {
this.dataProviderInfo.resultsBy = "hostedBy"; this.dataProviderInfo.resultsBy = "hostedBy";
} }
} }
if(!this.dataProviderInfo.registry) { if(!this.dataProviderInfo.registry) {
if(data[2] != null) { let compatibility = datasource['openairecompatibility'];
if(compatibility) {
this.dataProviderInfo.compatibility = {"info": "", "name": "", "id": ""}; this.dataProviderInfo.compatibility = {"info": "", "name": "", "id": ""};
this.dataProviderInfo.compatibility.info = data[2].classname; this.dataProviderInfo.compatibility.info = compatibility.label;
//this.dataProviderInfo.compatibility = data[2].classname;
} }
if(data[2] != null && data[2].classid == "hostedBy" && data[3] != null) { if(compatibility != null && compatibility.code == "hostedBy" && datasource['collectedfrom'] != null) {
this.dataProviderInfo.compatibility.name = data[3].name; this.dataProviderInfo.compatibility.name = datasource['collectedfrom'].dsName;
this.dataProviderInfo.compatibility.id = data[3].id; this.dataProviderInfo.compatibility.id = datasource['collectedfrom'].dsId;
if(this.dataProviderInfo.compatibility.name) { if(this.dataProviderInfo.compatibility.name) {
this.dataProviderInfo.compatibility.info = "Collected from "; this.dataProviderInfo.compatibility.info = "Collected from ";
} }
} }
if(data[4] != null) { if(datasource['accessinfopackage']) {
let oaiPmhURL:string; let oaiPmhURL:string;
oaiPmhURL = Array.isArray(data[4]) ? data[4][0]:data[4]; oaiPmhURL = Array.isArray(datasource['accessinfopackage']) ? datasource['accessinfopackage'][0]:datasource['accessinfopackage'];
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') { if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL; this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
} }
} }
} }
if(data[5] != null) { if(datasource['journal']) {
let mydata; let journal = datasource['journal'];
let counter = 0; this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
let countriesSet: Set<string>; this.dataProviderInfo.journal['journal'] = journal.name;
let length = data[5].length!=undefined ? data[5].length : 1; this.dataProviderInfo.journal['issn'] = journal['issnPrinted'];
this.dataProviderInfo.journal['lissn'] = journal['issnLinking'];
this.dataProviderInfo.journal['eissn'] = journal['issnOnline'];
for(let i=0; i<length; i++) { }else {
mydata = data[5].length!=undefined ? data[5][i] : data[5]; this.dataProviderInfo.journal = null;
if(mydata.hasOwnProperty("to")) { }
if(mydata['to'].class && mydata['to'].class.toLowerCase() == "isprovidedby" && mydata['to'].type == "organization") { }
//if(this.dataProviderInfo.organizations == undefined) {
if(data['pid']) {
this.dataProviderInfo.identifiers = this.parsingFunctions.parseIdentifiers(data.pid);
}
if(data['links']) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
let counter: number = 0;
let countriesSet: Set<string>;
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"] && relation["header"].relationClass && relation['header'].relationClass.toLowerCase() == "isprovidedby" && relation['header'].relatedRecordType == "organization") {
if (this.dataProviderInfo.organizations.length == 0) { if (this.dataProviderInfo.organizations.length == 0) {
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
this.dataProviderInfo.countries = new Array<string>(); this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>(); countriesSet = new Set<string>();
} }
this.dataProviderInfo.organizations[counter] = {"acronym": "", "name": "", "id": ""}; this.dataProviderInfo.organizations[counter] = {"acronym": "", "name": "", "id": ""};
//this.dataProviderInfo.organizations[counter]['name'] = (mydata.legalname ? mydata.legalname : "[no title available"); this.dataProviderInfo.organizations[counter]['id'] = relation['header'].relatedIdentifier;
this.dataProviderInfo.organizations[counter]['id'] = mydata['to'].content;
if(mydata.hasOwnProperty("legalshortname")) { if (relation["legalshortname"]) {
this.dataProviderInfo.organizations[counter]['acronym'] = mydata.legalshortname; this.dataProviderInfo.organizations[counter]['acronym'] = relation.legalshortname;
} }
if(mydata.hasOwnProperty("legalname")) { if (relation["legalname"]) {
this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname; this.dataProviderInfo.organizations[counter]['name'] = relation.legalname;
} }
if (!this.dataProviderInfo.organizations[counter]['acronym'] && !this.dataProviderInfo.organizations[counter]['name']) { if (!this.dataProviderInfo.organizations[counter]['acronym'] && !this.dataProviderInfo.organizations[counter]['name']) {
// acronym is displayed with link and name only in tooltip // acronym is displayed with link and name only in tooltip
this.dataProviderInfo.organizations[counter]['acronym'] = "[no title available]"; this.dataProviderInfo.organizations[counter]['acronym'] = "[no title available]";
} }
if(mydata.country != '' && mydata['country'].classname != '') { if (relation['header'].country && relation['header']['country'].label) {
if(!countriesSet.has(mydata['country'].classname)) { if (!countriesSet.has(relation['header']['country'].label)) {
this.dataProviderInfo.countries.push(mydata['country'].classname); this.dataProviderInfo.countries.push(relation['header']['country'].label);
countriesSet.add(mydata['country'].classname); countriesSet.add(relation['header']['country'].label);
} }
} }
@ -357,20 +355,9 @@ export class DataProviderService {
} }
} }
} }
}
if(data[6] != null) {
this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
this.dataProviderInfo.journal['journal'] = data[6].content;
this.dataProviderInfo.journal['issn'] = data[6]['issn'];
this.dataProviderInfo.journal['lissn'] = data[6]['lissn'];
this.dataProviderInfo.journal['eissn'] = data[6]['eissn'];
}else { if (data?.measure) {
this.dataProviderInfo.journal = null; this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data.measure);
// this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
}
if (data[0]?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
} }
return this.dataProviderInfo; return this.dataProviderInfo;

View File

@ -11,20 +11,20 @@ import {RouterHelper} from "../../utils/routerHelper.class";
<div class="uk-text-xsmall entity-metadata uk-flex-inline uk-flex-wrap uk-text-emphasis"> <div class="uk-text-xsmall entity-metadata uk-flex-inline uk-flex-wrap uk-text-emphasis">
<!-- oa --> <!-- oa -->
<span class="uk-flex-inline uk-flex-middle uk-flex-wrap" <span class="uk-flex-inline uk-flex-middle uk-flex-wrap"
*ngIf="(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)"> *ngIf="(openAccessMandatePublications && openAccessMandatePublications != 'false') || (openAccessMandateDatasets && openAccessMandateDatasets != 'false')">
<span class="uk-margin-xsmall-right open-access"> <span class="uk-margin-xsmall-right open-access">
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon> <icon name="open_access" [flex]="true" [ratio]="0.8"></icon>
</span> </span>
<span class="uk-text-bolder" <span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets"> *ngIf="openAccessMandatePublications != 'false' && openAccessMandateDatasets != 'false'">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}} Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
</span> </span>
<span class="uk-text-bolder" <span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)"> *ngIf="openAccessMandatePublications != 'false' && openAccessMandatePublications && (openAccessMandateDatasets == 'false' || !openAccessMandateDatasets)">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
</span> </span>
<span class="uk-text-bolder" <span class="uk-text-bolder"
*ngIf="openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)"> *ngIf="openAccessMandateDatasets != 'false' && openAccessMandateDatasets && (openAccessMandatePublications == 'false' || !openAccessMandatePublications)">
Open Access Mandate for {{openaireEntities.DATASETS}} Open Access Mandate for {{openaireEntities.DATASETS}}
</span> </span>
</span> </span>
@ -236,8 +236,8 @@ export class EntityMetadataComponent {
@Input() endYear: string; // search result @Input() endYear: string; // search result
@Input() currentDate: number; // project landing @Input() currentDate: number; // project landing
@Input() status: string; // project landing @Input() status: string; // project landing
@Input() openAccessMandatePublications: boolean // project landing @Input() openAccessMandatePublications: string; // project landing
@Input() openAccessMandateDatasets: boolean // project landing @Input() openAccessMandateDatasets: string; // project landing
@Input() date: Date; @Input() date: Date;
@Input() embargoEndDate: Date | string; @Input() embargoEndDate: Date | string;
@Input() underCuration: boolean = false; @Input() underCuration: boolean = false;

View File

@ -28,7 +28,10 @@ export class ParsingFunctions {
public open = 'open_access'; public open = 'open_access';
public closed = 'closed_access'; public closed = 'closed_access';
public unknown = 'unknown_access'; public unknown = 'unknown_access';
public identifierTypes = ["doi", "pmc" , "handle", "pmid", "re3data", "swhid", "ROR", "ISNI", "Wikidata", "FundRef", "RRID"];
//TODO what are the names of Identifiers types e.g doi = Digital Object Identifier
// public identifierTypes = ["Digital Object Identifier", "pmc", "Handle", "PubMed ID", "re3data", "swhid",
// "ROR", "International Standard Name Identifier", "Wikidata", "FundRef"];
private instanceWithDoiExists: boolean = false; private instanceWithDoiExists: boolean = false;
constructor() { constructor() {
@ -49,14 +52,14 @@ export class ParsingFunctions {
}; };
if (relation.title != 'unidentified') { if (relation.title != 'unidentified') {
fundedByProject['id'] = relation['to'].content; fundedByProject['id'] = relation['header'].relatedIdentifier;
fundedByProject['acronym'] = relation.acronym; fundedByProject['acronym'] = relation.acronym;
fundedByProject['title'] = relation.title; fundedByProject['title'] = relation.projectTitle;
fundedByProject['code'] = relation.code; fundedByProject['code'] = relation.code;
if (relation.validated && relation.validated.date) { if (relation.validationDate) {
fundedByProject['validated'] = true; fundedByProject['validated'] = true;
} }
fundedByProject['provenanceAction'] = relation.provenanceaction; fundedByProject['provenanceAction'] = relation.header.relationProvenance;
} else { } else {
fundedByProject['id'] = ""; fundedByProject['id'] = "";
fundedByProject['acronym'] = ""; fundedByProject['acronym'] = "";
@ -101,7 +104,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.funderJurisdiction = fundingData['funder'].jurisdiction?.code;
} }
funding.stream = this.addFundingLevel0(fundingData, funding.stream); funding.stream = this.addFundingLevel0(fundingData, funding.stream);
@ -114,9 +117,8 @@ export class ParsingFunctions {
} }
addFundingLevel0(parent: string, fundingStream: string): string { addFundingLevel0(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_0")) { if (parent.hasOwnProperty("level0") && parent['level0'].name) {
let level0 = parent['funding_level_0']; let level0 = parent['level0'];
fundingStream += (fundingStream) ? " ; " : ""; fundingStream += (fundingStream) ? " ; " : "";
fundingStream += level0.name; fundingStream += level0.name;
} }
@ -124,8 +126,8 @@ export class ParsingFunctions {
} }
addFundingLevel1(parent: string, fundingStream: string): string { addFundingLevel1(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_1")) { if (parent.hasOwnProperty("level1") && parent['level1'].name) {
let level1 = parent['funding_level_1']; let level1 = parent['level1'];
// For projects' parsing // For projects' parsing
if (level1.hasOwnProperty("parent")) { if (level1.hasOwnProperty("parent")) {
@ -139,8 +141,8 @@ export class ParsingFunctions {
} }
addFundingLevel2(parent: string, fundingStream: string): string { addFundingLevel2(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_2")) { if (parent.hasOwnProperty("level2") && parent['level2'].name) {
let level2 = parent['funding_level_2']; let level2 = parent['level2'];
// For projects' parsing // For projects' parsing
if (level2.hasOwnProperty("parent")) { if (level2.hasOwnProperty("parent")) {
@ -248,11 +250,11 @@ export class ParsingFunctions {
if (instance.hasOwnProperty("accessright")) { if (instance.hasOwnProperty("accessright")) {
if (url) { if (url) {
mapStructure.get(key)['accessMode'].push(instance['accessright'].classname); mapStructure.get(key)['accessMode'].push(instance['accessright'].label);
} }
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) { if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname; mapStructure.get(key)['bestAccessMode'] = instance['accessright'].label;
} }
} else if (url) { } else if (url) {
mapStructure.get(key)['accessMode'].push(""); mapStructure.get(key)['accessMode'].push("");
@ -283,8 +285,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1; let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby']; let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby'];
if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") { if (hostedBy.dsName && hostedBy.dsName != "other resources" && hostedBy.dsName != "Unknown Repository") {
downloadNames.add(String(hostedBy.name)); downloadNames.add(String(hostedBy.dsName));
} }
} }
available.downloadNames = Array.from(downloadNames); available.downloadNames = Array.from(downloadNames);
@ -298,8 +300,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1; let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom']; let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
if (collectedFrom.name && collectedFrom.id) { if (collectedFrom.dsName && collectedFrom.dsId) {
available.collectedNamesAndIds.set(String(collectedFrom.name), collectedFrom.id); available.collectedNamesAndIds.set(String(collectedFrom.dsName), collectedFrom.dsId);
} }
} }
} }
@ -309,8 +311,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1; let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype']; let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
if (instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") { if (instanceType && instanceType.toLowerCase() !== "unknown") {
types.add(instanceType.classname); types.add(instanceType);
} }
} }
available.types = Array.from(types); available.types = Array.from(types);
@ -338,9 +340,9 @@ export class ParsingFunctions {
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright']; let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
if (this.changeBestAccessMode(available.accessRight, accessRight)) { if (this.changeBestAccessMode(available.accessRight, accessRight)) {
available.accessRight = accessRight.classname; available.accessRight = accessRight.label;
if (this.changeBestAccessMode(globalAccessRight, accessRight)) { if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
globalAccessRight = accessRight.classname; globalAccessRight = accessRight.label;
} }
} }
} }
@ -369,7 +371,7 @@ export class ParsingFunctions {
available.fulltext = instance['fulltext']; available.fulltext = instance['fulltext'];
} }
if(instance.hasOwnProperty("refereed") && instance.refereed.classname == "peerReviewed") { if(instance.hasOwnProperty("refereed") && instance.refereed == "peerReviewed") {
available.peerReviewed = true; available.peerReviewed = true;
} }
@ -430,7 +432,7 @@ export class ParsingFunctions {
if (!accessMode) { if (!accessMode) {
return false; return false;
} }
accessMode = accessMode.classid; accessMode = accessMode.code;
switch (currentAccessMode) { switch (currentAccessMode) {
case null: case null:
@ -487,29 +489,29 @@ export class ParsingFunctions {
// researchResult.relationName = relation.to.class; // researchResult.relationName = relation.to.class;
if (relation['resulttype']) { if (relation['header'] && relation.header.recordType) {
if (relation['resulttype'].classname == "publication") { if (relation.header.recordType == "publication") {
researchResult['class'] = "publication"; researchResult['class'] = "publication";
} else if (relation['resulttype'].classname == "dataset") { } else if (relation.header.recordType == "dataset") {
researchResult['class'] = "dataset"; researchResult['class'] = "dataset";
} else if (relation['resulttype'].classname == "software") { } else if (relation.header.recordType == "software") {
researchResult['class'] = "software"; researchResult['class'] = "software";
} else if (relation['resulttype'].classname == "other") { } else if (relation.header.recordType == "other") {
researchResult['class'] = "other"; researchResult['class'] = "other";
} }
} }
researchResult['id'] = relation['to'].content; researchResult['id'] = relation['header'].relatedIdentifier ;
if (Array.isArray(relation['title'])) { //if (Array.isArray(relation['title'])) {
for (let i = 0; i < relation['title'].length; i++) { //for (let i = 0; i < relation['title'].length; i++) {
if (relation['title'][i] && relation['title'][i].content) { //if (relation['title'][i] && relation['title'][i]) {
if (!researchResult['name'] || relation['title'][i].classid == "main title") { //if (!researchResult['name'] || relation['title'][i].classid == "main title") {
researchResult['name'] = String(relation['title'][i].content); //researchResult['name'] = String(relation['title'][i].content);
} //}
} //}
} //}
} else { //} else {
researchResult['name'] = (relation['title'] && relation['title'].content) ? String(relation['title'].content) : ""; researchResult['name'] = (relation['title'] && relation['title']) ? String(relation['title']) : "";
} //}
if (!researchResult['name']) { if (!researchResult['name']) {
researchResult['name'] = "[no title available]"; researchResult['name'] = "[no title available]";
} }
@ -519,13 +521,14 @@ export class ParsingFunctions {
} }
//researchResult['date'] = relation.dateofacceptance.substring(0,4);; //researchResult['date'] = relation.dateofacceptance.substring(0,4);;
let percentageName: string; let percentageName: string;
if (relation.trust) { if (relation.header.trust) {
percentageName = "trust"; percentageName = "trust";
} else if (relation.similarity) { } else if (relation.similarity) {
percentageName = "similarity"; // TODO: not available
// percentageName = "similarity";
} }
if (percentageName) { if (percentageName) {
researchResult['percentage'] = Math.round(relation[percentageName] * 100); researchResult['percentage'] = Math.round(relation.header[percentageName] * 100);
researchResult['percentageName'] = percentageName; researchResult['percentageName'] = percentageName;
} }
researchResults.push(researchResult); researchResults.push(researchResult);
@ -545,7 +548,7 @@ export class ParsingFunctions {
openaireCompatibility: "" openaireCompatibility: ""
}; };
datasource['id'] = relation['to'].content; datasource['id'] = relation['header'].relatedIdentifier;
if(relation["officialname"]) if(relation["officialname"])
datasource.name = relation.officialname; datasource.name = relation.officialname;
else { else {
@ -553,10 +556,10 @@ export class ParsingFunctions {
} }
let percentageName: string; let percentageName: string;
if (relation.trust) { if (relation['header'].trust) {
percentageName = "trust"; percentageName = "trust";
} else if (relation.similarity) { // } else if (relation.similarity) {
percentageName = "similarity"; // percentageName = "similarity";
} }
if (percentageName) { if (percentageName) {
datasource['percentage'] = Math.round(relation[percentageName] * 100); datasource['percentage'] = Math.round(relation[percentageName] * 100);
@ -564,13 +567,13 @@ export class ParsingFunctions {
} }
// type // type
if(relation.hasOwnProperty('datasourcetype') && relation['datasourcetype'].hasOwnProperty("classname")) { if(relation['datasourcetype'] && relation['datasourcetype']["code"]) {
datasource.class = relation['datasourcetype'].classname; datasource.class = relation['datasourcetype'].code;
} }
// compatibility // compatibility
if(relation.hasOwnProperty("openairecompatibility")) { if(relation["openairecompatibility"]) {
datasource.openaireCompatibility = relation['openairecompatibility'].classname; datasource.openaireCompatibility = relation['openairecompatibility'].label;
} }
if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") { if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") {
@ -595,26 +598,20 @@ export class ParsingFunctions {
parseIdentifiers(pid: any): Map<string, string[]> { parseIdentifiers(pid: any): Map<string, string[]> {
let identifiers = new Map<string, string[]>(); let identifiers = new Map<string, string[]>();
if (pid.hasOwnProperty("classid") && pid['classid'] != "") { if (pid.hasOwnProperty("typeCode") && pid['typeCode'] != "") {
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data" if (this.identifierTypes.indexOf(pid.typeCode) !=-1) {
|| pid.classid == "swhid" if (!identifiers.has(pid.typeCode)) {
|| pid.classid == "ROR" || pid.classid == "ISNI" || pid.classid == "Wikidata" || pid.classid == "FundRef" identifiers.set(pid.typeCode, new Array<string>());
|| pid.classid == "RRID") {
if (!identifiers.has(pid.classid)) {
identifiers.set(pid.classid, new Array<string>());
} }
identifiers.get(pid.classid).push(pid.content + ""); identifiers.get(pid.typeCode).push(pid.value + "");
} }
} else { } else {
for (let i = 0; i < pid.length; i++) { for (let i = 0; i < pid.length; i++) {
if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data" if (this.identifierTypes.indexOf(pid[i].typeCode) !=-1) {
|| pid[i].classid == "swhid" if (!identifiers.has(pid[i].typeCode)) {
|| pid[i].classid == "ROR" || pid[i].classid == "ISNI" || pid[i].classid == "Wikidata" || pid[i].classid == "FundRef" identifiers.set(pid[i].typeCode, new Array<string>());
|| pid[i].classid == "RRID") {
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].typeCode).push(pid[i].value + "");
} }
} }
} }
@ -659,9 +656,9 @@ export class ParsingFunctions {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
if (subject.classid != "") { if (subject.typeCode != "") {
if (subject.classid == "keyword") { if (subject.typeCode == "keyword") {
let content: string = subject.content + ""; let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"]; // let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) { // if(found) {
@ -673,49 +670,49 @@ export class ParsingFunctions {
} }
subjects.push(content); subjects.push(content);
// } // }
} else if (!vocabulary || vocabulary[subject.classid] || subject.classid === "SDG" || subject.classid === "FOS") { } else if (!vocabulary || vocabulary[subject.typeCode] || subject.typeCode === "SDG" || subject.typeCode === "FOS") {
// if (subject.inferred && subject.inferred == true) { // if (subject.inferred && subject.inferred == true) {
if (subject.classid === "SDG") { if (subject.typeCode === "SDG") {
if (sdg == undefined) { if (sdg == undefined) {
sdg = new Array<string>(); sdg = new Array<string>();
} }
sdg.push(subject.content + ""); sdg.push(subject.value + "");
} else if (subject.classid === "FOS") { } else if (subject.typeCode === "FOS") {
if (fos == undefined) { if (fos == undefined) {
fos = new Array<string>(); fos = new Array<string>();
} }
fos.push(subject.content + ""); fos.push(subject.value + "");
} else { } else {
if (classifiedSubjects == undefined) { if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>(); classifiedSubjects = new Map<string, string[]>();
} }
let content: string = subject.content + ""; let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"]; // let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) { // if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; // setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; // eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else { // } else {
if (!classifiedSubjects.has(subject.classname)) { if (!classifiedSubjects.has(subject.typeLabel)) {
classifiedSubjects.set(subject.classname, new Array<string>()); classifiedSubjects.set(subject.typeLabel, new Array<string>());
} }
// if(properties.environment == "production") { // if(properties.environment == "production") {
// classifiedSubjects.get(subject.classname).push(content); // classifiedSubjects.get(subject.classname).push(content);
// } else { // } else {
classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content); classifiedSubjects.get(subject.typeLabel).push(subject.typeCode + ": " + content);
// } // }
// } // }
} }
} else { } else {
let content: string = subject.content + ""; let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"]; // let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) { // if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; // setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; // eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else { // } else {
let classname: string = subject.classname + ""; let classname: string = subject.typeLabel + "";
if (subjects == undefined) { if (subjects == undefined) {
subjects = new Array<string>(); subjects = new Array<string>();
} }
@ -842,10 +839,10 @@ export class ParsingFunctions {
} }
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) { parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { if (instance && instance.hasOwnProperty("instancetype")) {
if (!uniqueTypes.has(instance['instancetype'].classname)) { if (!uniqueTypes.has(instance['instancetype'])) {
types.push(instance['instancetype'].classname); types.push(instance['instancetype']);
uniqueTypes.add(instance['instancetype'].classname); uniqueTypes.add(instance['instancetype']);
} }
} }
} }
@ -854,13 +851,13 @@ export class ParsingFunctions {
var languages = new Array<string>(); var languages = new Array<string>();
if (!Array.isArray(_languages)) { if (!Array.isArray(_languages)) {
if (_languages.classname != "Undetermined" && _languages.classname) { if (_languages.label != "Undetermined" && _languages.label) {
languages.push(_languages.classname); languages.push(_languages.label);
} }
} else { } else {
for (let i = 0; i < _languages.length; i++) { for (let i = 0; i < _languages.length; i++) {
if (_languages[i].classname != "Undetermined" && _languages[i].classname) { if (_languages[i].label != "Undetermined" && _languages[i].label) {
languages.push(_languages[i].classname); languages.push(_languages[i].label);
} }
} }
} }
@ -871,13 +868,13 @@ export class ParsingFunctions {
var countries = new Array<string>(); var countries = new Array<string>();
if (!Array.isArray(_countries)) { if (!Array.isArray(_countries)) {
if (_countries.classname != "Undetermined" && _countries.classname) { if (_countries.label != "Undetermined" && _countries.label) {
countries.push(_countries.classname); countries.push(_countries.label);
} }
} else { } else {
for (let i = 0; i < _countries.length; i++) { for (let i = 0; i < _countries.length; i++) {
if (_countries[i].classname != "Undetermined" && _countries[i].classname) { if (_countries[i].label != "Undetermined" && _countries[i].label) {
countries.push(_countries[i].classname); countries.push(_countries[i].label);
} }
} }
} }
@ -888,13 +885,13 @@ export class ParsingFunctions {
var pLanguages = new Array<string>(); var pLanguages = new Array<string>();
if (!Array.isArray(_pLanguages)) { if (!Array.isArray(_pLanguages)) {
if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) { if (_pLanguages != "Undetermined" && _pLanguages) {
pLanguages.push(_pLanguages.classname); pLanguages.push(_pLanguages);
} }
} else { } else {
for (let i = 0; i < _pLanguages.length; i++) { for (let i = 0; i < _pLanguages.length; i++) {
if (_pLanguages[i].classname != "Undetermined" && _pLanguages[i].classname) { if (_pLanguages[i] != "Undetermined" && _pLanguages[i]) {
pLanguages.push(_pLanguages[i].classname); pLanguages.push(_pLanguages[i]);
} }
} }
} }
@ -926,16 +923,23 @@ export class ParsingFunctions {
static parseRelCanonicalId(record, type) { static parseRelCanonicalId(record, type) {
try { try {
if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) { if (record && record['links']) {
for (let child of record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) { let links = record['links'];
return child["objidentifier"]; let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation.hasOwnProperty("header")) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == type) {
return relation['header'].relatedIdentifier;
}
}
} }
} }
} catch (e) { } catch (e) {
// console.error(e); // console.error(e);
} }
return record["result"]["header"]["dri:objIdentifier"]; return record["header"]["id"];
} }
parseDescription(description, stripHTML: boolean = false): string { parseDescription(description, stripHTML: boolean = false): string {
@ -970,82 +974,73 @@ export class ParsingFunctions {
let downloads: number = 0; let downloads: number = 0;
elements.forEach(element => { elements.forEach(element => {
if (element.id == 'views') { if (element.id == 'views') {
views += element.count; element.unit.forEach(unit => {
let datasourceId = element.datasource; let viewsNum = parseInt(unit.label);
views += viewsNum;
let datasourceId = unit.code;
if(datasourceId) { if(datasourceId) {
if(datasourcePosition.has(element.datasource)) { if(datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count; countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum;
} else { } else {
datasourcePosition.set(element.datasource, countsPerDatasource.length); datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": element.count, "downloads": 0}) countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0})
} }
} }
// measure.views = element.count; });
} } else if (element.id == 'downloads') {
if (element.id == 'downloads') { element.unit.forEach(unit => {
downloads += element.count; let downloadsNum = parseInt(unit.label);
let datasourceId = element.datasource; downloads += downloadsNum;
let datasourceId = unit.code;
if (datasourceId) { if (datasourceId) {
if(datasourcePosition.has(element.datasource)) { if (datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count; countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum;
} else { } else {
datasourcePosition.set(element.datasource, countsPerDatasource.length); datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": 0, "downloads": element.count}) countsPerDatasource.push({
"datasourceId": datasourceId.split("||")[0],
"datasourceName": datasourceId.split("||")[1],
"views": 0,
"downloads": downloadsNum
})
} }
} }
});
// measure.downloads = element.count; // measure.downloads = element.count;
} else if (element.id == 'influence_alt' || element.id == 'citation_count') {
for(let unit of element.unit) {
if(unit.code == "score") {
bip.push({name: 'citations', icon: 'cite', value: parseInt(unit.label), order: 2});
} }
if (element.id == 'influence_alt' || element.id == 'citation_count') {
bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2});
// measure.citations = element.score;
} }
} else if (element.id == 'popularity' || element.id == 'influence' || element.id == 'impulse') {
let value = "";
for(let unit of element.unit) {
if (unit.code == "class") {
if (unit.label == 'C1') {
value = 'Top 0.01%';
} else if (unit.label == 'C2') {
value = 'Top 0.1%';
} else if (unit.label == 'C3') {
value = 'Top 1%';
} else if (unit.label == 'C4') {
value = 'Top 10%';
} else {
value = 'Average';
}
}
}
if (element.id == 'popularity') { if (element.id == 'popularity') {
let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3}; let metric: Metric = {name: 'popularity', icon: 'fire', value: value, order: 3};
if (element.class == 'C1') { bip.push(metric);
metric.value = 'Top 0.01%'; } else if (element.id == 'influence') {
} else if (element.class == 'C2') { let metric: Metric = {name: 'influence', icon: 'landmark', value: value, order: 4};
metric.value = 'Top 0.1%'; bip.push(metric);
} else if (element.class == 'C3') { } else if (element.id == 'impulse') {
metric.value = 'Top 1%'; let metric: Metric = {name: 'impulse', icon: 'rocket', value: value, order: 5};
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
}
// measure.popularity = metric.value;
bip.push(metric); bip.push(metric);
} }
if (element.id == 'influence') {
let metric: Metric = {name: 'influence', icon: 'landmark', value: null, order: 4};
if (element.class == 'C1') {
metric.value = 'Top 0.01%';
} else if (element.class == 'C2') {
metric.value = 'Top 0.1%';
} else if (element.class == 'C3') {
metric.value = 'Top 1%';
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
}
// measure.influence = metric.value;
bip.push(metric);
}
if (element.id == 'impulse') {
let metric: Metric = {name: 'impulse', icon: 'rocket', value: null, order: 5};
if (element.class == 'C1') {
metric.value = 'Top 0.01%';
} else if (element.class == 'C2') {
metric.value = 'Top 0.1%';
} else if (element.class == 'C3') {
metric.value = 'Top 1%';
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
}
// measure.impulse = metric.value;
bip.push(metric);
} }
}); });

View File

@ -10,6 +10,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import {EnvProperties} from "../../utils/properties/env-properties"; import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {ParsingFunctions} from "./parsingFunctions.class";
@Component({ @Component({
selector: 'showIdentifiers', selector: 'showIdentifiers',
@ -26,8 +27,7 @@ import {properties} from "../../../../environments/environment";
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span> <span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
<span [class.uk-margin-small-left]="modal"> <span [class.uk-margin-small-left]="modal">
<ng-container *ngFor="let item of identifiers.get(key) let j=index"> <ng-container *ngFor="let item of identifiers.get(key) let j=index">
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data' || key == 'swhid' <a *ngIf="parsingFunctions.identifierTypes.indexOf(key) != -1"
|| key == 'ROR' || key == 'ISNI' || key == 'Wikidata' || key == 'FundRef' || key == 'RRID'"
[href]="getUrl(key, item) + item" target="_blank" class="uk-display-inline-block custom-external"> [href]="getUrl(key, item) + item" target="_blank" class="uk-display-inline-block custom-external">
{{item}} {{item}}
</a> </a>
@ -69,7 +69,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
properties: EnvProperties = properties; properties: EnvProperties = properties;
@ViewChildren("content", { read: ElementRef }) types: QueryList<ElementRef>; @ViewChildren("content", { read: ElementRef }) types: QueryList<ElementRef>;
@ViewChild('identifiersModal') identifiersModal; @ViewChild('identifiersModal') identifiersModal;
public parsingFunctions: ParsingFunctions = new ParsingFunctions();
constructor(private cdr: ChangeDetectorRef) { constructor(private cdr: ChangeDetectorRef) {
} }
@ -118,7 +118,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
if(value.includes("http://") || value.includes("https://")) { if(value.includes("http://") || value.includes("https://")) {
return ""; return "";
} }
if(key == "doi") { if(key == "doi" || key == "Digital Object Identifier") {
return properties.doiURL; return properties.doiURL;
} else if(key == "pmc") { } else if(key == "pmc") {
return properties.pmcURL; return properties.pmcURL;

View File

@ -102,7 +102,7 @@ export class OrganizationsDeletedByInferenceComponent {
} }
if(result.hasOwnProperty("country")) { if(result.hasOwnProperty("country")) {
preview.countries = [result['country'].classname]; preview.countries = [result['country'].label];
} }
preview.resultType = 'organization'; preview.resultType = 'organization';

View File

@ -13,6 +13,9 @@ export class OrganizationsDeletedByInferenceService {
public parsingFunctions: ParsingFunctions; public parsingFunctions: ParsingFunctions;
/**
* @deprecated
*/
getDeletedByInferenceResults(id: string, size: string, properties: EnvProperties): any { getDeletedByInferenceResults(id: string, size: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'deletedByInferenceOrganizations/' + id + "?format=json&size=" + size; let url = properties.searchAPIURLLAst + 'deletedByInferenceOrganizations/' + id + "?format=json&size=" + size;
@ -21,6 +24,9 @@ export class OrganizationsDeletedByInferenceService {
.pipe(map(res => this.parseDeletedByInferenceResults(res, properties))); .pipe(map(res => this.parseDeletedByInferenceResults(res, properties)));
} }
/**
* @deprecated
*/
parseDeletedByInferenceResults(_results: any, properties: EnvProperties): OrganizationInfo[] { parseDeletedByInferenceResults(_results: any, properties: EnvProperties): OrganizationInfo[] {
let results: OrganizationInfo[] = []; let results: OrganizationInfo[] = [];
if (_results) { if (_results) {

View File

@ -808,7 +808,7 @@ export class ProjectComponent {
} }
this.header1 += "</div>"; this.header1 += "</div>";
this.header1 += "<h1 style=\"margin:0;\"><div><a href=\""+window.location.href +"\">"; this.header1 += "<h2 style=\"margin:0;\"><div><a href=\""+window.location.href +"\">";
if(this.projectInfo.acronym) { if(this.projectInfo.acronym) {
this.header1 += this.projectInfo.acronym; this.header1 += this.projectInfo.acronym;
} else { } else {

View File

@ -26,11 +26,6 @@ export class ProjectService {
let key = url; let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : 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))); .pipe(map(res => this.parseProjectInfo(res, properties)));
} }
@ -46,10 +41,6 @@ export class ProjectService {
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json()) //.map(res => <any> res.json())
.pipe(map(res => res['results'][0])) .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))); .pipe(map(res => this.parseProjectInfo(res, properties)));
} }
@ -63,15 +54,13 @@ export class ProjectService {
let key = url + '_projectDates'; let key = url + '_projectDates';
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : 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.parseProjectDates(id, res))) .pipe(map(res => this.parseProjectDates(id, res)))
} }
/**
* @deprecated
*/
getHTMLInfo(id: string, properties: EnvProperties): any { getHTMLInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json"; let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url; let key = url;
@ -97,50 +86,36 @@ export class ProjectService {
} }
parseProjectInfo(data: any, properties: EnvProperties): any { parseProjectInfo(data: any, properties: EnvProperties): any {
if(data == null) {
return null;
}
this.projectInfo = new ProjectInfo(); this.projectInfo = new ProjectInfo();
if(data["header"]) {
this.projectInfo.id = data["header"]["id"];
}
if(data["project"]) {
let project = data["project"];
this.projectInfo.funding = { this.projectInfo.funding = {
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "", funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: "" fundingStream: "", budget: "", contribution: "", currency: ""
}; };
// ['result']['header']['dri:objIdentifier'] this.projectInfo.acronym = project.acronym;
if (data[3] != null) { if (project['title']) {
this.projectInfo.id = data[3]; this.projectInfo.title = Array.isArray(project['title']) ? StringUtils.HTMLToString(String(project.title[0])) : StringUtils.HTMLToString(String(project.title));
}
// ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
if (data[1] != null) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": 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.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
// ['result']['metadata']['oaf:entity']['oaf:project']
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 { } else {
this.projectInfo.title = ""; this.projectInfo.title = "";
} }
this.projectInfo.funding.code = data[0].code; this.projectInfo.funding.code = project.code;
if (data[0].startdate) { if (project.startdate) {
let date: number = Date.parse(data[0].startdate); let date: number = Date.parse(project.startdate);
this.projectInfo.startDate = (date ? date : null); this.projectInfo.startDate = (date ? date : null);
} }
if (data[0].enddate) { if (project.enddate) {
let date: number = Date.parse(data[0].enddate); let date: number = Date.parse(project.enddate);
this.projectInfo.endDate = (date ? date : null); this.projectInfo.endDate = (date ? date : null);
} }
if (this.projectInfo.endDate || this.projectInfo.startDate) { if (this.projectInfo.endDate || this.projectInfo.startDate) {
@ -162,95 +137,78 @@ export class ProjectService {
} }
} }
if (this.projectInfo.funding) { if (this.projectInfo.funding) {
if (this.projectInfo.funding.funderShortName == "EC") { // if (this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39; this.projectInfo.openAccessMandatePublications = project.oamandatepublications;
if (data[0].hasOwnProperty("projectoamandatedata")) { if (project["projectoamandatedata"]) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata; this.projectInfo.openAccessMandateDatasets = project.oamandatedata;
} else if (data[0].hasOwnProperty("ecarticle29_3")) { } else if (project["ecarticle29_3"]) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3; this.projectInfo.openAccessMandateDatasets = project.ecarticle29_3;
} }
this.projectInfo.funding.callIdentifier = data[0].callidentifier; this.projectInfo.funding.callIdentifier = project.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 : []); this.projectInfo.funding.budget = project.totalcost;//"10000";
this.projectInfo.funding.contribution = project.fundedamount;//"200100";
this.projectInfo.funding.currency = project.currency;//"EUR";
} }
// ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel'] this.projectInfo.description = this.parsingFunctions.parseDescription(project && project.summary ? project.summary : []);
if (data[2] != null) {
if (project['funding']) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
funding = this.parsingFunctions.parseFundingTrees(project.funding);
if (funding.funderName) {
this.projectInfo.funding.funderName = funding.funderName;
}
if (funding.funderShortname) {
this.projectInfo.funding.funderShortName = funding.funderShortname;
}
if (funding.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
}
if(data["links"]) {
this.projectInfo.organizations = []; this.projectInfo.organizations = [];
if (!Array.isArray(data[2])) { let links = data['links'];
if (data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") { let relLength = Array.isArray(links) ? links.length : 1;
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"] && relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasparticipant") {
let country: string = ""; let country: string = "";
let acronym: string = ""; let acronym: string = "";
let name: string = ""; let name: string = "";
let id: string = ""; let id: string = "";
if(data[2].hasOwnProperty("country")) {
country = data[2].country.classname; id = relation['header'].relatedIdentifier;
if(relation["country"]) {
country = relation.country.label;
} }
if (data[2].hasOwnProperty("legalshortname")) { if (relation["legalshortname"]) {
acronym = data[2].legalshortname; acronym = relation.legalshortname;
} }
if (data[2].hasOwnProperty("legalname")) { if (relation["legalname"]) {
name = data[2].legalname; name = relation.legalname;
} }
if (!acronym && !name) { if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip // acronym is displayed with link and name only in tooltip
acronym = "[no title available]"; acronym = "[no title available]";
} }
if (data[2].hasOwnProperty("to")) {
id = data[2]['to'].content;
}
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
}
} else {
for (let i = 0; i < data[2].length; i++) {
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}); this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
} }
} }
} }
}
if (this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") { if (data.measures) {
this.projectInfo.url = properties.cordisURL + this.projectInfo.funding.code; this.projectInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
}
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
} }
return this.projectInfo; return this.projectInfo;
@ -259,9 +217,9 @@ export class ProjectService {
parseProjectDates(id: string, data: any): any { parseProjectDates(id: string, data: any): any {
let project = {id: id, startDate: "", endDate: ""}; let project = {id: id, startDate: "", endDate: ""};
if (data[0] != null) { if (data['project'] != null) {
project.startDate = data[0].startdate; project.startDate = data['project'].startdate;
project.endDate = data[0].enddate; project.endDate = data['project'].enddate;
} }
return project; return project;

View File

@ -92,33 +92,31 @@ export class DeletedByInferenceComponent {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let result = Array.isArray(this.children) ? this.children[i] : this.children; let result = Array.isArray(this.children) ? this.children[i] : this.children;
let preview = new ResultPreview(); let preview = new ResultPreview();
if(result.hasOwnProperty("creator")) { if(result["author"]) {
preview.authors = []; preview.authors = [];
let authorsLength = Array.isArray(result.creator) ? result.creator.length : 1; let authorsLength = Array.isArray(result.author) ? result.author.length : 1;
for (let j = 0; j < authorsLength; j++) { for (let j = 0; j < authorsLength; j++) {
let author = {"fullName": Array.isArray(result.creator) ? result.creator[j] : result.creator, "orcid": null, "orcid_pending": null}; let author = {"fullName": Array.isArray(result.author) ? result.author[j] : result.author, "orcid": null, "orcid_pending": null};
preview.authors.push(author); preview.authors.push(author);
} }
} }
if(result.hasOwnProperty("dateofacceptance")) { if(result.hasOwnProperty("dateofacceptance")) {
preview.year = new Date(result.dateofacceptance).getFullYear().toString(); preview.year = new Date(result.dateofacceptance).getFullYear().toString();
} }
if(result.hasOwnProperty("title")) { if (result['title']) {
let titleLength = Array.isArray(result.title) ? result.title.length : 1; preview.title = StringUtils.HTMLToString(String(result['title']));
for (let j = 0; j < titleLength; j++) {
let title = Array.isArray(result.title) ? result.title[j] : result.title;
if (!preview.title || title.classid == "main title") {
preview.title = StringUtils.HTMLToString(String(title.content));
}
}
} }
if(result.hasOwnProperty("description")) { if(result.hasOwnProperty("description")) {
preview.description = result.description; preview.description = result.description;
} }
preview.resultType = result?.resulttype?.classid ? result.resulttype.classid : this.resultType;
if(result.header) {
// preview.resultType = result?.resulttype ? result.resulttype : this.resultType;
preview.resultType = result.header?.recordType ? result.result.header.recordType : this.resultType;
}
if (result.hasOwnProperty("instance")) { if (result.hasOwnProperty("instances")) {
preview.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>(); preview.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
preview.types = new Array<string>(); preview.types = new Array<string>();
@ -127,10 +125,10 @@ export class DeletedByInferenceComponent {
let counter = 0; let counter = 0;
let instance; let instance;
let instanesLength = Array.isArray(result['instance']) ? result['instance'].length : 1; let instanesLength = Array.isArray(result['instances']) ? result['instances'].length : 1;
for (let j = 0; j < instanesLength; j++) { for (let j = 0; j < instanesLength; j++) {
instance = Array.isArray(result['instance']) ? result['instance'][j] : result['instance']; instance = Array.isArray(result['instances']) ? result['instances'][j] : result['instances'];
if(result.hasOwnProperty('collectedfrom')) { if(result.hasOwnProperty('collectedfrom')) {
if(Array.isArray(result['collectedfrom'])) { if(Array.isArray(result['collectedfrom'])) {
// not sure if this is correct mapping // not sure if this is correct mapping
@ -142,12 +140,12 @@ export class DeletedByInferenceComponent {
parsingFunctions.parseTypes(preview.types, types, instance); parsingFunctions.parseTypes(preview.types, types, instance);
if (instance.hasOwnProperty("webresource")) { if (instance.hasOwnProperty("url")) {
let url; let url;
if (!Array.isArray(instance['webresource'])) { if (!Array.isArray(instance['url'])) {
url = instance['webresource'].url; url = instance['url'];
} else { } else {
url = instance['webresource'][0].url; url = instance['url'][0];
} }
if (url.includes('&amp;')) { if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&'); url = url.replace(/&amp;/gmu, '&');

View File

@ -16,6 +16,9 @@ export class DeletedByInferenceService {
public parsingFunctions: ParsingFunctions; public parsingFunctions: ParsingFunctions;
/**
* @deprecated
*/
getDeletedByInferenceResults (id: string, size: string, properties:EnvProperties):any { getDeletedByInferenceResults (id: string, size: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst + 'deletedByInferenceResults/' +id+"?format=json&size="+size; let url = properties.searchAPIURLLAst + 'deletedByInferenceResults/' +id+"?format=json&size="+size;
let key = url; let key = url;
@ -26,6 +29,9 @@ export class DeletedByInferenceService {
.pipe(map(res => this.parseDeletedByInferenceResults(res))); .pipe(map(res => this.parseDeletedByInferenceResults(res)));
} }
/**
* @deprecated
*/
parseDeletedByInferenceResults (_results: any): ResultLandingInfo[] { parseDeletedByInferenceResults (_results: any): ResultLandingInfo[] {
/*title, authors, abstract, List of projects, PIDs, /*title, authors, abstract, List of projects, PIDs,
collectedfrom (link pointing to the download url), access rights*/ collectedfrom (link pointing to the download url), access rights*/

View File

@ -721,25 +721,25 @@
<modal-alert *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds" <modal-alert *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds"
#AlertModalDeletedByInference large="true"> #AlertModalDeletedByInference large="true">
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference" [modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath" [resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference" [modal]="AlertModalDeletedByInference"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath" [resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference" [modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath" [resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference" [modal]="AlertModalDeletedByInference"
[resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath" [resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath"
@ -1197,28 +1197,28 @@
<ng-container *ngIf="isMobile"> <ng-container *ngIf="isMobile">
<fs-modal *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds" #AlertModalDeletedByInferenceFS classTitle="uk-tile-default uk-border-bottom"> <fs-modal *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds" #AlertModalDeletedByInferenceFS classTitle="uk-tile-default uk-border-bottom">
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS" [resultType]="type" [type]="openaireEntities.PUBLICATIONS"
[isMobile]="isMobile" [isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS" [modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS" [resultType]="'dataset'" [type]="openaireEntities.DATASETS"
[isMobile]="isMobile" [isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS" [modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.SOFTWARE" [resultType]="type" [type]="openaireEntities.SOFTWARE"
[isMobile]="isMobile" [isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS" [modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference> [children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened" <deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds" [ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'other'" [type]="openaireEntities.OTHER" [resultType]="'other'" [type]="openaireEntities.OTHER"
[isMobile]="isMobile" [isMobile]="isMobile"

View File

@ -74,13 +74,14 @@ export class ResultLandingService {
error: "Http failure response for " + finalUrl + ": 404 Not Found" error: "Http failure response for " + finalUrl + ": 404 Not Found"
}); });
} }
//TODO make sure to pass the correct part
return res['results'][0]; return res['results'][0];
} else { } else {
return res; return res;
} }
})) }))
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res])) // .pipe(map(res => [res['meta']['status'], res['result']['metadata']['oaf:entity'], res]))
.pipe(map(res => [ /*.pipe(map(res => [
res[1]['oaf:result'], // 0 res[1]['oaf:result'], // 0
res[1]['oaf:result']['title'], // 1 res[1]['oaf:result']['title'], // 1
res[1]['oaf:result']['rels']['rel'], // 2 res[1]['oaf:result']['rels']['rel'], // 2
@ -99,7 +100,7 @@ export class ResultLandingService {
? res[1]['extraInfo']['references']['reference'] : null, // 13 ? res[1]['extraInfo']['references']['reference'] : null, // 13
res[0], // 14 res[0], // 14
res[2], // 15 res[2], // 15
])) ]))*/
.pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties))); .pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties)));
} }
@ -127,155 +128,95 @@ export class ResultLandingService {
} }
parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any { parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any {
this.resultLandingInfo = new ResultLandingInfo(); if(data == null) {
// res return null;
this.resultLandingInfo.record = data[15];
this.resultLandingInfo.objIdentifier = data[15]["result"]["header"]["dri:objIdentifier"];
this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result");
this.resultLandingInfo.resultType = data[0].resulttype.classid;
// 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.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;
if(data[0].hasOwnProperty("publiclyfunded") && data[0].publiclyfunded) {
this.resultLandingInfo.publiclyFunded = data[0].publiclyfunded;
} }
if((data[0].hasOwnProperty("isgreen") && data[0].isgreen)
|| (data[0].hasOwnProperty("openaccesscolor") && data[0].openaccesscolor) this.resultLandingInfo = new ResultLandingInfo();
|| (data[0].hasOwnProperty("isindiamondjournal") && data[0].isindiamondjournal)) { this.resultLandingInfo.record = data;
if(data["header"]) {
this.resultLandingInfo.objIdentifier = data["header"]["id"];
this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result");
this.resultLandingInfo.resultType = data['header']['recordType'];
this.resultLandingInfo.underCurationMessage = data["header"]['status'] == "UNDER_CURATION";
}
if(data["result"]) {
let result = data["result"];
let date: string = (result['publicationdate'] ? result['publicationdate'] : '') + ''; // transform to string in case it is an integer
this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
this.resultLandingInfo.dateofacceptance = result['publicationdate'] ? Dates.getDate(result['publicationdate']) : null;
this.resultLandingInfo.publisher = result['publisher'];
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(result['description'] ? result['description'] : []);
this.resultLandingInfo.embargoEndDate = result['embargoenddate'] ? Dates.getDate(result['embargoenddate']) : null;
if (result.publiclyFunded) {
this.resultLandingInfo.publiclyFunded = result.publiclyFunded;
}
if (result["isGreen"] || result["openAccessColor"] || result["isInDiamondJournal"]) {
this.resultLandingInfo.oaRoutes = { this.resultLandingInfo.oaRoutes = {
"green": data[0].isgreen, "green": result.isGreen,
"oaColor": data[0].openaccesscolor, "oaColor": result.openAccessColor,
"isInDiamondJournal":data[0].isindiamondjournal "isInDiamondJournal": result.isInDiamondJournal
}; };
} }
if (result['bestaccessright'] && result['bestaccessright']["label"]) {
this.resultLandingInfo.accessMode = result['bestaccessright'].label;
} }
if (data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) { if (result['maintitle']) {
this.resultLandingInfo.accessMode = data[0]['bestaccessright'].classname; this.resultLandingInfo.title = StringUtils.HTMLToString(String(result['maintitle']));
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['title'] if (result['otherTitles'] != null) {
if (data[1] != null) { let titles = result['otherTitles'];
if (Array.isArray(data[1])) { if (Array.isArray(titles)) {
for (let i = 0; i < data[1].length; i++) { for (let i = 0; i < titles.length; i++) {
if (data[1][i] && data[1][i].content) { if (titles[i]) {
if (!this.resultLandingInfo.title || data[1][i].classid == "main title") { if (!this.resultLandingInfo.subtitle) {
this.resultLandingInfo.title = StringUtils.HTMLToString(String(data[1][i].content)); this.resultLandingInfo.subtitle = StringUtils.HTMLToString(String(titles[i]));
} }
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") {
// break;
// }
} }
if (!this.resultLandingInfo.title) {
this.resultLandingInfo.title = this.resultLandingInfo.subtitle;
} }
if (this.resultLandingInfo.title === this.resultLandingInfo.subtitle) { if (this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = ""; this.resultLandingInfo.subtitle = "";
} }
if (!this.resultLandingInfo.title) {
this.resultLandingInfo.title = "";
}
// this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : "";
} else { } else {
this.resultLandingInfo.title = (data[1] && data[1].content) ? StringUtils.HTMLToString(String(data[1].content)) : ""; this.resultLandingInfo.title = (titles) ? StringUtils.HTMLToString(String(titles)) : "";
} }
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel'] if (result["instance"]) {
if (data[2] != null) {
let relation;
let length = Array.isArray(data[2]) ? data[2].length : 1;
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") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation);
}
if (relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
let relationName: string = relation.to.class;
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") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if (relation['to'].scheme && relation['to'].scheme == "dnet:result_datasource_relations" &&
(relation['datasourcetype']?.classname!== "service" || properties.adminToolsPortalType == "eosc")) {
let relationName: string = relation.to.class;
if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
}
let provenanceAction: string = relation.provenanceaction;
// this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
if (this.resultLandingInfo.relatedServices == undefined) {
this.resultLandingInfo.relatedServices = [];
}
this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
}
}
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['children']
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++) {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier);
}
this.resultLandingInfo.children = data[3]['result'];
}
if (data[3].hasOwnProperty("instance")) {
this.resultLandingInfo.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>(); this.resultLandingInfo.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
this.resultLandingInfo.types = new Array<string>(); this.resultLandingInfo.types = new Array<string>();
let types = new Set<string>(); let types = new Set<string>();
let counter = 0;
let instance; let instance;
let length = Array.isArray(result['instance']) ? result['instance'].length : 1;
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']; instance = Array.isArray(result['instance']) ? result['instance'][i] : result['instance'];
this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance); this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance);
if (instance.hasOwnProperty("webresource")) { if (instance["url"]) {
let url; let url;
if (!Array.isArray(instance['webresource'])) { url = Array.isArray(instance['url']) ? instance['url'][0] : instance["url"];
url = instance['webresource'].url;
} else {
url = instance['webresource'][0].url;
}
if (url.includes('&amp;')) { if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&'); url = url.replace(/&amp;/gmu, '&');
} }
/**********************************************************/ if (instance["hostedby"]) {
if (instance.hasOwnProperty("hostedby")) {
this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode); this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode);
} }
/**********************************************************/
} }
} }
@ -283,61 +224,42 @@ export class ResultLandingService {
this.resultLandingInfo.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom); this.resultLandingInfo.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
} }
if (data[3].hasOwnProperty("externalreference")) { if (result['journal']) {
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(data[3]); let journal = result['journal'];
this.resultLandingInfo.bioentities = externalResults;
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['pid']
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 = { this.resultLandingInfo.journal = {
"journal": "", "journal": "", "issn": "", "lissn": "", "eissn": "",
"issn": "", "issue": "", "volume": "", "start_page": "", "end_page": ""
"lissn": "",
"eissn": "",
"issue": "",
"volume": "",
"start_page": "",
"end_page": ""
} }
this.resultLandingInfo.journal['journal'] = data[5].content; this.resultLandingInfo.journal['journal'] = journal.name;
this.resultLandingInfo.journal['issn'] = data[5].issn; this.resultLandingInfo.journal['issn'] = journal.issnPrinted;
this.resultLandingInfo.journal['lissn'] = data[5].lissn; this.resultLandingInfo.journal['lissn'] = journal.issnLinking;
this.resultLandingInfo.journal['eissn'] = data[5].eissn; this.resultLandingInfo.journal['eissn'] = journal.issnOnline;
this.resultLandingInfo.journal['issue'] = data[5].iss; this.resultLandingInfo.journal['issue'] = journal.iss;
this.resultLandingInfo.journal['volume'] = data[5].vol; this.resultLandingInfo.journal['volume'] = journal.vol;
this.resultLandingInfo.journal['start_page'] = data[5].sp; this.resultLandingInfo.journal['start_page'] = journal.sp;
this.resultLandingInfo.journal['end_page'] = data[5].ep; this.resultLandingInfo.journal['end_page'] = journal.ep;
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['language'] if(result['programmingLanguage']) {
if (data[6] != null) { this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(result['programmingLanguage']);
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(data[6]);
// let languagesAndCodes: string[][] = this.parsingFunctions.parseLanguages(data[6]);
// this.resultLandingInfo.languages = languagesAndCodes[0];
// this.resultLandingInfo.languageCodes = languagesAndCodes[1];
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['country'] if(result['language']) {
if (data[11] != null) { this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(result['language']);
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(data[11]);
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['eoscifguidelines'] if (result['country']) {
if (data[7] != null) { this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(result['country']);
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(data[7]); }
if (result['eoscifguidelines'] != null) {
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(result['eoscifguidelines']);
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['subject'] // res['result']['metadata']['oaf:entity']['oaf:result']['subject']
if (data[8] != null) { if (result['subject'] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary); let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(result['subject'], subjectsVocabulary);
this.resultLandingInfo.subjects = subjectResults[0]; this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1]; this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2]; this.resultLandingInfo.classifiedSubjects = subjectResults[2];
@ -374,69 +296,43 @@ export class ResultLandingService {
}) })
} }
} }
// if(!this.resultLandingInfo.eoscSubjects) {
// this.resultLandingInfo.eoscSubjects = subjectResults[5];
// }
} }
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom( if (result['author']) {
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) {
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(data[12]);
}
// res['result']['metadata']['oaf:entity']['extraInfo']['references']['reference']
if (data[13] != null) {
this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['context']
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") {
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) { if (this.resultLandingInfo.authors == undefined) {
this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>(); this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
} }
let authors = data[10]; let authors = result['author'];
let length = Array.isArray(authors) ? authors.length : 1; let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let parsedAuthor = {"fullName": null, "orcid": null, "orcid_pending": null};
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
if (author) { if (author) {
if (author.orcid) { parsedAuthor.fullName = author.fullname;
author.orcid = author.orcid.toUpperCase(); let pids = author.pid?author.pid:[];
for(let pid of pids) {
if (pid.typeCode == 'orcid') {
parsedAuthor.orcid = pid.value.toUpperCase();
break;
} else if (pid.typeCode == "orcid_pending") {
parsedAuthor.orcid_pending = pid.value.toUpperCase();
} }
if (author.orcid_pending) {
author.orcid_pending = author.orcid_pending.toUpperCase();
} }
if(this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.content) { if (this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.fullname) {
if(!author.orcid && this.resultLandingInfo['authors'][author.rank].orcid) { if (!parsedAuthor.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
author.orcid = this.resultLandingInfo['authors'][author.rank].orcid; parsedAuthor.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
} else if(!author.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) { } else if (!parsedAuthor.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) {
author.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending; parsedAuthor.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending;
} }
} }
this.resultLandingInfo['authors'][author.rank] = { this.resultLandingInfo['authors'][author.rank] = {
"fullName": author.content, "fullName": parsedAuthor.fullName,
"orcid": author.orcid, "orcid": parsedAuthor.orcid,
"orcid_pending": author.orcid_pending "orcid_pending": parsedAuthor.orcid_pending
}; };
} }
} }
@ -445,12 +341,86 @@ export class ResultLandingService {
}); });
} }
// res['result']['metadata']['oaf:entity']['oaf:result']['measure'] // TODO: example?
if (data[0]?.measure) { if (result["externalReference"]) {
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure); let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(result["externalReference"]);
this.resultLandingInfo.bioentities = externalResults;
}
} }
if(data["pid"]) {
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data["pid"]);
}
if(data["links"]) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"]) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isproducedby") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation);
}
// links.header.relationType (==resultResult)
if (relation['header'].relationType == "resultResult" && (!relation['header'].relationClass || relation['header'].relationClass.toLowerCase() != "merges")) {
let relationName: string = relation.header.relationClass;
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['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if (relation['header'].relationType == "resultService" &&
(relation['datasourcetype']?.code !== "service" || properties.adminToolsPortalType == "eosc")) {
let relationName: string = relation.header.relationClass;
if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
}
let provenanceAction: string = relation.header.relationProvenance;
if (this.resultLandingInfo.relatedServices == undefined) {
this.resultLandingInfo.relatedServices = [];
}
this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
} else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
if(!this.resultLandingInfo.deletedByInferenceIds) {
this.resultLandingInfo.deletedByInferenceIds = [];
}
this.resultLandingInfo.deletedByInferenceIds.push(relation['header'].relatedIdentifier);
if(!this.resultLandingInfo.children) {
this.resultLandingInfo.children = [];
}
this.resultLandingInfo.children.push(relation);
}
}
}
this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults); this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
}
if(data['context']) {
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data['context']);
}
if (data.measures) {
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
}
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
this.resultLandingInfo.journal?.journal, this.resultLandingInfo.identifiers);
//TODO: missing
// // res['result']['metadata']['oaf:entity']['extraInfo']['references']['reference']
// if (data[13] != null) {
// this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]);
// }
//
return this.resultLandingInfo; return this.resultLandingInfo;
} }
@ -470,15 +440,15 @@ export class ResultLandingService {
country: "", trust: null country: "", trust: null
}; };
organization.id = relation['to'].content; organization.id = relation['header'].relatedIdentifier;
organization.name = relation.legalname; organization.name = relation.legalname;
organization.shortname = relation.legalshortname; organization.shortname = relation.legalshortname;
organization.websiteUrl = relation.websiteurl; organization.websiteUrl = relation.websiteurl;
if (relation.country) { if (relation.country) {
organization.country = relation.country.classname; organization.country = relation.country.label;
} }
if (relation.trust) { if (relation.header.trust) {
organization.trust = Math.round(relation.trust * 100); organization.trust = Math.round(relation.header.trust * 100);
} }
organizations.push(organization); organizations.push(organization);
@ -488,14 +458,14 @@ export class ResultLandingService {
parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> { parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> {
let bioentities: Map<string, Map<string, string>>; let bioentities: Map<string, Map<string, string>>;
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1; let length = Array.isArray(children) ? children.length : 1;
let externalreference; 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']; externalreference = Array.isArray(children) ? children[i] : children;
if (externalreference.hasOwnProperty("qualifier")) { if (externalreference["qualifier"]) {
if (externalreference['qualifier'].classid == "accessionNumber") { if (externalreference['qualifier'].code == "accessionNumber") {
if (bioentities == undefined) { if (bioentities == undefined) {
bioentities = new Map<string, Map<string, string>>(); bioentities = new Map<string, Map<string, string>>();

View File

@ -37,7 +37,7 @@ export class OrganizationService {
return this.http.get((properties.useCache) ? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache) ? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json()) //.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])) // .pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:organization']))
.pipe(map(res => this.parseOrganizationNameAndUrl(res))); .pipe(map(res => this.parseOrganizationNameAndUrl(res)));
} }
@ -49,24 +49,25 @@ export class OrganizationService {
} }
parseOrganizationInfo (data: any):any { parseOrganizationInfo (data: any):any {
this.organizationInfo = new OrganizationInfo(); if(data == null) {
this.organizationInfo.relcanId = ParsingFunctions.parseRelCanonicalId(data,"organization");
let organization;
let relations;
if(data != null) {
organization = data['result']['metadata']['oaf:entity']['oaf:organization'];
this.organizationInfo.objIdentifier = data["result"]["header"]["dri:objIdentifier"];
if(this.organizationInfo.objIdentifier.startsWith("openorgs____::")) {
this.organizationInfo.relcanId = this.organizationInfo.objIdentifier;
}
relations = data['result']['metadata']['oaf:entity']['oaf:organization']['rels']['rel'];
} else {
return null; return null;
} }
if(organization != null) { this.organizationInfo = new OrganizationInfo();
let organization;
if(organization.hasOwnProperty("websiteurl")) { if(data["header"]) {
this.organizationInfo.relcanId = ParsingFunctions.parseRelCanonicalId(data,"organization");
this.organizationInfo.objIdentifier = data["header"]["id"];
if(this.organizationInfo.objIdentifier.startsWith("openorgs____::")) {
this.organizationInfo.relcanId = this.organizationInfo.objIdentifier;
}
}
if(data["organization"]) {
organization = data["organization"];
if (organization["websiteurl"]) {
this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl}; this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else { } else {
this.organizationInfo.title = {"name": organization.legalshortname, "url": ''}; this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
@ -78,129 +79,49 @@ export class OrganizationService {
this.organizationInfo.title.name = this.organizationInfo.name; this.organizationInfo.title.name = this.organizationInfo.name;
} }
if(organization.hasOwnProperty("country")) { if (organization["country"]) {
this.organizationInfo.country = organization['country'].classname; this.organizationInfo.country = organization['country'].label;
}
} }
if (organization.hasOwnProperty("children")) { if(data["pid"]) {
let children = organization['children']; this.organizationInfo.identifiers = this.parsingFunctions.parseIdentifiers(data['pid']);
if( children.hasOwnProperty("organization")) { }
if(data["links"]) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"]) {
// TODO: Check if merges or isMergedIn
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == "organization") {
if(!this.organizationInfo.deletedByInferenceIds) {
this.organizationInfo.deletedByInferenceIds = []; this.organizationInfo.deletedByInferenceIds = [];
let length = Array.isArray(children['organization']) ? children['organization'].length : 1;
for (let i = 0; i < length; i++) {
let result = Array.isArray(children['organization']) ? children['organization'][i] : children['organization'];
this.organizationInfo.deletedByInferenceIds.push(result.objidentifier);
} }
this.organizationInfo.deletedByInferenceIds.push(relation['header'].relatedIdentifier);
if(!this.organizationInfo.children) {
this.organizationInfo.children = [];
}
this.organizationInfo.children.push(relation);
} }
this.organizationInfo.children = children['organization'];
}
if(organization['pid']) {
this.organizationInfo.identifiers = this.parsingFunctions.parseIdentifiers(organization['pid']);
}
}
//Comment Parsing Projects info
/*
if(data[1] != null) {
let counter;
let length = relations.length!=undefined ? relations.length : 1;
for(let i=0; i<length; i++) {
let relation = relations.length!=undefined ? relations[i] : relations;
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isParticipant") {
if(relation.hasOwnProperty("funding")) {
if(relation['funding'].hasOwnProperty("funder")) {
if(this.organizationInfo.projects == undefined) {
this.organizationInfo.projects = new Map<string,
{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }[]>();
}
if(!this.organizationInfo.projects.has(relation['funding']['funder'].name)) {
this.organizationInfo.projects.setValues(relation['funding']['funder'].name,
new Array<{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }>());
}
counter = this.organizationInfo.projects.get(relation['funding']['funder'].name).length;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter] =
{ "name": "", "id": "", "code": "",
"acronym": "", "funder": "", "funderId": "",
"fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
"sc39": "", "startDate": "", "endDate": "" };
//let url = "";
if(relation['to'].content != null && relation['to'].content != "") {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['id'] = relation['to'].content;
//url = OpenaireProperties.getsearchLinkToProject()+relation['to'].content;
}
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['name'] = relation.title;
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['url'] = url;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['code'] = relation.code;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['acronym'] = relation.acronym;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funder'] = relation['funding']['funder'].shortname;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funderId'] = relation['funding']['funder'].id;
if(relation['funding'].hasOwnProperty("funding_level_0")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingStream'] = relation['funding']['funding_level_0'].name;
}
if(relation['funding'].hasOwnProperty("funding_level_1")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel1'] = relation['funding']['funding_level_1'].name;
}
if(relation['funding'].hasOwnProperty("funding_level_2")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel2'] = relation['funding']['funding_level_2'].name;
}
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['sc39'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['startDate'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
}
}
}
} /*else if(relation['to'].class == "isProvidedBy") {
if(this.organizationInfo.dataProviders == undefined) {
this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
}
counter = this.organizationInfo.dataProviders.length;
this.organizationInfo.dataProviders[counter] = { "name": "", "url": "", "type": "", "websiteUrl": "", "organizations": [] }
let url="";
if(relation['to'].content != null && relation['to'].content != "") {
url = OpenaireProperties.getsearchLinkToDataProvider()+relation['to'].content;
}
this.organizationInfo.dataProviders[counter]['name'] = relation.officialname;
this.organizationInfo.dataProviders[counter]['url'] = url;
if(relation.hasOwnProperty("datasourcetype")) {
this.organizationInfo.dataProviders[counter]['type'] = relation['datasourcetype'].classname;
}
this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
}*/
/* ----->
} }
} }
} }
*/
return this.organizationInfo; return this.organizationInfo;
} }
parseOrganizationNameAndUrl(organization: any): any { parseOrganizationNameAndUrl(res: any): any {
if(!res || res.organization) {
return null;
}
let organization = res.organization;
let title: {"name": string, "url": string} = {"name": "", "url": ""}; let title: {"name": string, "url": string} = {"name": "", "url": ""};
if(organization != null) { if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) { if(organization["websiteurl"]) {
title = {"name": organization.legalshortname, "url": organization.websiteurl}; title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else { } else {
title = {"name": organization.legalshortname, "url": ''}; title = {"name": organization.legalshortname, "url": ''};
@ -213,5 +134,4 @@ export class OrganizationService {
return title; return title;
} }
} }

View File

@ -103,10 +103,21 @@ export class SearchDataprovidersService {
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource']; let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult(); var result: SearchResult = new SearchResult();
if(resBody["header"]) {
result.id = resBody['header']['id'];
let canId = ParsingFunctions.parseRelCanonicalId(resBody, "datasource");
if (canId) {
result['id'] = canId;
}
result['relcanId'] = result['id'];
}
if (resBody["datasource"]) {
let resData = resBody['datasource'];
result['title'] = {"name": '', "accessMode": ''}; result['title'] = {"name": '', "accessMode": ''};
if(resData.officialname) { if(resData.officialname) {
@ -118,18 +129,10 @@ export class SearchDataprovidersService {
result['englishname'] = ""; result['englishname'] = "";
} }
result['originalId'] = resData.originalId; result['originalId'] = resData.originalId;
//result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "datasource");
if (canId) {
result['id'] = canId;
}
result['relcanId'] = result['id'];
result['type'] = this.getDataproviderType(resData); result['type'] = this.getDataproviderType(resData);
if (resData['eosctype']) { if (resData['eosctype']) {
result.entityType = resData['eosctype'].classname == "Service" ? "service" : "dataprovider"; result.entityType = resData['eosctype'].label == "Service" ? "service" : "dataprovider";
} }
let abstracts = this.parsingFunctions.parseDescription(resData.description, true); let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
@ -138,10 +141,10 @@ export class SearchDataprovidersService {
// result.description = result.description.substring(0, this.sizeOfDescription) + "..."; // result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// } // }
let typeid: string = resData['datasourcetype'] && resData['datasourcetype'].classid; let typeid: string = resData['datasourcetype'] && resData['datasourcetype'].code;
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") { if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
if(resData.hasOwnProperty('accessinfopackage')) { if(resData['accessinfopackage']) {
let OAIPMHURL: string; let OAIPMHURL: string;
if(Array.isArray(resData['accessinfopackage'])) { if(Array.isArray(resData['accessinfopackage'])) {
OAIPMHURL = resData['accessinfopackage'][0]; OAIPMHURL = resData['accessinfopackage'][0];
@ -164,64 +167,69 @@ export class SearchDataprovidersService {
result['websiteURL'] = resData.websiteurl; result['websiteURL'] = resData.websiteurl;
let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true);
result['organizations'] = res[1];
result['countries'] = res[0];
result['subjects'] = this.getDataproviderSubjects(resData); result['subjects'] = this.getDataproviderSubjects(resData);
if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
}
// Measure // Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']); result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
}
if(resBody["links"]) {
let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resBody['links'], true, true);
result['organizations'] = res[1];
result['countries'] = res[0];
}
if(resBody['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']);
}
results.push(result); results.push(result);
} }
return results; return results;
} }
getDataproviderSubjects(resData: any): string [] { getDataproviderSubjects(resData: any): string [] {
var subjects:string [] = []; var subjects:string [] = [];
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1; let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects']; let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
if(subject && subject.content) { if(subject && subject.value) {
subjects.push(subject.content); subjects.push(subject.value);
} }
} }
return subjects; return subjects;
} }
getDataproviderType(resData: any): string { getDataproviderType(resData: any): string {
if(resData.hasOwnProperty('datasourcetype') && resData['datasourcetype'].hasOwnProperty("classname")) { if(resData['datasourcetype'] && resData['datasourcetype']["label"]) {
return resData['datasourcetype'].classname; return resData['datasourcetype'].label;
} else { } else {
return ''; return '';
} }
} }
getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} { getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
if(resData.hasOwnProperty('openairecompatibility')) { if(resData['openairecompatibility']) {
return {"classid": resData['openairecompatibility'].classid, "classname": resData['openairecompatibility'].classname}; return {"classid": resData['openairecompatibility'].code, "classname": resData['openairecompatibility'].label};
} else { } else {
return {"classid": "", "classname": ""}; return {"classid": "", "classname": ""};
} }
} }
getDataproviderCountriesOrganizations(resData: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "id": string}[]] { getDataproviderCountriesOrganizations(links: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "id": string}[]] {
let countries: string[] = []; let countries: string[] = [];
let organizations: {"name": string, "id": string}[] = []; let organizations: {"name": string, "id": string}[] = [];
if(resData['rels'].hasOwnProperty("rel")) {
let countriesSet: Set<string> = new Set<string>(); let countriesSet: Set<string> = new Set<string>();
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) { for(let i=0; i<relLength; i++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel']; let relation = Array.isArray(links) ? links[i] : links;
if(relation.hasOwnProperty("to")) { if(relation["header"]) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isprovidedby" && relation['to'].type == "organization") { if(relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isprovidedby" && relation['header'].relatedRecordType == "organization") {
if(getOrganizations) { if(getOrganizations) {
let item: {"name":string, "id":string} = {"name": "", "id": ""}; let item: {"name":string, "id":string} = {"name": "", "id": ""};
//item['name'] = relation.legalname; //item['name'] = relation.legalname;
@ -233,17 +241,16 @@ export class SearchDataprovidersService {
if(!item['name']) { if(!item['name']) {
item['name'] = "[no title available]"; item['name'] = "[no title available]";
} }
item['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/relation['to'].content; item['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/relation['header'].relatedIdentifier;
organizations.push(item); organizations.push(item);
} }
if(getCountries) { if(getCountries) {
if(relation.hasOwnProperty('country') && if(relation['country'] &&
relation.country.hasOwnProperty('classname')) { relation.country.label) {
if(!countriesSet.has(relation.country.classname)) { if(!countriesSet.has(relation.country.label)) {
countriesSet.add(relation.country.classname); countriesSet.add(relation.country.label);
countries.push(relation.country.classname); countries.push(relation.country.label);
}
} }
} }
} }

View File

@ -17,26 +17,29 @@ export class SearchOrganizationsService {
constructor(private http: HttpClient ) {} constructor(private http: HttpClient ) {}
parseResultsForDeposit(data: any): {"name": string, "id": string}[] { /**
let results: {"name": string, "id": string}[] = []; * @deprecated
*/
let length = Array.isArray(data) ? data.length : 1; // parseResultsForDeposit(data: any): {"name": string, "id": string}[] {
// let results: {"name": string, "id": string}[] = [];
for(let i=0; i<length; i++) { //
let name: string = ''; // let length = Array.isArray(data) ? data.length : 1;
let id: string = ''; //
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization']; // for(let i=0; i<length; i++) {
name = resData.legalname; // let name: string = '';
if(name == '') { // let id: string = '';
name = resData.legalshortname; // let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
} // name = resData.legalname;
// if(name == '') {
id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; // name = resData.legalshortname;
// }
results.push({"name": name, "id": id}); //
} // id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
return results; //
} // results.push({"name": name, "id": id});
// }
// return results;
// }
searchOrganizations (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties):any { searchOrganizations (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties):any {
@ -94,10 +97,23 @@ export class SearchOrganizationsService {
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization']; let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult(); var result: SearchResult = new SearchResult();
if(resBody["header"]) {
result.id = resBody['header']['id'];
if(!result['id'].startsWith("openorgs____::")) {
let canId = ParsingFunctions.parseRelCanonicalId(resBody, "organization");
if(canId){
result['id'] = canId;
}
}
}
if (resBody["organization"]) {
let resData = resBody['organization'];
result['title'] = {"name": '', "accessMode": ''}; result['title'] = {"name": '', "accessMode": ''};
if(resData.legalname) { if(resData.legalname) {
@ -110,23 +126,19 @@ export class SearchOrganizationsService {
result['acronym'] = StringUtils.HTMLToString(String(resData.legalshortname)); result['acronym'] = StringUtils.HTMLToString(String(resData.legalshortname));
} }
//result['title'].url = OpenaireProperties.getsearchLinkToOrganization(); if(resData.country["label"]) {
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; result.country = resData.country.label;
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(!result['id'].startsWith("openorgs____::")) {
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "organization");
if(canId){
result['id'] = canId;
} }
} }
if(resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; if (resBody["links"]) {
let relLength = Array.isArray(resBody['links']) ? resBody['links'].length : 1;
for (let j = 0; j < relLength; j++) { for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; let relation = Array.isArray(resBody['links']) ? resBody['links'][j] : resBody['links'];
if(relation.hasOwnProperty("to")) { if(relation["header"]) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isparticipant") { if(relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isparticipant") {
if(result['projects'] == undefined) { if(result['projects'] == undefined) {
result['projects'] = new Array< result['projects'] = new Array<
{ "id": string, "acronym": string, "title": string, { "id": string, "acronym": string, "title": string,
@ -143,11 +155,12 @@ export class SearchOrganizationsService {
"code": "" "code": ""
} }
if(relation.title != 'unidentified') { // TODO: Missing projectTitle and sometimes no acronym either.
if(relation.projectTitle != 'unidentified') {
result['projects'][countProjects]['id'] = result['projects'][countProjects]['id'] =
/*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; /*OpenaireProperties.getsearchLinkToProject() + */relation['header'].relatedIdentifier;
result['projects'][countProjects]['acronym'] = relation.acronym; result['projects'][countProjects]['acronym'] = relation.acronym;
result['projects'][countProjects]['title'] = relation.title; result['projects'][countProjects]['title'] = relation.projectTitle;
result['projects'][countProjects]['code'] = relation.code; result['projects'][countProjects]['code'] = relation.code;
} else { } else {
result['projects'][countProjects]['id'] = ""; result['projects'][countProjects]['id'] = "";
@ -156,30 +169,25 @@ export class SearchOrganizationsService {
result['projects'][countProjects]['code'] = ""; result['projects'][countProjects]['code'] = "";
} }
if(relation.hasOwnProperty("funding")) { if(relation["funding"]) {
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for(let z=0; z<fundingLength; z++) { for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
if(fundingData.hasOwnProperty("funder")) { if(fundingData["funder"]) {
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname; result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
result['projects'][countProjects]['funderName'] = fundingData['funder'].name; result['projects'][countProjects]['funderName'] = fundingData['funder'].name;
} }
} }
} }
} }
} }
} }
} }
if(resData.country.hasOwnProperty("classname")) { if(resBody['pid']) {
result.country = resData.country.classname; result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']);
}
if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
} }
results.push(result); results.push(result);
@ -188,6 +196,7 @@ export class SearchOrganizationsService {
return results; return results;
} }
numOfOrganizations(url: string, properties:EnvProperties ): any { numOfOrganizations(url: string, properties:EnvProperties ): any {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)

View File

@ -127,20 +127,29 @@ export class SearchProjectsService {
}) ; }) ;
} }
parseResults(data: any): SearchResult[] { parseResults(data: any): SearchResult[] {
let results: SearchResult[] = []; let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project']; let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult(); var result: SearchResult = new SearchResult();
result.openAccessMandatePublications = (resData['oamandatepublications'])?true:false;
if(resData.hasOwnProperty("oamandatedata")) { if (resBody["header"]) {
result.openAccessMandateDatasets = (resData['oamandatedata'])?true:false; result.id = resBody['header']['id'];
}
if (resBody["project"]) {
let resData = resBody['project'];
result.openAccessMandatePublications = resData['oamandatepublications'];
if (resData["oamandatedata"]) {
result.openAccessMandateDatasets = resData['oamandatedata'];
} else { } else {
result.openAccessMandateDatasets = (resData['ecarticle29_3'])?true:false; result.openAccessMandateDatasets = resData['ecarticle29_3'];
} }
result['title'] = {"name": '', "accessMode": ''}; result['title'] = {"name": '', "accessMode": ''};
// if(resData['acronym'] != undefined && resData['acronym'] != "") { // if(resData['acronym'] != undefined && resData['acronym'] != "") {
@ -171,22 +180,58 @@ export class SearchProjectsService {
result.contribution = resData.fundedamount;//"200100"; result.contribution = resData.fundedamount;//"200100";
result.currency = resData.currency;//"EUR"; result.currency = resData.currency;//"EUR";
result.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
let abstracts = this.parsingFunctions.parseDescription(resData.summary, true); let abstracts = this.parsingFunctions.parseDescription(resData.summary, true);
result.description = abstracts; result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) { // if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "..."; // result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// } // }
if(resData['rels'].hasOwnProperty("rel")) { if (resData["funding"]) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; let fundingLength = Array.isArray(resData['funding']) ? resData['funding'].length : 1;
for (let z = 0; z < fundingLength; z++) {
let fundingData = Array.isArray(resData['funding']) ? resData['funding'][z] : resData['funding'];
if (fundingData["funder"]) {
result['funderShortname'] = fundingData['funder'].shortname;
result['funderName'] = fundingData['funder'].name;
result['funderId'] = fundingData['funder'].id;
result['jurisdiction'] = fundingData['funder']['jurisdiction']?.code;
if (fundingData['level2']) {
result['fundingLevel0'] = (fundingData['level2'] && fundingData['level2']['parent'] &&
fundingData['level2']['parent']['level1'] && fundingData['level2']['parent']['level1']['parent']
&& fundingData['level2']['parent']['level1']['parent']['level0']) ?
fundingData['level2']['parent']['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level1']) {
result['level0'] = (fundingData['level1'] && fundingData['level1']['parent'] && fundingData['level1']['parent']['level0']) ?
fundingData['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level0']) {
result['fundingLevel0'] = (fundingData['level0']) ? fundingData['level0']['name'] : "";
} else {
result['fundingLevel0'] = "";
}
break;
}
}
}
if (resData["startdate"]) {
result.startYear = resData.startdate.split('-')[0];
}
if (resData['enddate']) {
result.endYear = resData.enddate.split('-')[0];
}
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
}
if (resBody["links"]) {
let relLength = Array.isArray(resBody['links']) ? resBody['links'].length : 1;
for (let j = 0; j < relLength; j++) { for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; let relation = Array.isArray(resBody['links']) ? resBody['links'][j] : resBody['links'];
if(relation.hasOwnProperty("to")) { if (relation["header"]) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "hasparticipant") { if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasparticipant") {
if (result['organizations'] == undefined) { if (result['organizations'] == undefined) {
result['organizations'] = new Array< result['organizations'] = new Array<
{ "name": string, "id": string }>(); { "name": string, "id": string }>();
@ -197,7 +242,7 @@ export class SearchProjectsService {
result['organizations'][countOrganizations] = {"name": "", "id": ""} result['organizations'][countOrganizations] = {"name": "", "id": ""}
result['organizations'][countOrganizations]['id'] = result['organizations'][countOrganizations]['id'] =
/*OpenaireProperties.getsearchLinkToOrganization() + */relation['to'].content; /*OpenaireProperties.getsearchLinkToOrganization() + */relation['header'].relatedIdentifier;
if (relation.legalshortname) { if (relation.legalshortname) {
result['organizations'][countOrganizations]['name'] = relation.legalshortname; result['organizations'][countOrganizations]['name'] = relation.legalshortname;
} else { } else {
@ -210,65 +255,6 @@ export class SearchProjectsService {
} }
} }
} }
if(resData.hasOwnProperty("fundingtree")) {
/*let funderSet: Set<string>;
if(result['funders'] == undefined) {
result['funders'] = new Array<
{"funderShortname": string, "funderName": string}>();
funderSet = new Set<string>();
}
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
if(fundingData.hasOwnProperty("funder")) {
if(!funderSet.has(fundingData['funder'].shortname)) {
let countFunders = result['funders'].length;
result['funders'][countFunders] = {"funderShortname": "", "funderName": ""};
result['funders'][countFunders]['funderShortname'] = fundingData['funder'].shortname;
result['funders'][countFunders]['funderName'] = fundingData['funder'].name;
funderSet.add(fundingData['funder'].shortname);
}
}
}*/
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
if(fundingData.hasOwnProperty("funder")) {
result['funderShortname'] = fundingData['funder'].shortname;
result['funderName'] = fundingData['funder'].name;
result['funderId'] = fundingData['funder'].id;
result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:"";
if(fundingData['funding_level_2']){
result['fundingLevel0'] = (fundingData['funding_level_2'] && fundingData['funding_level_2']['parent'] &&
fundingData['funding_level_2']['parent']['funding_level_1'] && fundingData['funding_level_2']['parent']['funding_level_1']['parent']
&& fundingData['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])?
fundingData['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(fundingData['funding_level_1']){
result['fundingLevel0'] = (fundingData['funding_level_1'] && fundingData['funding_level_1']['parent'] && fundingData['funding_level_1']['parent']['funding_level_0'])?
fundingData['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(fundingData['funding_level_0']){
result['fundingLevel0'] = (fundingData['funding_level_0'] )?fundingData['funding_level_0']['name']:"";
}else {
result['fundingLevel0']="";
}
break;
}
}
}
if(resData.hasOwnProperty("startdate") && resData['startdate']) {
result.startYear = resData.startdate.split('-')[0];
}
if(resData.hasOwnProperty("enddate") && resData['enddate']) {
result.endYear = resData.enddate.split('-')[0];
}
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
results.push(result); results.push(result);
} }

View File

@ -149,7 +149,7 @@ export class SearchResearchResultsService {
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true); //let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true);
let url = link + "/" + this.getEntityQueryName(resultType, true); let url = link + this.getEntityQueryName(resultType, true);
url += "?format=json"; url += "?format=json";
url += "&fq=" + params; url += "&fq=" + params;
url += "&sortBy=resultdateofacceptance,descending"; url += "&sortBy=resultdateofacceptance,descending";
@ -190,78 +190,59 @@ export class SearchResearchResultsService {
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
for (let i = 0; i < length; i++) { 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'];
let resData = Array.isArray(data) ? data[i]: data;
var result: SearchResult = new SearchResult(); var result: SearchResult = new SearchResult();
if (resData['resulttype']) { try {
result.entityType = resData['resulttype']['classname']; if (resData.header['recordType']) {
result.entityType = resData.header['recordType'];
} else { } else {
result.entityType = resultType; result.entityType = resultType;
} }
result['title'] = {"name": '', "accessMode": ''}; result['title'] = {"name": '', "accessMode": ''};
result['title'].name = (resData.result['maintitle']) ? StringUtils.HTMLToString(resData.result['maintitle']) : "";
if (Array.isArray(resData['title'])) { if (resData.result['bestaccessright'] && resData.result['bestaccessright']['label']) {
for (let i = 0; i < resData['title'].length; i++) { result['title'].accessMode = resData.result['bestaccessright']['label'];
if (resData['title'][i] && resData['title'][i].content) {
if (!result.title.name || resData['title'][i].classid == "main title") {
result['title'].name = StringUtils.HTMLToString(String(resData['title'][i].content));
}
if (resData['title'][i].classid == "main title") {
break;
}
}
}
if (!result.title.name) {
result['title'].name = "";
}
// result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : "";
} else {
result['title'].name = (resData['title'] && resData['title'].content) ? StringUtils.HTMLToString(String(resData['title'].content)) : "";
}
if (resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
result['title'].accessMode = resData['bestaccessright'].classname;
} }
result.types = new Array<string>(); result.types = new Array<string>();
let types = new Set<string>(); let types = new Set<string>();
let instance; let instance;
let length = Array.isArray(resData['children']['instance']) ? resData['children']['instance'].length : 1; let length = Array.isArray(resData.result['instance']) ? resData.result['instance'].length : 1;
result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>(); result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance']; instance = Array.isArray(resData.result['instance']) ? resData.result['instance'][i] : resData.result['instance'];
this.parsingFunctions.parseTypes(result.types, types, instance); this.parsingFunctions.parseTypes(result.types, types, instance);
if(instance?.hasOwnProperty("hostedby")) { if (instance && instance["hostedby"]) {
if(instance.hasOwnProperty("webresource")) { if (instance["url"]) {
let url = Array.isArray(instance['webresource'])?instance['webresource'][0].url:instance['webresource'].url; let url = Array.isArray(instance['url']) ? instance['url'][0] : instance['url'];
if (url.includes('&amp;')) { if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&'); url = url.replace(/&amp;/gmu, '&');
} }
if(instance.hasOwnProperty("hostedby")) {
this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.title.accessMode); this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.title.accessMode);
} }
} }
} }
}
result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom); result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
// Measure // Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']); result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
/////////////////////////// Athena Code /////////////////////////// /////////////////////////// Athena Code ///////////////////////////
if (resData['pid']) { if (resData['pid']) {
if (!Array.isArray(resData['pid'])) { if (!Array.isArray(resData['pid'])) {
if (resData['pid'].classid && resData['pid'].classid == 'doi') { if (resData['pid'].typeCode && resData['pid'].typeCode == 'doi') {
if (resData['pid'].content != '' && resData['pid'].content != null) { if (resData['pid'].value != '' && resData['pid'].value != null) {
result.DOIs.push((resData['pid'].content + "").replace("https://doi.org/", "")); result.DOIs.push((resData['pid'].value + "").replace("https://doi.org/", ""));
} }
} }
} else { } else {
for (let i = 0; i < resData['pid'].length; i++) { for (let i = 0; i < resData['pid'].length; i++) {
if (resData['pid'][i].classid == 'doi') { if (resData['pid'][i].typeCode == 'doi') {
if (resData['pid'][i].content != '' && resData['pid'][i].content != null && resData['pid'][i].content) { if (resData['pid'][i].value != '' && resData['pid'][i].value != null && resData['pid'][i].value) {
result.DOIs.push((resData['pid'][i].content + "").replace("https://doi.org/", "")); result.DOIs.push((resData['pid'][i].value + "").replace("https://doi.org/", ""));
} }
} }
} }
@ -269,17 +250,17 @@ export class SearchResearchResultsService {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']); result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
} }
/////////////////////////// Athena Code /////////////////////////// /////////////////////////// Athena Code ///////////////////////////
if (resData['programmingLanguage'] && resData['programmingLanguage'] != null) { if (resData.result['programmingLanguage'] && resData.result['programmingLanguage'] != null) {
result.programmingLanguages = new Array<string>(); result.programmingLanguages = new Array<string>();
if (!Array.isArray(resData['programmingLanguage'])) { if (!Array.isArray(resData.result['programmingLanguage'])) {
if (resData['programmingLanguage'].classname != "Undetermined" && resData['programmingLanguage'].classname) { if (resData.result['programmingLanguage'] != "Undetermined" && resData.result['programmingLanguage']) {
result.programmingLanguages.push(resData['programmingLanguage'].classname); result.programmingLanguages.push(resData.result['programmingLanguage']);
} }
} else { } else {
for (let i = 0; i < resData['programmingLanguage'].length; i++) { for (let i = 0; i < resData.result['programmingLanguage'].length; i++) {
if (resData['programmingLanguage'][i].classname != "Undetermined" && resData['programmingLanguage'][i].classname) { if (resData.result['programmingLanguage'][i] != "Undetermined" && resData.result['programmingLanguage'][i]) {
result.programmingLanguages.push(resData['programmingLanguage'][i].classname); result.programmingLanguages.push(resData.result['programmingLanguage'][i]);
} }
} }
} }
@ -289,86 +270,89 @@ export class SearchResearchResultsService {
result.languages = new Array<string>(); result.languages = new Array<string>();
if (!Array.isArray(resData['language'])) { if (!Array.isArray(resData['language'])) {
if (resData['language'].classname != "Undetermined" && resData['language'].classname) { if (resData['language'].label != "Undetermined" && resData['language'].label) {
result.languages.push(resData['language'].classname); result.languages.push(resData['language'].label);
} }
} else { } else {
for (let i = 0; i < resData['language'].length; i++) { for (let i = 0; i < resData['language'].length; i++) {
if (resData['language'][i].classname != "Undetermined" && resData['language'][i].classname) { if (resData['language'][i].label != "Undetermined" && resData['language'][i].label) {
result.languages.push(resData['language'][i].classname); result.languages.push(resData['language'][i].label);
} }
} }
} }
} }
if (resData['country'] && resData['country'] != null) { if (resData.result['country'] && resData.result['country'] != null) {
result.countriesForResults = new Array<string>(); result.countriesForResults = new Array<string>();
if (!Array.isArray(resData['country'])) { if (!Array.isArray(resData.result['country'])) {
if (resData['country'].classname != "Undetermined" && resData['country'].classname) { if (resData.result['country'].label != "Undetermined" && resData.result['country'].label) {
result.countriesForResults.push(resData['country'].classname); result.countriesForResults.push(resData.result['country'].label);
} }
} else { } else {
for (let i = 0; i < resData['country'].length; i++) { for (let i = 0; i < resData.result['country'].length; i++) {
if (resData['country'][i].classname != "Undetermined" && resData['country'][i].classname) { if (resData.result['country'][i].label != "Undetermined" && resData.result['country'][i].label) {
result.countriesForResults.push(resData['country'][i].classname); result.countriesForResults.push(resData.result['country'][i].label);
} }
} }
} }
} }
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; result['id'] = resData['header']['id'];
result['objId'] = result['id']; result['objId'] = result['id'];
//TODO canID
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result"); let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result");
if (canId) { if (canId) {
result['id'] = canId; result['id'] = canId;
} }
result['relcanId'] = result['id']; result['relcanId'] = result['id'];
if (resData['links']) {
if (resData['rels'].hasOwnProperty("rel")) { let relLength = Array.isArray(resData['links']) ? resData['links'].length : 1;
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
for (let j = 0; j < relLength; j++) { for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; let relation = Array.isArray(resData['links']) ? resData['links'][j] : resData['links'];
if (relation.hasOwnProperty("to")) { if (relation['header']['relationClass'] && relation['header']['relationClass'].toLowerCase() == "isproducedby") {
if (relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
result['projects'] = this.parseProjects(result['projects'], relation); result['projects'] = this.parseProjects(result['projects'], relation);
} }
} // }
} }
} }
if (resData.hasOwnProperty("creator") && resData['creator'] != null) { if (resData['result']["author"]) {
if (result['authors'] == undefined) { if (result['authors'] == undefined) {
result['authors'] = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>(); result['authors'] = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
} }
let authors = resData['creator']; let authors = resData['result']['author'];
let length = Array.isArray(authors) ? authors.length : 1; 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; let author = Array.isArray(authors) ? authors[i] : authors;
if (author) { if (author) {
if (author.orcid) { let pids = author.pid?author.pid:[];
author.orcid = author.orcid.toUpperCase(); for(let pid of pids) {
if (pid.typeCode == 'orcid') {
author.orcid = pid.value.toUpperCase();
break;
} else if (pid.typeCode == "orcid_pending") {
author.orcid_pending = pid.value.toUpperCase();
} }
if (author.orcid_pending) {
author.orcid_pending = author.orcid_pending.toUpperCase();
} }
/* The same author with the same rank if it */
if(result['authors'][author.rank] && result['authors'][author.rank].fullName == author.content) { if (result['authors'][author.rank] && result['authors'][author.rank].fullName == author.fullName) {
if (!author.orcid && result['authors'][author.rank].orcid) { if (!author.orcid && result['authors'][author.rank].orcid) {
author.orcid = result['authors'][author.rank].orcid; author.orcid = result['authors'][author.rank].orcid;
} else if (!author.orcid_pending && result['authors'][author.rank].orcid_pending) { } else if (!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
author.orcid_pending = result['authors'][author.rank].orcid_pending; author.orcid_pending = result['authors'][author.rank].orcid_pending;
} }
} }
result['authors'][author.rank] = { result['authors'][author.rank] = {
"fullName": author.content, "fullName": author.fullname,
"orcid": author.orcid, "orcid": author.orcid? author.orcid: "",
"orcid_pending": author.orcid_pending "orcid_pending": author.orcid_pending ? author.orcid_pending : ""
}; };
} }
} }
@ -377,39 +361,39 @@ export class SearchResearchResultsService {
}); });
} }
var date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer var date: string = (resData['result'].publicationdate ? resData['result'].publicationdate : '') + ''; // transform to string in case it is an integer
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
let abstracts = this.parsingFunctions.parseDescription(resData['result'].description, true);
let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
result.description = abstracts; result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) { // if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "..."; // result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// } // }
if (resData.embargoenddate && resData.embargoenddate != '') { if (resData['result'].embargoenddate && resData['result'].embargoenddate != '') {
result.embargoEndDate = Dates.getDate(resData.embargoenddate); result.embargoEndDate = Dates.getDate(resData['result'].embargoenddate);
} }
if (!Array.isArray(resData.publisher)) { if (!Array.isArray(resData['result'].publisher)) {
result.publisher = resData.publisher; result.publisher = resData['result'].publisher;
} else { } else {
for (let i = 0; i < resData.publisher.length; i++) { for (let i = 0; i < resData.publisher['result'].length; i++) {
if (result.publisher != undefined) { if (result.publisher != undefined) {
result.publisher += ', ' + resData['publisher'][i]; result.publisher += ', ' + resData['result']['publisher'][i];
} else { } else {
result.publisher = resData['publisher'][i]; result.publisher = resData['result']['publisher'][i];
} }
} }
} }
//todo DOUBLEcheck with connect
if (resData['context'] != null) { if (resData['context'] != null) {
result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context'])); result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context']));
} }
if (resData.dateofacceptance && resData.dateofacceptance != null) { if (resData['result'].publicationdate && resData['result'].publicationdate != null) {
let date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer let date: string = (resData['result'].publicationdate ? resData['result'].publicationdate : '') + ''; // transform to string in case it is an integer
result.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; result.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
result.dateofacceptance = resData.dateofacceptance ? Dates.getDate(resData.dateofacceptance) : null; result.dateofacceptance = resData['result'].publicationdate ? Dates.getDate(resData['result'].publicationdate) : null;
} }
if (resData.journal && resData.journal != null) { if (resData['result'].journal && resData['result'].journal != null) {
result.journal = { result.journal = {
"journal": "", "journal": "",
"issn": "", "issn": "",
@ -420,14 +404,14 @@ export class SearchResearchResultsService {
"start_page": "", "start_page": "",
"end_page": "" "end_page": ""
} }
result.journal['journal'] = resData.journal.content; result.journal['journal'] = resData['result'].journal.name;
result.journal['issn'] = resData.journal.issn; result.journal['issn'] = resData['result'].journal.issnPrinted;
result.journal['lissn'] = resData.journal.lissn; result.journal['lissn'] = resData['result'].journal.issnLinking;
result.journal['eissn'] = resData.journal.eissn; result.journal['eissn'] = resData['result'].journal.issnOnline;
result.journal['issue'] = resData.journal.iss; result.journal['issue'] = resData['result'].journal.iss;
result.journal['volume'] = resData.journal.vol; result.journal['volume'] = resData['result'].journal.vol;
result.journal['start_page'] = resData.journal.sp; result.journal['start_page'] = resData['result'].journal.sp;
result.journal['end_page'] = resData.journal.ep; result.journal['end_page'] = resData['result'].journal.ep;
} }
result.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom( result.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
@ -435,18 +419,21 @@ export class SearchResearchResultsService {
result['journal'] ? result['journal'].journal : null, result.identifiers); result['journal'] ? result['journal'].journal : null, result.identifiers);
if(resData.hasOwnProperty("publiclyfunded") && resData.publiclyfunded) { if (resData['result'].publiclyFunded) {
result.publiclyFunded = resData.publiclyfunded; result.publiclyFunded = resData['result'].publiclyFunded;
} }
if((resData.hasOwnProperty("isgreen") && resData.isgreen) if (resData['result'].isGreen
|| (resData.hasOwnProperty("openaccesscolor") && resData.openaccesscolor) || resData['result'].openAccessColor
|| (resData.hasOwnProperty("isindiamondjournal") && resData.isindiamondjournal)) { || resData['result'].isInDiamondJournal) {
result.oaRoutes = { result.oaRoutes = {
"green": resData.isgreen, "green": resData['result'].isGreen,
"oaColor": resData.openaccesscolor, "oaColor": resData['result'].openAccessColor,
"isInDiamondJournal":resData.isindiamondjournal "isInDiamondJournal": resData['result'].isInDiamondJournal
}; };
} }
}catch (e){
console.error(e)
}
results.push(result); results.push(result);
} }
@ -478,10 +465,10 @@ export class SearchResearchResultsService {
"code": "" "code": ""
}; };
if (relation.title != 'unidentified') { if (relation.projectTitle != 'unidentified') {
projects[countProjects]['id'] = relation['to'].content; projects[countProjects]['id'] = relation['header']['identifier'];
projects[countProjects]['acronym'] = relation.acronym; projects[countProjects]['acronym'] = relation.acronym;
projects[countProjects]['title'] = relation.title; projects[countProjects]['title'] = relation.projectTitle;
projects[countProjects]['code'] = relation.code; projects[countProjects]['code'] = relation.code;
} else { } else {
projects[countProjects]['id'] = ""; projects[countProjects]['id'] = "";
@ -490,13 +477,13 @@ export class SearchResearchResultsService {
projects[countProjects]['code'] = ""; projects[countProjects]['code'] = "";
} }
if (relation.hasOwnProperty("funding")) { if (relation["funding"]) {
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for (let z = 0; z < fundingLength; z++) { for (let z = 0; z < fundingLength; z++) {
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
if (fundingData.hasOwnProperty("funder")) { if (fundingData["funder"]) {
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname; projects[countProjects]['funderShortname'] = fundingData['funder'].shortname;
projects[countProjects]['funderName'] = fundingData['funder'].name; projects[countProjects]['funderName'] = fundingData['funder'].name;
} }
@ -508,7 +495,7 @@ export class SearchResearchResultsService {
parseRefineResults(id: string, data: any): any { parseRefineResults(id: string, data: any): any {
var results: any = []; var results: any = [];
if (data.hasOwnProperty("resulthostingdatasource")) { if (data["resulthostingdatasource"]) {
let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1; let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
@ -620,7 +607,7 @@ export class SearchResearchResultsService {
.pipe(map(res => res['meta']['total'])); .pipe(map(res => res['meta']['total']));
} }
fetchByDOIs(DOIs:string[],query:string): any { fetchByDOIs(DOIs:string[],query:string): any {
let url = properties.searchAPIURLLAst + "/researchProducts/byDoi?type=publications" + (query?query:""); let url = properties.searchAPIURLLAst + "researchProducts/byDoi?type=publications" + (query?query:"");
return this.http.post(url, {doiArray: DOIs}) return this.http.post(url, {doiArray: DOIs})
.pipe(map(res => [res['meta'].total, this.parseResults("result", res['results'], properties), RefineResultsUtils.parse(res['refineResults'], null, "publication")])); .pipe(map(res => [res['meta'].total, this.parseResults("result", res['results'], properties), RefineResultsUtils.parse(res['refineResults'], null, "publication")]));
} }

View File

@ -201,45 +201,46 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
} }
private getTitle(result: any): String[] { private getTitle(result: any): String[] {
const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null); const title = _.get(result, "result.maintitle", null);
let return_title; let return_title;
if(title && Array.isArray(title) ){ if(title){
for(let i=0; i<title.length; i++) { return_title = String(title);
if(title[i] && title[i].content) { } else {
if(!return_title || title[i].classid == "main title") { const other_titles = _.get(result, "result.otherTitles", null);
return_title = String(title[i].content); if(other_titles && Array.isArray(other_titles) ){
} for(let i=0; i<other_titles.length; i++) {
if(title[i].classid == "main title") { if(other_titles[i] && other_titles[i]) {
return_title = String(other_titles[i]);
break; break;
} }
}
} }
} }
if(!return_title) { if(!return_title) {
return_title = ""; return_title = "";
} }
return return_title; return return_title;
// return (title[0] && title[0].content)?title[0].content:"";
}else{
return (title && title.content)?title.content:"";
} }
} // TODO: Returns String[], but the actual value is just a string
private getSubTitle(result: any): String[] { private getSubTitle(result: any): String[] {
const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null); const title = _.get(result, "result.otherTitles", null);
if(title && Array.isArray(title) ){ if(title && Array.isArray(title) ){
if(title[1] && title[1].classid == "subtitle") { for(let i=0; i<title.length; i++) {
return title[1].content; if(title[i] && title[i]) {
return title[i];
}
} }
} }
return null; return null;
} }
private getISSN(result: any): String[] { private getISSN(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.journal.issn", null); const item = _.get(result, "result.journal.issnPrinted", null);
if (!item) return null; if (!item) return null;
return [item as String]; return [item as String];
} }
private getDescription(result: any): String[] { private getDescription(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null); const item = _.get(result, "result.description", null);
if (!item) return [ "" + this.getTitle(result)]; if (!item) return [ "" + this.getTitle(result)];
let parsing = new ParsingFunctions(); let parsing = new ParsingFunctions();
let abstracts = parsing.parseDescription(item, true); let abstracts = parsing.parseDescription(item, true);
@ -247,29 +248,30 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
} }
private getDateCreated(result: any): String[] { private getDateCreated(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.dateofacceptance", null); const item = _.get(result, "result.publicationdate", null);
if (!item) return null; if (!item) return null;
return [item as String]; return [item as String];
} }
private getLicense(result: any): License[] { private getLicense(result: any): License[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.bestaccessright", null); const item = _.get(result, "result.bestaccessright", null);
if (!item) return null; if (!item) return null;
if (!_.has(item, "classid")) return null; if (!_.has(item, "code")) return null;
if (!_.has(item, "classname")) return null; if (!_.has(item, "label")) return null;
if (!_.has(item, "schemeid")) return null; // if (!_.has(item, "schemeid")) return null;
return [{ return [{
title: [_.get(item, "classname")], title: [_.get(item, "label")],
identifier: [{ identifier: [{
id: _.get(item, "classid"), id: _.get(item, "code"),
schema: _.get(item, "schemeid") schema: "dnet:access_modes"
// schema: _.get(item, "schemeid")
}] }]
}]; }];
} }
private getIdentifier(result: any): Identifier[] { private getIdentifier(result: any): Identifier[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.pid", null); const item = _.get(result, "result.pid", null);
if (!item) return null; if (!item) return null;
const array = new Array<Identifier>(); const array = new Array<Identifier>();
if (Array.isArray(item)) { if (Array.isArray(item)) {
@ -288,45 +290,58 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
} }
private getSingleIdentifier(item: any): Identifier { private getSingleIdentifier(item: any): Identifier {
if (!_.has(item, "classname")) return null; if (!_.has(item, "type")) return null;
if (!_.has(item, "content")) return null; if (!_.has(item, "value")) return null;
return { return {
schema: _.get(item, "classname"), schema: _.get(item, "type"),
id: _.get(item, "content") id: _.get(item, "value")
}; };
} }
private getSameAs(result: any): String[] { private getSameAs(result: any): String[] {
const instances = _.get(result, "result.metadata.oaf:entity.oaf:result.children.instance", null); const relations = _.get(result, "links", null);
if (!instances) return null; if (!relations) return null;
if (!Array.isArray(instances)) return null;
const array = new Array<String>(); const array = new Array<String>();
if(Array.isArray(relations) ) {
for (let i = 0; i < relations.length; i++) {
let relation = relations[i];
if (relation && relation['header'] && relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
const instances = relation.instances;
if(instances) {
console.log("instances");
const instanceArray = instances as Array<any>; const instanceArray = instances as Array<any>;
for (var i = 0; i < instanceArray.length; i += 1) { for (var j = 0; j < instanceArray.length; j += 1) {
const webresources = _.get(instanceArray[i], "webresource", null); const webresources = _.get(instanceArray[j], "url", null);
console.log(webresources);
if (!webresources) continue; if (!webresources) continue;
if (Array.isArray(webresources)) { if (Array.isArray(webresources)) {
const webresourceArray = webresources as Array<any>; const webresourceArray = webresources as Array<any>;
for (var q = 0; q < webresourceArray.length; q += 1) { for (var q = 0; q < webresourceArray.length; q += 1) {
const url = _.get(webresourceArray[q], "url", null); const url = webresourceArray[q];
console.log(url);
if (!url) continue; if (!url) continue;
console.log(url);
array.push(url as String); array.push(url as String);
} }
} }
else { else {
const url = _.get(webresources, "url", null); const url = webresources;
if (!url) continue; if (!url) continue;
console.log(url);
array.push(url as String); array.push(url as String);
} }
} }
}
}
}
}
if (array.length == 0) return null; if (array.length == 0) return null;
return array; return array;
} }
private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] { private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] {
const subjects = _.get(result, "result.metadata.oaf:entity.oaf:result.subject", null); const subjects = _.get(result, "result.subject", null);
if (!subjects) return null; if (!subjects) return null;
if (!Array.isArray(subjects)) return null; if (!Array.isArray(subjects)) return null;
@ -334,10 +349,10 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
const subjectArray = subjects as Array<any>; const subjectArray = subjects as Array<any>;
for (var i = 0; i < subjectArray.length; i += 1) { for (var i = 0; i < subjectArray.length; i += 1) {
const classid = _.get(subjectArray[i], "classid", null); const classid = _.get(subjectArray[i], "typeCode", null);
if(classification && classid !==classification) continue; if(classification && classid !==classification) continue;
const sub = _.get(subjectArray[i], "content", null); const sub = _.get(subjectArray[i], "value", null);
if (!sub) return null; if (!sub) return null;
array.push(sub as String); array.push(sub as String);
@ -347,7 +362,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
} }
private getCreator(result: any): Person[] { private getCreator(result: any): Person[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.creator", null); const item = _.get(result, "result.author", null);
if (!item) return null; if (!item) return null;
const array = new Array<Person>(); const array = new Array<Person>();
if (Array.isArray(item)) { if (Array.isArray(item)) {
@ -366,14 +381,15 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
} }
private getSinglePerson(item: any): Person { private getSinglePerson(item: any): Person {
if (!_.has(item, "surname") && !_.has(item, "name") && !_.has(item, "content")) return null; if (!_.has(item, "surname") && !_.has(item, "name") && !_.has(item, "fullname")) return null;
return { return {
familyName: _.get(item, "surname", null), familyName: _.get(item, "surname", null),
givenName: _.get(item, "name", null), givenName: _.get(item, "name", null),
name: _.get(item, "content", null) name: _.get(item, "fullname", null)
}; };
} }
// TODO: extraInfo missing - should be references, not citations
private getCitation(result: any): Citation[] { private getCitation(result: any): Citation[] {
const item = _.get(result, "result.metadata.oaf:entity.extraInfo.citations.citation", null); const item = _.get(result, "result.metadata.oaf:entity.extraInfo.citations.citation", null);
if (!item) return null; if (!item) return null;

View File

@ -35,7 +35,7 @@ export class DataProviderInfo {
subjects: string[]; subjects: string[];
jurisdiction: string; jurisdiction: string;
thematic: boolean; thematic: boolean;
contentpolicy: string; contentpolicies: 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

View File

@ -84,7 +84,7 @@ export class EntitiesAutocompleteComponent {
@Input() public funderId:string; @Input() public funderId:string;
@Input() public entityType:string ; @Input() public entityType:string ;
@Input() public depositType:string ; // @Input() public depositType:string ;
public results = 0; public results = 0;
public focus:boolean = false; public focus:boolean = false;
constructor (public _search:EntitiesSearchService, private myElement: ElementRef) { constructor (public _search:EntitiesSearchService, private myElement: ElementRef) {
@ -117,17 +117,17 @@ export class EntitiesAutocompleteComponent {
}),); }),);
}else */ }else */
if(this.entityType == "organization" && this.depositType ){ // if(this.entityType == "organization" && this.depositType ){
this.filtered = this.searchTermStream.pipe( // this.filtered = this.searchTermStream.pipe(
debounceTime(300),distinctUntilChanged(), // debounceTime(300),distinctUntilChanged(),
switchMap((term: string) => { // switchMap((term: string) => {
var results = this._search.searchByDepositType(term, this.depositType, this.properties); // var results = this._search.searchByDepositType(term, this.depositType, this.properties);
this.showLoading = false; // this.showLoading = false;
this.results = results.length; // this.results = results.length;
return results; // return results;
}),); // }),);
//
}else{ // }else{
this.filtered = this.searchTermStream.pipe( this.filtered = this.searchTermStream.pipe(
debounceTime(300), debounceTime(300),
@ -140,7 +140,7 @@ export class EntitiesAutocompleteComponent {
}),); }),);
this.getSelectedNameFromGivenId(); this.getSelectedNameFromGivenId();
} // }
} }
ngOnDestroy(){ ngOnDestroy(){

View File

@ -7,6 +7,8 @@ import {throwError} from 'rxjs';
import{EnvProperties} from '../properties/env-properties'; import{EnvProperties} from '../properties/env-properties';
import {catchError, map} from "rxjs/operators"; import {catchError, map} from "rxjs/operators";
import {StringUtils} from "../string-utils.class";
@Injectable() @Injectable()
export class EntitiesSearchService { export class EntitiesSearchService {
public ready:boolean = false; public ready:boolean = false;
@ -40,79 +42,79 @@ export class EntitiesSearchService {
}*/ }*/
// not used // not used
/** // /**
* @deprecated // * @deprecated
*/ // */
searchByDepositType(keyword:string, DepositType:string, properties:EnvProperties ):any { // searchByDepositType(keyword:string, DepositType:string, properties:EnvProperties ):any {
this.ready = false; // this.ready = false;
//
let link = properties.searchResourcesAPIURL; // let link = properties.searchResourcesAPIURL;
//
let url = link+"?query="; // let url = link+"?query=";
if(keyword!= null && keyword != '' ) { // if(keyword!= null && keyword != '' ) {
/*url += "((oaftype exact organization and deletedbyinference=false and "+ // /*url += "((oaftype exact organization and deletedbyinference=false and "+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+ // "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " + // " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " + // // "and " + this.quote(params) + " " +
"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/ // "and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/
//
// in search there is this filter: // // in search there is this filter:
//reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=* // //reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*
//
//
//url += "((oaftype exact organization and deletedbyinference=false )"+ // //url += "((oaftype exact organization and deletedbyinference=false )"+
url += "((oaftype exact organization and deletedbyinference=false and"+ // url += "((oaftype exact organization and deletedbyinference=false and"+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+ // "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " + // " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " + // // "and " + this.quote(params) + " " +
//"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) " // //"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
")"; // ")";
} // }
//
url += "&page=0&size=10"; // url += "&page=0&size=10";
url += "&format=json"; // url += "&format=json";
//
// let url = properties.searchAPIURLLAst+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json"; // // let url = properties.searchAPIURLLAst+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url).toPromise() // return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url).toPromise()
.then(request => // .then(request =>
{ // {
//request = request.json().results; // //request = request.json().results;
request = request['results']; // request = request['results'];
//console.log(request); // //console.log(request);
this.ready = true; // this.ready = true;
return this.parse(request,"oaf:organization","organization"); // return this.parse(request,"oaf:organization","organization");
}).catch((ex) => { // }).catch((ex) => {
console.error('An error occured', ex); // console.error('An error occured', ex);
return [{id:'-2',label:'Error'}]; // return [{id:'-2',label:'Error'}];
}); // });
} // }
searchByType(keyword:string,type:string, properties:EnvProperties ){ searchByType(keyword:string,type:string, properties:EnvProperties ){
if (type == "project"){ if (type == "project"){
return this.searchEntity(keyword,"projects","oaf:project","project", properties); return this.searchEntity(keyword,"projects","project","project", properties);
}else if (type == "dataset"){ }else if (type == "dataset"){
return this.searchEntity(keyword,"datasets","oaf:result","dataset", properties); return this.searchEntity(keyword,"datasets","result","dataset", properties);
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){ }else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
return this.searchEntity(keyword,"datasources","oaf:datasource","datasource", properties); return this.searchEntity(keyword,"datasources","datasource","datasource", properties);
}else if (type == "publication"){ }else if (type == "publication"){
return this.searchEntity(keyword,"publications","oaf:result","publication", properties); return this.searchEntity(keyword,"publications","result","publication", properties);
}else if (type == "organization"){ }else if (type == "organization"){
return this.searchEntity(keyword,"organizations","oaf:organization","organization", properties); return this.searchEntity(keyword,"organizations","organization","organization", properties);
} }
} }
fetchByType(id:string,type:string, properties:EnvProperties ){ fetchByType(id:string,type:string, properties:EnvProperties ){
if (type == "project"){ if (type == "project"){
return this.fetchEntity(id,"projects","oaf:project","project", properties); return this.fetchEntity(id,"projects","project","project", properties);
}else if (type == "dataset"){ }else if (type == "dataset"){
return this.fetchEntity(id,"datasets","oaf:result","dataset", properties); return this.fetchEntity(id,"datasets","result","dataset", properties);
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){ }else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
return this.fetchEntity(id,"datasources","oaf:datasource","datasource", properties); return this.fetchEntity(id,"datasources","datasource","datasource", properties);
}else if (type == "publication"){ }else if (type == "publication"){
return this.fetchEntity(id,"publications","oaf:result","publication", properties); return this.fetchEntity(id,"publications","result","publication", properties);
}else if (type == "organization"){ }else if (type == "organization"){
return this.fetchEntity(id,"organizations","oaf:organization","organization", properties); return this.fetchEntity(id,"organizations","organization","organization", properties);
} }
@ -174,105 +176,99 @@ private fetch (link,id,oafEntityType,type, properties:EnvProperties ){
} }
private parse(data: any,oafEntityType:string, type:string){ private parse(data: any,oafEntityType:string, type:string){
var array:any =[] let results: any[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity'][oafEntityType] : data['result']['metadata']['oaf:entity'][oafEntityType]; let resBody = Array.isArray(data) ? data[i] : data;
var result: any = {};
var value:any={} ; if (resBody["header"]) {
if(resData['title']){ result.id = resBody['header']['id'];
}
if (resBody[oafEntityType]) {
let resData = resBody[oafEntityType];
if (oafEntityType == "result") {
result.result = resData;
}
if (resData['mainTitle']) { // result
result.label = StringUtils.HTMLToString(String(resData['mainTitle']));
} else if (resData['title']) { // project
if (Array.isArray(resData['title'])) { if (Array.isArray(resData['title'])) {
value.label = resData['title'][0]; result.label = StringUtils.HTMLToString(String(resData['title'][0]));
} else { } else {
value.label = resData['title']; result.label = StringUtils.HTMLToString(String(resData['title']));
}
if(oafEntityType=="oaf:result"){
value.label = value.label.content;
value.result = resData;
}
}else if(resData["fullname"]){
if(Array.isArray(resData["fullname"])) {
value.label = resData["fullname"][0];
} else {
value.label = resData["fullname"];
}
}else if(resData["legalname"]){
if(Array.isArray(resData["legalname"])) {
value.label = resData["legalname"][0];
} else {
value.label = resData["legalname"];
} }
// } else if(resData["fullname"]) {
// if(Array.isArray(resData["fullname"])) {
// value.label = resData["fullname"][0];
// } else {
// value.label = resData["fullname"];
// }
} else if (resData["legalname"]) { // organization
result.label = resData["legalname"];
if (resData["legalshortname"]) { if (resData["legalshortname"]) {
result.label += " (" + resData["legalshortname"] + ")";
if(Array.isArray(resData["legalshortname"])) {
value.label += " (" + resData["legalshortname"][0] +")";
} else {
value.label += " (" + resData["legalshortname"] +")";
} }
} else if (resData["officialname"]) { // datasource
result.label = resData["officialname"];
} else if(resData['otherTitles']) {
result.label = StringUtils.HTMLToString(String(resData['otherTitles'][0]));
} }
}else if(resData["officialname"]){
if(Array.isArray(resData["officialname"])) {
value.label = resData["officialname"][0];
} else {
value.label = resData["officialname"];
}
}
value.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if (type == "project") { if (type == "project") {
value.projectAcronym = resData['acronym']; result.projectAcronym = resData['acronym'] ? resData['acronym'] : "";
value.projectName = value.label; result.projectName = result.label;
value.endDate = null; result.endDate = resData.enddate ? resData.enddate.split('-')[0] : null;
value.startDate = null; result.startDate = resData.startdate ? resData.startdate.split('-')[0] : null;
value.funderId = ""; result.funderId = "";
value.funderName = ""; result.funderName = "";
value.jurisdiction = ""; result.jurisdiction = "";
value.fundingLevel0 = ""; result.fundingLevel0 = "";
value.code = resData['code']; result.code = resData['code'];
if(resData['fundingtree'] && resData['fundingtree']['funder']){ if(resData['funding'] && type == "project") {
value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:""; let fundingLength = Array.isArray(resData['funding']) ? resData['funding'].length : 1;
value.funderName = (resData['fundingtree']['funder']['name'] )?resData['fundingtree']['funder']['name']:"";
value.funderShortName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:""; for (let z = 0; z < fundingLength; z++) {
value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:"";
if(resData['fundingtree']['funding_level_2']){ let fundingData = Array.isArray(resData['funding']) ? resData['funding'][z] : resData['funding'];
value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] && if (fundingData["funder"]) {
resData['fundingtree']['funding_level_2']['parent']['funding_level_1'] && resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent'] result['funderId'] = fundingData['funder'].id ? fundingData['funder'].id : "";
&& resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])? result['funderName'] = fundingData['funder'].name ? fundingData['funder'].name : "";
resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:""; result['funderShortName'] = fundingData['funder'].shortname ? fundingData['funder'].shortname : "";
}else if(resData['fundingtree']['funding_level_1']){ result['jurisdiction'] = (fundingData['funder']['jurisdiction'] && fundingData['funder']['jurisdiction'].code) ? fundingData['funder']['jurisdiction'].code : "";
value.fundingLevel0 = (resData['fundingtree']['funding_level_1'] && resData['fundingtree']['funding_level_1']['parent'] && resData['fundingtree']['funding_level_1']['parent']['funding_level_0'])?
resData['fundingtree']['funding_level_1']['parent']['funding_level_0']['name']:""; if (fundingData['level2']) {
}else if(resData['fundingtree']['funding_level_0']){ result['fundingLevel0'] = (fundingData['level2'] && fundingData['level2']['parent'] &&
value.fundingLevel0 = (resData['fundingtree']['funding_level_0'] )?resData['fundingtree']['funding_level_0']['name']:""; fundingData['level2']['parent']['level1'] && fundingData['level2']['parent']['level1']['parent']
&& fundingData['level2']['parent']['level1']['parent']['level0']) ?
fundingData['level2']['parent']['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level1']) {
result['level0'] = (fundingData['level1'] && fundingData['level1']['parent'] && fundingData['level1']['parent']['level0']) ?
fundingData['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level0']) {
result['fundingLevel0'] = (fundingData['level0']) ? fundingData['level0']['name'] : "";
} else { } else {
value.fundingLevel0=""; result['fundingLevel0'] = "";
}
break;
}
}
}
} }
} }
if(resData.hasOwnProperty("startdate")) { results.push(result);
value.startDate = resData.startdate.split('-')[0];
}
if(resData.hasOwnProperty("enddate")) {
value.endDate = resData.enddate.split('-')[0];
} }
if(results.length == 0){
results.push({id:'-1',label:'No results found'});
} }
// console.info("add:"+value.label+" "+value.id);
array.push(value); return results;
}
if(array.length == 0){
array.push({id:'-1',label:'No results found'});
}
//console.info("Parsing results.... Size:"+array.length);
return array;
} }
private handleError (error: HttpErrorResponse) { private handleError (error: HttpErrorResponse) {

View File

@ -103,9 +103,8 @@ export let commonDev: EnvProperties = {
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/", statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/", statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/",
claimsAPIURL: "http://dl170.madgik.di.uoa.gr:19780/uoa-claims-service/claimsService/", claimsAPIURL: "http://dl170.madgik.di.uoa.gr:19780/uoa-claims-service/claimsService/",
searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", searchAPIURLLAst: "http://beta.services.openaire.eu:8480/test/rest/v2/api/",
searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", searchResourcesAPIURL: "http://beta.services.openaire.eu:8480/test/rest/v2/api/resources",
openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=", openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=",
csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports", csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports",
orcidAPIURL: "http://dl170.madgik.di.uoa.gr:19480/uoa-orcid-service/", orcidAPIURL: "http://dl170.madgik.di.uoa.gr:19480/uoa-orcid-service/",
@ -123,7 +122,7 @@ export let commonDev: EnvProperties = {
contextsAPI: "https://dev-openaire.d4science.org/openaire/context", contextsAPI: "https://dev-openaire.d4science.org/openaire/context",
communityAPI: "https://dev-openaire.d4science.org/openaire/community/", communityAPI: "https://dev-openaire.d4science.org/openaire/community/",
lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows", lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows",
widgetLink: "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=", widgetLink: "http://scoobydoo.di.uoa.gr/joomla/index.php?option=com_openaire&view=widget&format=raw&projectId=",
claimsInformationLink: "https://www.openaire.eu/linking-beta", claimsInformationLink: "https://www.openaire.eu/linking-beta",
indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/", indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/",
admins: ['kostis30fylloy@gmail.com', 'alexandros.martzios@athenarc.gr', 'kgalouni@di.uoa.gr'], admins: ['kostis30fylloy@gmail.com', 'alexandros.martzios@athenarc.gr', 'kgalouni@di.uoa.gr'],

View File

@ -414,7 +414,7 @@ export class SearchFieldsBase {
{type: "refine", title: "", values: ["projectoamandatepublications"]} {type: "refine", title: "", values: ["projectoamandatepublications"]}
]; ];
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle", "projectkeywords", public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle",
"funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id", "funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
"projectstartdate", "projectenddate", "projectstartdate", "projectenddate",
"projectcode_nt", "relorganizationid", "collectedfromdatasourceid"]; "projectcode_nt", "relorganizationid", "collectedfromdatasourceid"];
@ -572,12 +572,12 @@ export class SearchFieldsBase {
public DATASOURCE_STATIC_FIELDS = ["eosctype"]; public DATASOURCE_STATIC_FIELDS = ["eosctype"];
// add Collected From Filter "collectedfromname" // add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes", public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname", public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages", "datasourceenglishname", "datasourcetypename", "datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"]; "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = { public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, ["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
@ -744,7 +744,7 @@ export class SearchFieldsBase {
{"name": "country", "equalityOperator": " exact "}, {"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "} {"name": "datasourcesubject", "equalityOperator": " all "}
]; ];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"]; public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = { public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: { ["datasourcetypeuiname"]: {
@ -798,15 +798,15 @@ export class SearchFieldsBase {
}; };
// public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
// public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
// public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];