Compare commits

..

33 Commits

Author SHA1 Message Date
Konstantinos Triantafyllou bb9f4dfc9a Merge pull request 'Production Release Irish Monitor (1.0.3)' (#54) from develop into master
Reviewed-on: #54
2024-10-30 10:00:41 +01:00
Konstantinos Triantafyllou 2b8725e1fb Merge remote-tracking branch 'origin/develop' 2024-10-08 13:16:03 +03:00
Konstantinos Triantafyllou 59cb69736c Merge pull request 'Production Release Monitor (1.0.4) and Monitor Dashboard (1.1.1)' (#53) from develop into master
Reviewed-on: #53
2024-10-07 14:31:44 +02:00
Konstantina Galouni f1fd1ef60c Merge pull request 'Production release September 2024 [EXPLORE]' (#52) from develop into master
Reviewed-on: #52
2024-09-23 13:07:57 +02:00
Konstantinos Triantafyllou 42d6430cc4 Merge pull request 'Irish Monitor Release September 2024' (#51) from develop into master
Reviewed-on: #51
2024-09-18 12:05:41 +02:00
Argiro Kokogiannaki d6735a566f Merge pull request 'Connect Production release September' (#50) from develop into master
Reviewed-on: #50
2024-09-09 12:04:16 +02:00
Konstantina Galouni fa2938f84b Merge pull request 'EXPLORE Production release August 2024' (#49) from develop into master
Reviewed-on: #49
2024-08-02 09:38:05 +02:00
Konstantinos Triantafyllou 78bcd9c80a Merge pull request 'Irish Monitor Release July 2024' (#48) from develop into master
Reviewed-on: #48
2024-07-25 09:53:44 +02:00
Konstantina Galouni fe09fbfdcb Merge remote-tracking branch 'origin/develop' 2024-07-23 11:23:20 +03:00
Konstantina Galouni 9b1e662f4b Merge pull request 'Production release July 2024 [EXPLORE]' (#47) from develop into master
Reviewed-on: #47
2024-07-12 10:03:50 +02:00
Konstantinos Triantafyllou df789fddff Merge pull request 'Irish Monitor Release June 2024' (#46) from develop into master
Reviewed-on: #46
2024-06-26 13:47:50 +02:00
Konstantinos Triantafyllou 4396999ce0 Merge pull request 'Production release June 2024 [Monitor Dashboard, Irish Monitor]' (#45) from develop into master
Reviewed-on: #45
2024-06-20 11:31:06 +02:00
Argiro Kokogiannaki 2e2a71c310 Merge pull request 'Production release June 2024 [CONNECT]' (#44) from develop into master
Reviewed-on: #44
2024-06-13 10:03:56 +02:00
Konstantina Galouni b57c46d969 Merge pull request 'Production release June 2024 [EXPLORE]' (#41) from develop into master
Reviewed-on: #41
2024-06-04 16:34:02 +02:00
Konstantina Galouni d1392adc2d Merge pull request 'Production release May 2024 [EXPLORE]' (#40) from develop into master
Reviewed-on: #40
2024-05-23 18:26:50 +02:00
Konstantinos Triantafyllou 44e821b1f1 Merge pull request 'Production release March 2024 [Monitor Dashboard]' (#38) from develop into master
Reviewed-on: #38
2024-04-01 18:02:04 +02:00
Konstantina Galouni 6ab50b04cc Merge pull request 'Production release March 2024 [EXPLORE]' (#35) from develop into master
Reviewed-on: #35
2024-03-04 17:44:23 +01:00
Konstantina Galouni e30672043b Merge pull request 'Production release February 2024 [CONNECT]' (#34) from develop into master
Reviewed-on: #34
2024-02-15 11:04:19 +01:00
Konstantina Galouni c3cb2d56ca Merge pull request 'Production release February 2024' (#31) from develop into master
Reviewed-on: #31
2024-02-08 18:03:26 +01:00
Konstantina Galouni 0757b7a98f Merge pull request 'Production release February 2024' (#30) from develop into master
Reviewed-on: #30
2024-02-07 21:37:50 +01:00
Konstantina Galouni d9465d5d05 Merge remote-tracking branch 'origin/develop' 2024-02-01 21:50:22 +02:00
Konstantina Galouni 7b8ca9ca66 Merge pull request 'Production release January 2024' (#29) from develop into master
Reviewed-on: #29
2024-02-01 20:07:59 +01:00
Konstantinos Triantafyllou 9fc6d0c0a0 Merge pull request 'Production release December 2023' (#27) from develop into master
Reviewed-on: #27
2023-12-21 13:46:37 +01:00
Konstantina Galouni c12cadf0f1 Merge pull request 'Production release (for EOSC EXPLORE) December 2023' (#24) from develop into master
Reviewed-on: #24
2023-12-12 11:43:47 +01:00
Konstantinos Triantafyllou 1a7624eed1 Merge pull request 'Production release November 2023 v3' (#23) from develop into master
Reviewed-on: #23
2023-11-28 09:45:06 +01:00
Konstantina Galouni e8ed5da8ba Merge pull request 'Production release November 2023 v2' (#21) from develop into master
Reviewed-on: #21
2023-11-10 18:27:47 +01:00
Konstantina Galouni e63d61b469 Merge remote-tracking branch 'origin/develop' 2023-11-07 13:34:30 +02:00
Argiro Kokogiannaki f42d160308 Merge pull request 'Production release November 2023' (#20) from develop into master
Reviewed-on: #20
2023-11-07 09:48:31 +01:00
Konstantina Galouni b06e41c9a3 Merge pull request 'Merging develop branch into master for PROD Explore October 2023 release' (#10) from develop into master
Reviewed-on: #10
2023-10-16 12:38:55 +02:00
argirok 1a030e2a0d Merge branch 'develop' 2023-10-06 17:55:08 +03:00
Konstantina Galouni 9b2524c1c7 Merge remote-tracking branch 'origin/develop' 2023-09-11 18:18:09 +03:00
Konstantinos Triantafyllou 31f42cfc71 Merge remote-tracking branch 'origin/develop' 2023-09-05 13:24:11 +03:00
Konstantinos Triantafyllou c292215ada Merge pull request 'Connect Admin release 30th August 2023' (#8) from develop into master
Reviewed-on: #8
2023-08-30 12:47:45 +02:00
44 changed files with 1880 additions and 1825 deletions

View File

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

View File

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

View File

@ -7,19 +7,21 @@ import {properties} from "../../../../../environments/environment";
@Component({
selector: 'project-title',
template: `
<ng-container>
<h6 class="uk-margin-remove multi-line-ellipsis lines-2">
<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'">
<span *ngIf="project['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}}</span>
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}}</span>
</a>
<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['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}} </span>
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}} </span>
</a>
</p>
</h6>
<span *ngIf="project['funderName'] && project['name'] != 'unidentified'" class="uk-margin-small-top">
</ng-container>
<span *ngIf="project['funderName'] && project['code'] != 'unidentified'" class="uk-margin-small-top">
<span class="uk-text-meta">Funder: </span>{{project['funderName']}}
</span>
`
@ -38,6 +40,5 @@ export class ProjectTitleFormatter {
ngOnInit() {
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">
<div class="uk-margin-top" title="Use material icons to update the card icon">
<div class="uk-width-1-1 uk-text-right">
<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>
<a href="https://fonts.google.com/icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a>
</div>
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].icon"
type="text" field="icon" placeholder="Material icon"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,10 @@
{{card.title}}
</div>
<div class="uk-text-small">{{card.description}}</div>
<ng-container *ngFor="let url of card.urlsArray">
<plugin-url [url]="url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"></plugin-url>
</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}}
</a>
</slider-nav-item>
</ng-container>
</slider-column>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,36 +0,0 @@
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

@ -1,47 +0,0 @@
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}}
</div>
<div *ngIf="dataProviderInfo.contentpolicies?.length > 0" class="uk-margin-medium-bottom">
<div *ngIf="dataProviderInfo.contentpolicy" class="uk-margin-medium-bottom">
<div class="uk-text-meta uk-margin-small-bottom">Content policy</div>
{{dataProviderInfo.contentpolicies.join(", ")}}
{{dataProviderInfo.contentpolicy}}
</div>
</ng-container>

View File

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

View File

@ -47,6 +47,17 @@ export class DataProviderService {
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)));
}
@ -125,33 +136,24 @@ export class DataProviderService {
}
parseDataProviderInfo (data: any):any {
if(data == null) {
return null;
}
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.record = data[7];
this.dataProviderInfo.objIdentifier = data[7]["result"]["header"]["dri:objIdentifier"];
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(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(datasource.englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(datasource.englishname));
if(data[0].englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(data[0].englishname));
}
var pattern = /.{12}::.+/;
var originalIds =(datasource.originalId)?datasource.originalId:"";
var originalIds =(data[0].originalId)?data[0].originalId:"";
if(originalIds) {
let provenances = new DataproviderProvenance().provenance;
this.dataProviderInfo.provenance = new Map<string, { "url": string[], "name" }>();
@ -165,6 +167,12 @@ export class DataProviderService {
var matched = originalId.match(pattern);
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);
if(provenances.has(prefix)) {
let provenance = provenances.get(prefix);
@ -173,6 +181,12 @@ export class DataProviderService {
} else {
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;
}
@ -180,174 +194,162 @@ export class DataProviderService {
}
this.dataProviderInfo.subjects = [];
if(datasource.subjects) {
let length = Array.isArray(datasource['subjects']) ? datasource['subjects'].length : 1;
if(data[0].subjects) {
let length = Array.isArray(data[0]['subjects']) ? data[0]['subjects'].length : 1;
for (let i = 0; i < length; i++) {
let subject = Array.isArray(datasource['subjects']) ? datasource['subjects'][i] : datasource['subjects'];
let subject = Array.isArray(data[0]['subjects']) ? data[0]['subjects'][i] : data[0]['subjects'];
if (subject && subject.content) {
this.dataProviderInfo.subjects.push(subject.content);
}
}
}
this.dataProviderInfo.description = this.parsingFunctions.parseDescription(datasource && datasource.description?datasource.description:[]);
// if(!Array.isArray(data[0]['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 = datasource.thematic;
this.dataProviderInfo.thematic = data[0].thematic;
if(datasource.jurisdiction) {
this.dataProviderInfo.jurisdiction = datasource.jurisdiction.label;
if(data[0].jurisdiction != null) {
this.dataProviderInfo.jurisdiction = data[0].jurisdiction.classname;
}
if(datasource.contentpolicies) {
this.dataProviderInfo.contentpolicies = [];
datasource.contentpolicies.forEach(contentpolicy => {
if(contentpolicy.label) {
this.dataProviderInfo.contentpolicies.push(contentpolicy.label);
}
})
if(data[0].contentpolicy != null) {
this.dataProviderInfo.contentpolicy = data[0].contentpolicy.classname;
}
if(datasource['datasourcetype']) {
let datasourcetype = datasource['datasourcetype'];
this.dataProviderInfo.type = datasourcetype.label;
if(data[0].pid != null) {
this.dataProviderInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[0].pid);
}
}
if(datasourcetype.code == "entityregistry" || datasourcetype.code == "entityregistry::projects" || datasourcetype.code == "entityregistry::repositories") {
if(data[1] != null) {
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;
} else {
this.dataProviderInfo.registry = false;
}
// if(this.dataProviderInfo.tabs == undefined) {
// this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
// }
// this.dataProviderInfo.tabs = [];
// if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS);
// }
// if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"});
// 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.tabs == undefined) {
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
}
this.dataProviderInfo.tabs = [];
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS);
}
if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASETS);
}
if(this.dataProviderInfo.resultTypes.collectedFrom.has(datasourcetype.code)) {
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.resultTypes.collectedFrom.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "collectedFrom";
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(datasourcetype.code)) {
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "hostedBy";
}
}
if(!this.dataProviderInfo.registry) {
let compatibility = datasource['openairecompatibility'];
if(compatibility) {
if(data[2] != null) {
this.dataProviderInfo.compatibility = {"info": "", "name": "", "id": ""};
this.dataProviderInfo.compatibility.info = compatibility.label;
this.dataProviderInfo.compatibility.info = data[2].classname;
//this.dataProviderInfo.compatibility = data[2].classname;
}
if(compatibility != null && compatibility.code == "hostedBy" && datasource['collectedfrom'] != null) {
this.dataProviderInfo.compatibility.name = datasource['collectedfrom'].dsName;
this.dataProviderInfo.compatibility.id = datasource['collectedfrom'].dsId;
if(data[2] != null && data[2].classid == "hostedBy" && data[3] != null) {
this.dataProviderInfo.compatibility.name = data[3].name;
this.dataProviderInfo.compatibility.id = data[3].id;
if(this.dataProviderInfo.compatibility.name) {
this.dataProviderInfo.compatibility.info = "Collected from ";
}
}
if(datasource['accessinfopackage']) {
if(data[4] != null) {
let oaiPmhURL:string;
oaiPmhURL = Array.isArray(datasource['accessinfopackage']) ? datasource['accessinfopackage'][0]:datasource['accessinfopackage'];
oaiPmhURL = Array.isArray(data[4]) ? data[4][0]:data[4];
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
}
}
}
if(datasource['journal']) {
let journal = datasource['journal'];
this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
this.dataProviderInfo.journal['journal'] = journal.name;
this.dataProviderInfo.journal['issn'] = journal['issnPrinted'];
this.dataProviderInfo.journal['lissn'] = journal['issnLinking'];
this.dataProviderInfo.journal['eissn'] = journal['issnOnline'];
}else {
this.dataProviderInfo.journal = null;
}
}
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;
if(data[5] != null) {
let mydata;
let counter = 0;
let countriesSet: Set<string>;
let length = data[5].length!=undefined ? data[5].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() == "isprovidedby" && relation['header'].relatedRecordType == "organization") {
for(let i=0; i<length; i++) {
mydata = data[5].length!=undefined ? data[5][i] : data[5];
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class && mydata['to'].class.toLowerCase() == "isprovidedby" && mydata['to'].type == "organization") {
//if(this.dataProviderInfo.organizations == undefined) {
if(this.dataProviderInfo.organizations.length == 0) {
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>();
}
this.dataProviderInfo.organizations[counter] = {"acronym": "", "name": "", "id": ""};
this.dataProviderInfo.organizations[counter]['id'] = relation['header'].relatedIdentifier;
//this.dataProviderInfo.organizations[counter]['name'] = (mydata.legalname ? mydata.legalname : "[no title available");
this.dataProviderInfo.organizations[counter]['id'] = mydata['to'].content;
if (relation["legalshortname"]) {
this.dataProviderInfo.organizations[counter]['acronym'] = relation.legalshortname;
if(mydata.hasOwnProperty("legalshortname")) {
this.dataProviderInfo.organizations[counter]['acronym'] = mydata.legalshortname;
}
if (relation["legalname"]) {
this.dataProviderInfo.organizations[counter]['name'] = relation.legalname;
if(mydata.hasOwnProperty("legalname")) {
this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname;
}
if(!this.dataProviderInfo.organizations[counter]['acronym'] && !this.dataProviderInfo.organizations[counter]['name']){
// acronym is displayed with link and name only in tooltip
this.dataProviderInfo.organizations[counter]['acronym'] = "[no title available]";
}
if (relation['header'].country && relation['header']['country'].label) {
if (!countriesSet.has(relation['header']['country'].label)) {
this.dataProviderInfo.countries.push(relation['header']['country'].label);
countriesSet.add(relation['header']['country'].label);
if(mydata.country != '' && mydata['country'].classname != '') {
if(!countriesSet.has(mydata['country'].classname)) {
this.dataProviderInfo.countries.push(mydata['country'].classname);
countriesSet.add(mydata['country'].classname);
}
}
@ -355,9 +357,20 @@ 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'];
if (data?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data.measure);
}else {
this.dataProviderInfo.journal = null;
// this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
}
if (data[0]?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
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">
<!-- oa -->
<span class="uk-flex-inline uk-flex-middle uk-flex-wrap"
*ngIf="(openAccessMandatePublications && openAccessMandatePublications != 'false') || (openAccessMandateDatasets && openAccessMandateDatasets != 'false')">
*ngIf="(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)">
<span class="uk-margin-xsmall-right open-access">
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon>
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != 'false' && openAccessMandateDatasets != 'false'">
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != 'false' && openAccessMandatePublications && (openAccessMandateDatasets == 'false' || !openAccessMandateDatasets)">
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandateDatasets != 'false' && openAccessMandateDatasets && (openAccessMandatePublications == 'false' || !openAccessMandatePublications)">
*ngIf="openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)">
Open Access Mandate for {{openaireEntities.DATASETS}}
</span>
</span>
@ -236,8 +236,8 @@ export class EntityMetadataComponent {
@Input() endYear: string; // search result
@Input() currentDate: number; // project landing
@Input() status: string; // project landing
@Input() openAccessMandatePublications: string; // project landing
@Input() openAccessMandateDatasets: string; // project landing
@Input() openAccessMandatePublications: boolean // project landing
@Input() openAccessMandateDatasets: boolean // project landing
@Input() date: Date;
@Input() embargoEndDate: Date | string;
@Input() underCuration: boolean = false;

View File

@ -28,10 +28,7 @@ export class ParsingFunctions {
public open = 'open_access';
public closed = 'closed_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;
constructor() {
@ -52,14 +49,14 @@ export class ParsingFunctions {
};
if (relation.title != 'unidentified') {
fundedByProject['id'] = relation['header'].relatedIdentifier;
fundedByProject['id'] = relation['to'].content;
fundedByProject['acronym'] = relation.acronym;
fundedByProject['title'] = relation.projectTitle;
fundedByProject['title'] = relation.title;
fundedByProject['code'] = relation.code;
if (relation.validationDate) {
if (relation.validated && relation.validated.date) {
fundedByProject['validated'] = true;
}
fundedByProject['provenanceAction'] = relation.header.relationProvenance;
fundedByProject['provenanceAction'] = relation.provenanceaction;
} else {
fundedByProject['id'] = "";
fundedByProject['acronym'] = "";
@ -104,7 +101,7 @@ export class ParsingFunctions {
if (fundingData.hasOwnProperty("funder")) {
funding.funderShortname = fundingData['funder'].shortname;
funding.funderName = fundingData['funder'].name;
funding.funderJurisdiction = fundingData['funder'].jurisdiction?.code;
funding.funderJurisdiction = fundingData['funder'].jurisdiction;
}
funding.stream = this.addFundingLevel0(fundingData, funding.stream);
@ -117,8 +114,9 @@ export class ParsingFunctions {
}
addFundingLevel0(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("level0") && parent['level0'].name) {
let level0 = parent['level0'];
if (parent.hasOwnProperty("funding_level_0")) {
let level0 = parent['funding_level_0'];
fundingStream += (fundingStream) ? " ; " : "";
fundingStream += level0.name;
}
@ -126,8 +124,8 @@ export class ParsingFunctions {
}
addFundingLevel1(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("level1") && parent['level1'].name) {
let level1 = parent['level1'];
if (parent.hasOwnProperty("funding_level_1")) {
let level1 = parent['funding_level_1'];
// For projects' parsing
if (level1.hasOwnProperty("parent")) {
@ -141,8 +139,8 @@ export class ParsingFunctions {
}
addFundingLevel2(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("level2") && parent['level2'].name) {
let level2 = parent['level2'];
if (parent.hasOwnProperty("funding_level_2")) {
let level2 = parent['funding_level_2'];
// For projects' parsing
if (level2.hasOwnProperty("parent")) {
@ -250,11 +248,11 @@ export class ParsingFunctions {
if (instance.hasOwnProperty("accessright")) {
if (url) {
mapStructure.get(key)['accessMode'].push(instance['accessright'].label);
mapStructure.get(key)['accessMode'].push(instance['accessright'].classname);
}
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].label;
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname;
}
} else if (url) {
mapStructure.get(key)['accessMode'].push("");
@ -285,8 +283,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
for (let i = 0; i < length; i++) {
let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby'];
if (hostedBy.dsName && hostedBy.dsName != "other resources" && hostedBy.dsName != "Unknown Repository") {
downloadNames.add(String(hostedBy.dsName));
if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") {
downloadNames.add(String(hostedBy.name));
}
}
available.downloadNames = Array.from(downloadNames);
@ -300,8 +298,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
for (let i = 0; i < length; i++) {
let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
if (collectedFrom.dsName && collectedFrom.dsId) {
available.collectedNamesAndIds.set(String(collectedFrom.dsName), collectedFrom.dsId);
if (collectedFrom.name && collectedFrom.id) {
available.collectedNamesAndIds.set(String(collectedFrom.name), collectedFrom.id);
}
}
}
@ -311,8 +309,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
for (let i = 0; i < length; i++) {
let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
if (instanceType && instanceType.toLowerCase() !== "unknown") {
types.add(instanceType);
if (instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
types.add(instanceType.classname);
}
}
available.types = Array.from(types);
@ -340,9 +338,9 @@ export class ParsingFunctions {
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
if (this.changeBestAccessMode(available.accessRight, accessRight)) {
available.accessRight = accessRight.label;
available.accessRight = accessRight.classname;
if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
globalAccessRight = accessRight.label;
globalAccessRight = accessRight.classname;
}
}
}
@ -371,7 +369,7 @@ export class ParsingFunctions {
available.fulltext = instance['fulltext'];
}
if(instance.hasOwnProperty("refereed") && instance.refereed == "peerReviewed") {
if(instance.hasOwnProperty("refereed") && instance.refereed.classname == "peerReviewed") {
available.peerReviewed = true;
}
@ -432,7 +430,7 @@ export class ParsingFunctions {
if (!accessMode) {
return false;
}
accessMode = accessMode.code;
accessMode = accessMode.classid;
switch (currentAccessMode) {
case null:
@ -489,29 +487,29 @@ export class ParsingFunctions {
// researchResult.relationName = relation.to.class;
if (relation['header'] && relation.header.recordType) {
if (relation.header.recordType == "publication") {
if (relation['resulttype']) {
if (relation['resulttype'].classname == "publication") {
researchResult['class'] = "publication";
} else if (relation.header.recordType == "dataset") {
} else if (relation['resulttype'].classname == "dataset") {
researchResult['class'] = "dataset";
} else if (relation.header.recordType == "software") {
} else if (relation['resulttype'].classname == "software") {
researchResult['class'] = "software";
} else if (relation.header.recordType == "other") {
} else if (relation['resulttype'].classname == "other") {
researchResult['class'] = "other";
}
}
researchResult['id'] = relation['header'].relatedIdentifier ;
//if (Array.isArray(relation['title'])) {
//for (let i = 0; i < relation['title'].length; i++) {
//if (relation['title'][i] && relation['title'][i]) {
//if (!researchResult['name'] || relation['title'][i].classid == "main title") {
//researchResult['name'] = String(relation['title'][i].content);
//}
//}
//}
//} else {
researchResult['name'] = (relation['title'] && relation['title']) ? String(relation['title']) : "";
//}
researchResult['id'] = relation['to'].content;
if (Array.isArray(relation['title'])) {
for (let i = 0; i < relation['title'].length; i++) {
if (relation['title'][i] && relation['title'][i].content) {
if (!researchResult['name'] || relation['title'][i].classid == "main title") {
researchResult['name'] = String(relation['title'][i].content);
}
}
}
} else {
researchResult['name'] = (relation['title'] && relation['title'].content) ? String(relation['title'].content) : "";
}
if (!researchResult['name']) {
researchResult['name'] = "[no title available]";
}
@ -521,14 +519,13 @@ export class ParsingFunctions {
}
//researchResult['date'] = relation.dateofacceptance.substring(0,4);;
let percentageName: string;
if (relation.header.trust) {
if (relation.trust) {
percentageName = "trust";
} else if (relation.similarity) {
// TODO: not available
// percentageName = "similarity";
percentageName = "similarity";
}
if (percentageName) {
researchResult['percentage'] = Math.round(relation.header[percentageName] * 100);
researchResult['percentage'] = Math.round(relation[percentageName] * 100);
researchResult['percentageName'] = percentageName;
}
researchResults.push(researchResult);
@ -548,7 +545,7 @@ export class ParsingFunctions {
openaireCompatibility: ""
};
datasource['id'] = relation['header'].relatedIdentifier;
datasource['id'] = relation['to'].content;
if(relation["officialname"])
datasource.name = relation.officialname;
else {
@ -556,10 +553,10 @@ export class ParsingFunctions {
}
let percentageName: string;
if (relation['header'].trust) {
if (relation.trust) {
percentageName = "trust";
// } else if (relation.similarity) {
// percentageName = "similarity";
} else if (relation.similarity) {
percentageName = "similarity";
}
if (percentageName) {
datasource['percentage'] = Math.round(relation[percentageName] * 100);
@ -567,13 +564,13 @@ export class ParsingFunctions {
}
// type
if(relation['datasourcetype'] && relation['datasourcetype']["code"]) {
datasource.class = relation['datasourcetype'].code;
if(relation.hasOwnProperty('datasourcetype') && relation['datasourcetype'].hasOwnProperty("classname")) {
datasource.class = relation['datasourcetype'].classname;
}
// compatibility
if(relation["openairecompatibility"]) {
datasource.openaireCompatibility = relation['openairecompatibility'].label;
if(relation.hasOwnProperty("openairecompatibility")) {
datasource.openaireCompatibility = relation['openairecompatibility'].classname;
}
if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") {
@ -598,20 +595,26 @@ export class ParsingFunctions {
parseIdentifiers(pid: any): Map<string, string[]> {
let identifiers = new Map<string, string[]>();
if (pid.hasOwnProperty("typeCode") && pid['typeCode'] != "") {
if (this.identifierTypes.indexOf(pid.typeCode) !=-1) {
if (!identifiers.has(pid.typeCode)) {
identifiers.set(pid.typeCode, new Array<string>());
if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data"
|| pid.classid == "swhid"
|| pid.classid == "ROR" || pid.classid == "ISNI" || pid.classid == "Wikidata" || pid.classid == "FundRef"
|| pid.classid == "RRID") {
if (!identifiers.has(pid.classid)) {
identifiers.set(pid.classid, new Array<string>());
}
identifiers.get(pid.typeCode).push(pid.value + "");
identifiers.get(pid.classid).push(pid.content + "");
}
} else {
for (let i = 0; i < pid.length; i++) {
if (this.identifierTypes.indexOf(pid[i].typeCode) !=-1) {
if (!identifiers.has(pid[i].typeCode)) {
identifiers.set(pid[i].typeCode, new Array<string>());
if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data"
|| pid[i].classid == "swhid"
|| pid[i].classid == "ROR" || pid[i].classid == "ISNI" || pid[i].classid == "Wikidata" || pid[i].classid == "FundRef"
|| pid[i].classid == "RRID") {
if (!identifiers.has(pid[i].classid)) {
identifiers.set(pid[i].classid, new Array<string>());
}
identifiers.get(pid[i].typeCode).push(pid[i].value + "");
identifiers.get(pid[i].classid).push(pid[i].content + "");
}
}
}
@ -656,9 +659,9 @@ export class ParsingFunctions {
for (let i = 0; i < length; i++) {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
if (subject.typeCode != "") {
if (subject.typeCode == "keyword") {
let content: string = subject.value + "";
if (subject.classid != "") {
if (subject.classid == "keyword") {
let content: string = subject.content + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
@ -670,49 +673,49 @@ export class ParsingFunctions {
}
subjects.push(content);
// }
} else if (!vocabulary || vocabulary[subject.typeCode] || subject.typeCode === "SDG" || subject.typeCode === "FOS") {
} else if (!vocabulary || vocabulary[subject.classid] || subject.classid === "SDG" || subject.classid === "FOS") {
// if (subject.inferred && subject.inferred == true) {
if (subject.typeCode === "SDG") {
if (subject.classid === "SDG") {
if (sdg == undefined) {
sdg = new Array<string>();
}
sdg.push(subject.value + "");
} else if (subject.typeCode === "FOS") {
sdg.push(subject.content + "");
} else if (subject.classid === "FOS") {
if (fos == undefined) {
fos = new Array<string>();
}
fos.push(subject.value + "");
fos.push(subject.content + "");
} else {
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
let content: string = subject.value + "";
let content: string = subject.content + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else {
if (!classifiedSubjects.has(subject.typeLabel)) {
classifiedSubjects.set(subject.typeLabel, new Array<string>());
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(subject.classname, new Array<string>());
}
// if(properties.environment == "production") {
// classifiedSubjects.get(subject.classname).push(content);
// } else {
classifiedSubjects.get(subject.typeLabel).push(subject.typeCode + ": " + content);
classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content);
// }
// }
}
} else {
let content: string = subject.value + "";
let content: string = subject.content + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else {
let classname: string = subject.typeLabel + "";
let classname: string = subject.classname + "";
if (subjects == undefined) {
subjects = new Array<string>();
}
@ -839,10 +842,10 @@ export class ParsingFunctions {
}
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
if (instance && instance.hasOwnProperty("instancetype")) {
if (!uniqueTypes.has(instance['instancetype'])) {
types.push(instance['instancetype']);
uniqueTypes.add(instance['instancetype']);
if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
if (!uniqueTypes.has(instance['instancetype'].classname)) {
types.push(instance['instancetype'].classname);
uniqueTypes.add(instance['instancetype'].classname);
}
}
}
@ -851,13 +854,13 @@ export class ParsingFunctions {
var languages = new Array<string>();
if (!Array.isArray(_languages)) {
if (_languages.label != "Undetermined" && _languages.label) {
languages.push(_languages.label);
if (_languages.classname != "Undetermined" && _languages.classname) {
languages.push(_languages.classname);
}
} else {
for (let i = 0; i < _languages.length; i++) {
if (_languages[i].label != "Undetermined" && _languages[i].label) {
languages.push(_languages[i].label);
if (_languages[i].classname != "Undetermined" && _languages[i].classname) {
languages.push(_languages[i].classname);
}
}
}
@ -868,13 +871,13 @@ export class ParsingFunctions {
var countries = new Array<string>();
if (!Array.isArray(_countries)) {
if (_countries.label != "Undetermined" && _countries.label) {
countries.push(_countries.label);
if (_countries.classname != "Undetermined" && _countries.classname) {
countries.push(_countries.classname);
}
} else {
for (let i = 0; i < _countries.length; i++) {
if (_countries[i].label != "Undetermined" && _countries[i].label) {
countries.push(_countries[i].label);
if (_countries[i].classname != "Undetermined" && _countries[i].classname) {
countries.push(_countries[i].classname);
}
}
}
@ -885,13 +888,13 @@ export class ParsingFunctions {
var pLanguages = new Array<string>();
if (!Array.isArray(_pLanguages)) {
if (_pLanguages != "Undetermined" && _pLanguages) {
pLanguages.push(_pLanguages);
if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) {
pLanguages.push(_pLanguages.classname);
}
} else {
for (let i = 0; i < _pLanguages.length; i++) {
if (_pLanguages[i] != "Undetermined" && _pLanguages[i]) {
pLanguages.push(_pLanguages[i]);
if (_pLanguages[i].classname != "Undetermined" && _pLanguages[i].classname) {
pLanguages.push(_pLanguages[i].classname);
}
}
}
@ -923,23 +926,16 @@ export class ParsingFunctions {
static parseRelCanonicalId(record, type) {
try {
if (record && record['links']) {
let links = record['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.hasOwnProperty("header")) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == type) {
return relation['header'].relatedIdentifier;
}
}
if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
for (let child of record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
return child["objidentifier"];
}
}
} catch (e) {
// console.error(e);
}
return record["header"]["id"];
return record["result"]["header"]["dri:objIdentifier"];
}
parseDescription(description, stripHTML: boolean = false): string {
@ -974,73 +970,82 @@ export class ParsingFunctions {
let downloads: number = 0;
elements.forEach(element => {
if (element.id == 'views') {
element.unit.forEach(unit => {
let viewsNum = parseInt(unit.label);
views += viewsNum;
let datasourceId = unit.code;
views += element.count;
let datasourceId = element.datasource;
if(datasourceId) {
if(datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum;
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count;
} else {
datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0})
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": element.count, "downloads": 0})
}
}
});
} else if (element.id == 'downloads') {
element.unit.forEach(unit => {
let downloadsNum = parseInt(unit.label);
downloads += downloadsNum;
let datasourceId = unit.code;
// measure.views = element.count;
}
if (element.id == 'downloads') {
downloads += element.count;
let datasourceId = element.datasource;
if(datasourceId) {
if (datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum;
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count;
} else {
datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({
"datasourceId": datasourceId.split("||")[0],
"datasourceName": datasourceId.split("||")[1],
"views": 0,
"downloads": downloadsNum
})
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": 0, "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') {
let metric: Metric = {name: 'popularity', icon: 'fire', value: value, order: 3};
bip.push(metric);
} else if (element.id == 'influence') {
let metric: Metric = {name: 'influence', icon: 'landmark', value: value, order: 4};
bip.push(metric);
} else if (element.id == 'impulse') {
let metric: Metric = {name: 'impulse', icon: 'rocket', value: value, order: 5};
let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3};
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.popularity = metric.value;
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,7 +10,6 @@ import {
} from '@angular/core';
import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment";
import {ParsingFunctions} from "./parsingFunctions.class";
@Component({
selector: 'showIdentifiers',
@ -27,7 +26,8 @@ import {ParsingFunctions} from "./parsingFunctions.class";
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
<span [class.uk-margin-small-left]="modal">
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
<a *ngIf="parsingFunctions.identifierTypes.indexOf(key) != -1"
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data' || key == 'swhid'
|| key == 'ROR' || key == 'ISNI' || key == 'Wikidata' || key == 'FundRef' || key == 'RRID'"
[href]="getUrl(key, item) + item" target="_blank" class="uk-display-inline-block custom-external">
{{item}}
</a>
@ -69,7 +69,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
properties: EnvProperties = properties;
@ViewChildren("content", { read: ElementRef }) types: QueryList<ElementRef>;
@ViewChild('identifiersModal') identifiersModal;
public parsingFunctions: ParsingFunctions = new ParsingFunctions();
constructor(private cdr: ChangeDetectorRef) {
}
@ -118,7 +118,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
if(value.includes("http://") || value.includes("https://")) {
return "";
}
if(key == "doi" || key == "Digital Object Identifier") {
if(key == "doi") {
return properties.doiURL;
} else if(key == "pmc") {
return properties.pmcURL;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -74,14 +74,13 @@ export class ResultLandingService {
error: "Http failure response for " + finalUrl + ": 404 Not Found"
});
}
//TODO make sure to pass the correct part
return res['results'][0];
} else {
return res;
}
}))
// .pipe(map(res => [res['meta']['status'], res['result']['metadata']['oaf:entity'], res]))
/*.pipe(map(res => [
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res]))
.pipe(map(res => [
res[1]['oaf:result'], // 0
res[1]['oaf:result']['title'], // 1
res[1]['oaf:result']['rels']['rel'], // 2
@ -100,7 +99,7 @@ export class ResultLandingService {
? res[1]['extraInfo']['references']['reference'] : null, // 13
res[0], // 14
res[2], // 15
]))*/
]))
.pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties)));
}
@ -128,95 +127,155 @@ export class ResultLandingService {
}
parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any {
if(data == null) {
return null;
}
this.resultLandingInfo = new ResultLandingInfo();
this.resultLandingInfo.record = data;
if(data["header"]) {
this.resultLandingInfo.objIdentifier = data["header"]["id"];
// res
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['header']['recordType'];
this.resultLandingInfo.resultType = data[0].resulttype.classid;
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
// 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 = 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;
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 (result.publiclyFunded) {
this.resultLandingInfo.publiclyFunded = result.publiclyFunded;
if(data[0].hasOwnProperty("publiclyfunded") && data[0].publiclyfunded) {
this.resultLandingInfo.publiclyFunded = data[0].publiclyfunded;
}
if (result["isGreen"] || result["openAccessColor"] || result["isInDiamondJournal"]) {
if((data[0].hasOwnProperty("isgreen") && data[0].isgreen)
|| (data[0].hasOwnProperty("openaccesscolor") && data[0].openaccesscolor)
|| (data[0].hasOwnProperty("isindiamondjournal") && data[0].isindiamondjournal)) {
this.resultLandingInfo.oaRoutes = {
"green": result.isGreen,
"oaColor": result.openAccessColor,
"isInDiamondJournal": result.isInDiamondJournal
"green": data[0].isgreen,
"oaColor": data[0].openaccesscolor,
"isInDiamondJournal":data[0].isindiamondjournal
};
}
if (result['bestaccessright'] && result['bestaccessright']["label"]) {
this.resultLandingInfo.accessMode = result['bestaccessright'].label;
}
if (result['maintitle']) {
this.resultLandingInfo.title = StringUtils.HTMLToString(String(result['maintitle']));
if (data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) {
this.resultLandingInfo.accessMode = data[0]['bestaccessright'].classname;
}
if (result['otherTitles'] != null) {
let titles = result['otherTitles'];
if (Array.isArray(titles)) {
for (let i = 0; i < titles.length; i++) {
if (titles[i]) {
if (!this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = StringUtils.HTMLToString(String(titles[i]));
// res['result']['metadata']['oaf:entity']['oaf:result']['title']
if (data[1] != null) {
if (Array.isArray(data[1])) {
for (let i = 0; i < data[1].length; i++) {
if (data[1][i] && data[1][i].content) {
if (!this.resultLandingInfo.title || data[1][i].classid == "main title") {
this.resultLandingInfo.title = StringUtils.HTMLToString(String(data[1][i].content));
}
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) {
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 {
this.resultLandingInfo.title = (titles) ? StringUtils.HTMLToString(String(titles)) : "";
this.resultLandingInfo.title = (data[1] && data[1].content) ? StringUtils.HTMLToString(String(data[1].content)) : "";
}
}
if (result["instance"]) {
// res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel']
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.types = new Array<string>();
let types = new Set<string>();
let counter = 0;
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++) {
instance = Array.isArray(result['instance']) ? result['instance'][i] : result['instance'];
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance);
if (instance["url"]) {
if (instance.hasOwnProperty("webresource")) {
let url;
url = Array.isArray(instance['url']) ? instance['url'][0] : instance["url"];
if (!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
} else {
url = instance['webresource'][0].url;
}
if (url.includes('&amp;')) {
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);
}
/**********************************************************/
}
}
@ -224,42 +283,61 @@ export class ResultLandingService {
this.resultLandingInfo.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
}
if (result['journal']) {
let journal = result['journal'];
if (data[3].hasOwnProperty("externalreference")) {
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(data[3]);
this.resultLandingInfo.bioentities = externalResults;
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['pid']
if (data[4] != null) {
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['journal']
if (data[5] != null) {
this.resultLandingInfo.journal = {
"journal": "", "issn": "", "lissn": "", "eissn": "",
"issue": "", "volume": "", "start_page": "", "end_page": ""
"journal": "",
"issn": "",
"lissn": "",
"eissn": "",
"issue": "",
"volume": "",
"start_page": "",
"end_page": ""
}
this.resultLandingInfo.journal['journal'] = journal.name;
this.resultLandingInfo.journal['issn'] = journal.issnPrinted;
this.resultLandingInfo.journal['lissn'] = journal.issnLinking;
this.resultLandingInfo.journal['eissn'] = journal.issnOnline;
this.resultLandingInfo.journal['issue'] = journal.iss;
this.resultLandingInfo.journal['volume'] = journal.vol;
this.resultLandingInfo.journal['start_page'] = journal.sp;
this.resultLandingInfo.journal['end_page'] = journal.ep;
this.resultLandingInfo.journal['journal'] = data[5].content;
this.resultLandingInfo.journal['issn'] = data[5].issn;
this.resultLandingInfo.journal['lissn'] = data[5].lissn;
this.resultLandingInfo.journal['eissn'] = data[5].eissn;
this.resultLandingInfo.journal['issue'] = data[5].iss;
this.resultLandingInfo.journal['volume'] = data[5].vol;
this.resultLandingInfo.journal['start_page'] = data[5].sp;
this.resultLandingInfo.journal['end_page'] = data[5].ep;
}
if(result['programmingLanguage']) {
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(result['programmingLanguage']);
// res['result']['metadata']['oaf:entity']['oaf:result']['language']
if (data[6] != null) {
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(data[6]);
// let languagesAndCodes: string[][] = this.parsingFunctions.parseLanguages(data[6]);
// this.resultLandingInfo.languages = languagesAndCodes[0];
// this.resultLandingInfo.languageCodes = languagesAndCodes[1];
}
if(result['language']) {
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(result['language']);
// res['result']['metadata']['oaf:entity']['oaf:result']['country']
if (data[11] != null) {
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(data[11]);
}
if (result['country']) {
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(result['country']);
}
if (result['eoscifguidelines'] != null) {
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(result['eoscifguidelines']);
// res['result']['metadata']['oaf:entity']['oaf:result']['eoscifguidelines']
if (data[7] != null) {
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(data[7]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['subject']
if (result['subject'] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(result['subject'], subjectsVocabulary);
if (data[8] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary);
this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2];
@ -296,43 +374,69 @@ export class ResultLandingService {
})
}
}
// if(!this.resultLandingInfo.eoscSubjects) {
// this.resultLandingInfo.eoscSubjects = subjectResults[5];
// }
}
if (result['author']) {
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
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) {
this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
}
let authors = result['author'];
let authors = data[10];
let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) {
let parsedAuthor = {"fullName": null, "orcid": null, "orcid_pending": null};
let author = Array.isArray(authors) ? authors[i] : authors;
if (author) {
parsedAuthor.fullName = author.fullname;
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) {
author.orcid = author.orcid.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.fullname) {
if (!parsedAuthor.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
parsedAuthor.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
} else if (!parsedAuthor.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) {
parsedAuthor.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending;
if(this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.content) {
if(!author.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
author.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
} else if(!author.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) {
author.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending;
}
}
this.resultLandingInfo['authors'][author.rank] = {
"fullName": parsedAuthor.fullName,
"orcid": parsedAuthor.orcid,
"orcid_pending": parsedAuthor.orcid_pending
"fullName": author.content,
"orcid": author.orcid,
"orcid_pending": author.orcid_pending
};
}
}
@ -341,86 +445,12 @@ export class ResultLandingService {
});
}
// TODO: example?
if (result["externalReference"]) {
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(result["externalReference"]);
this.resultLandingInfo.bioentities = externalResults;
}
// res['result']['metadata']['oaf:entity']['oaf:result']['measure']
if (data[0]?.measure) {
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
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);
}
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;
}
@ -440,15 +470,15 @@ export class ResultLandingService {
country: "", trust: null
};
organization.id = relation['header'].relatedIdentifier;
organization.id = relation['to'].content;
organization.name = relation.legalname;
organization.shortname = relation.legalshortname;
organization.websiteUrl = relation.websiteurl;
if (relation.country) {
organization.country = relation.country.label;
organization.country = relation.country.classname;
}
if (relation.header.trust) {
organization.trust = Math.round(relation.header.trust * 100);
if (relation.trust) {
organization.trust = Math.round(relation.trust * 100);
}
organizations.push(organization);
@ -458,14 +488,14 @@ export class ResultLandingService {
parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> {
let bioentities: Map<string, Map<string, string>>;
let length = Array.isArray(children) ? children.length : 1;
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1;
let externalreference;
for (let i = 0; i < length; i++) {
externalreference = Array.isArray(children) ? children[i] : children;
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference'];
if (externalreference["qualifier"]) {
if (externalreference['qualifier'].code == "accessionNumber") {
if (externalreference.hasOwnProperty("qualifier")) {
if (externalreference['qualifier'].classid == "accessionNumber") {
if (bioentities == undefined) {
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)
//.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)));
}
@ -49,25 +49,24 @@ export class OrganizationService {
}
parseOrganizationInfo (data: any):any {
if(data == null) {
return null;
}
this.organizationInfo = new OrganizationInfo();
let organization;
if(data["header"]) {
this.organizationInfo.relcanId = ParsingFunctions.parseRelCanonicalId(data,"organization");
this.organizationInfo.objIdentifier = data["header"]["id"];
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;
}
if(data["organization"]) {
organization = data["organization"];
if (organization["websiteurl"]) {
if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) {
this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
@ -79,49 +78,129 @@ export class OrganizationService {
this.organizationInfo.title.name = this.organizationInfo.name;
}
if (organization["country"]) {
this.organizationInfo.country = organization['country'].label;
}
if(organization.hasOwnProperty("country")) {
this.organizationInfo.country = organization['country'].classname;
}
if(data["pid"]) {
this.organizationInfo.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"]) {
// TODO: Check if merges or isMergedIn
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == "organization") {
if(!this.organizationInfo.deletedByInferenceIds) {
if (organization.hasOwnProperty("children")) {
let children = organization['children'];
if( children.hasOwnProperty("organization")) {
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;
}
parseOrganizationNameAndUrl(res: any): any {
if(!res || res.organization) {
return null;
}
let organization = res.organization;
parseOrganizationNameAndUrl(organization: any): any {
let title: {"name": string, "url": string} = {"name": "", "url": ""};
if(organization != null) {
if(organization["websiteurl"]) {
if(organization.hasOwnProperty("websiteurl")) {
title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
title = {"name": organization.legalshortname, "url": ''};
@ -134,4 +213,5 @@ export class OrganizationService {
return title;
}
}

View File

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

View File

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

View File

@ -127,29 +127,20 @@ export class SearchProjectsService {
}) ;
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let resBody = Array.isArray(data) ? data[i] : data;
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project'];
var result: SearchResult = new SearchResult();
if (resBody["header"]) {
result.id = resBody['header']['id'];
}
if (resBody["project"]) {
let resData = resBody['project'];
result.openAccessMandatePublications = resData['oamandatepublications'];
if (resData["oamandatedata"]) {
result.openAccessMandateDatasets = resData['oamandatedata'];
result.openAccessMandatePublications = (resData['oamandatepublications'])?true:false;
if(resData.hasOwnProperty("oamandatedata")) {
result.openAccessMandateDatasets = (resData['oamandatedata'])?true:false;
} else {
result.openAccessMandateDatasets = resData['ecarticle29_3'];
result.openAccessMandateDatasets = (resData['ecarticle29_3'])?true:false;
}
result['title'] = {"name": '', "accessMode": ''};
// if(resData['acronym'] != undefined && resData['acronym'] != "") {
@ -180,58 +171,22 @@ export class SearchProjectsService {
result.contribution = resData.fundedamount;//"200100";
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);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
if (resData["funding"]) {
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;
if(resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
for(let j=0; j<relLength; j++) {
let relation = Array.isArray(resBody['links']) ? resBody['links'][j] : resBody['links'];
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if (relation["header"]) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasparticipant") {
if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "hasparticipant") {
if(result['organizations'] == undefined) {
result['organizations'] = new Array<
{ "name": string, "id": string}>();
@ -242,7 +197,7 @@ export class SearchProjectsService {
result['organizations'][countOrganizations] = { "name": "", "id": "" }
result['organizations'][countOrganizations]['id'] =
/*OpenaireProperties.getsearchLinkToOrganization() + */relation['header'].relatedIdentifier;
/*OpenaireProperties.getsearchLinkToOrganization() + */relation['to'].content;
if(relation.legalshortname) {
result['organizations'][countOrganizations]['name'] = relation.legalshortname;
} else {
@ -255,6 +210,65 @@ 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);
}

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

View File

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

View File

@ -35,7 +35,7 @@ export class DataProviderInfo {
subjects: string[];
jurisdiction: string;
thematic: boolean;
contentpolicies: string[];
contentpolicy: string;
identifiers: Map<string, string[]>; //key is the classname
fundedContent: string; // search query

View File

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

View File

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

View File

@ -103,26 +103,27 @@ export let commonDev: EnvProperties = {
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/",
claimsAPIURL: "http://dl170.madgik.di.uoa.gr:19780/uoa-claims-service/claimsService/",
searchAPIURLLAst: "http://beta.services.openaire.eu:8480/test/rest/v2/api/",
searchResourcesAPIURL: "http://beta.services.openaire.eu:8480/test/rest/v2/api/resources",
searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/",
searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources",
openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=",
csvAPIURL: "http://beta.services.openaire.eu:8480/test/rest/v2/api/reports",
csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports",
orcidAPIURL: "http://dl170.madgik.di.uoa.gr:19480/uoa-orcid-service/",
orcidTokenURL: "https://sandbox.orcid.org/oauth/authorize?",
orcidClientId: "APP-A5M3KTX6NCN67L91",
utilsService: "http://duffy.di.uoa.gr:8000",
utilsService: "http://dl170.madgik.di.uoa.gr:8000",
vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/",
loginServiceURL: "http://dl170.madgik.di.uoa.gr:19080/login-service/",
cookieDomain: ".di.uoa.gr",
feedbackmail: "kostis30fylloy@gmail.com",
cacheUrl: "http://duffy.di.uoa.gr:3000/get?url=",
monitorServiceAPIURL: "http://dl170.madgik.di.uoa.gr:19380/uoa-monitor-service/",
cacheUrl: "http://dl170.madgik.di.uoa.gr:3000/get?url=",
monitorServiceAPIURL: "http://mpagasas.di.uoa.gr:19380/uoa-monitor-service/",
adminToolsAPIURL: "http://dl170.madgik.di.uoa.gr:19280/uoa-admin-tools/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",
contextsAPI: "https://dev-openaire.d4science.org/openaire/context",
communityAPI: "https://dev-openaire.d4science.org/openaire/community/",
lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows",
widgetLink: "http://scoobydoo.di.uoa.gr/joomla/index.php?option=com_openaire&view=widget&format=raw&projectId=",
widgetLink: "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
claimsInformationLink: "https://www.openaire.eu/linking-beta",
indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/",
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"]}
];
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle",
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle", "projectkeywords",
"funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
"projectstartdate", "projectenddate",
"projectcode_nt", "relorganizationid", "collectedfromdatasourceid"];
@ -572,12 +572,12 @@ export class SearchFieldsBase {
public DATASOURCE_STATIC_FIELDS = ["eosctype"];
// add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages",
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
"datasourceenglishname", "datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["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": "datasourcesubject", "equalityOperator": " all "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: {
@ -798,15 +798,15 @@ export class SearchFieldsBase {
};
// public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
// public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
// public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];