[Explore | Library | new-theme]: Added more refine filters in Repositories, Journals, Registries pages | Search & Datasource landing: Show not compatible datasources | Result Landing: get relations names by relationsVocabulary (dnet:relation_relClass.json).

1. env-properties.ts & environments/: Removed old properties searchLinkToEntityRegistriesDataProvidersTable and searchLinkToJournalsTable.
2. fetchDataproviders.class.ts & searchDataproviders.service.ts: Removed old unused methods related to subjects/ tables/ csv.
3. searchFields.ts: Added more refine filters in Repositories, Journals, Registries pages (COMPATIBLE_DATAPROVIDER_FIELDS, ENTITY_REGISTRIES_FIELDS, JOURNAL_FIELDS).
4. result-preview.component.ts: Added field @Input() deposit: boolean = false;
5. result-preview.component.html:
   a. Added link to landing page even for not compatible datasources.
   b. Added class "uk-label-danger" when compatibility = "not available" only when deposit=true.
6. searchResultsInDeposit.component.html: In <result-preview> added parameter deposit="true".
7. dataProvider.component.html:
   a. Added class "uk-label-danger" when compatibility = "not available".
   b. Show custom "Not yet registered" compatibility label when compatibility = "not available".
8. ISVocabularies.service.ts: Added methods for getting relationsVocabulary (dnet:relation_relClass.json).
9. resultLanding.service.ts & parsingFunctions.class.ts: When parsing relations, get relationName from relationsVocabulary.
10. resultLanding.component.ts: Get relationsVocabulary and pass it to "getResultLandingInfo()".
11. orcid-work.component.ts: When calling "getResultLandingInfo()", added null parameter for relationsVocabulary.
12. configuration.service.ts: [Bug fix] Added more checks in method "isPageEnabledByStateAsync()".
data-transfer-v2
Konstantina Galouni 2 years ago
parent f5def43fbd
commit d43f576d40

@ -19,7 +19,7 @@
<li *ngFor="let result of results">
<result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result)" [promoteWebsiteURL]="true"
[isCard]="true">
[isCard]="true" deposit="true">
</result-preview>
</li>
</ul>

@ -106,7 +106,7 @@
<ng-container *ngIf="dataProviderInfo.compatibility &&
!(dataProviderInfo.compatibility.info == 'not available' && type == 'service')">
<div>
<span class="uk-label uk-text-truncate" title="Compatibility">
<span class="uk-label uk-text-truncate" [class.uk-label-danger]="dataProviderInfo.compatibility.info == 'not available'" title="Compatibility">
<a *ngIf="dataProviderInfo.compatibility.id"
[queryParams]="{datasourceId: dataProviderInfo.compatibility.id}" routerLinkActive="router-link-active"
[routerLink]="properties.searchLinkToDataProvider.split('?')[0]">
@ -114,7 +114,10 @@
<ng-container *ngIf="dataProviderInfo.compatibility.name">{{dataProviderInfo.compatibility.name}}</ng-container>
</a>
<span *ngIf="!dataProviderInfo.compatibility.id">
{{dataProviderInfo.compatibility.info}}
<ng-container *ngIf="dataProviderInfo.compatibility.info != 'not available'">{{dataProviderInfo.compatibility.info}}</ng-container>
<ng-container *ngIf="dataProviderInfo.compatibility.info == 'not available'">
Not yet registered <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
</ng-container>
</span>
<span *ngIf="dataProviderInfo.compatibility.name && !dataProviderInfo.compatibility.id">
{{dataProviderInfo.compatibility.name}}

@ -439,7 +439,7 @@ export class ParsingFunctions {
return similarResearchResults;
}
parseResults(researchResults: RelationResult[], relation, provenanceAction: string): RelationResult[] {
parseResults(researchResults: RelationResult[], relation, provenanceAction: string, relationName: string): RelationResult[] {
if (researchResults == undefined) {
researchResults = [];
}
@ -452,10 +452,10 @@ export class ParsingFunctions {
percentageName: null,
class: "",
provenanceAction: provenanceAction,
relationName: ""
relationName: relationName
};
researchResult.relationName = relation.to.class;
// researchResult.relationName = relation.to.class;
if(relation['resulttype']) {
if (relation['resulttype'].classname == "publication") {

@ -361,6 +361,7 @@ export class ResultLandingComponent {
let observables: Array<Observable<any>> = [];
observables.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties));
observables.push(this._vocabulariesService.getSubjectsVocabulary(this.properties));
observables.push(this._vocabulariesService.getRelationsVocabulary(this.properties));
// observables.push(this.indexInfoService.getLastIndexDate(properties));
// observables.push(this.indexInfoService.getLastOrcidUpdateDate(properties));
@ -369,7 +370,7 @@ export class ResultLandingComponent {
// this.subscriptions.push(forkJoin(observables).subscribe(
// this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
vocabularies => {
this.getResultLandingInfo(vocabularies[0], vocabularies[1]);
this.getResultLandingInfo(vocabularies[0], vocabularies[1], vocabularies[2]);
}, err => {
this.getResultLandingInfo(null, null);
this.handleError("Error getting provenance action vocabulary for " + this.type, err);
@ -423,14 +424,14 @@ export class ResultLandingComponent {
// return numberOfTabs;
// }
private getResultLandingInfo(provenanceActionVocabulary: any, subjectsVocabulary?: string) {
private getResultLandingInfo(provenanceActionVocabulary: any, subjectsVocabulary?: any, relationsVocabulary?: any) {
if(this.resultFromInput && this.resultLandingInfo){
this.showLoading = false;
return;
}
this.resultLandingInfo = null;
this.hasAltMetrics = false;
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, subjectsVocabulary, this.properties).subscribe(
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, subjectsVocabulary, relationsVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
this.id = this.resultLandingInfo.objIdentifier;

@ -56,7 +56,9 @@ export class ResultLandingService {
}
}
getResultLandingInfo (id: string, identifier: Identifier, type: string, provenanceActionVocabulary: any, subjectsVocabulary: any, properties: EnvProperties): any {
getResultLandingInfo (id: string, identifier: Identifier, type: string,
provenanceActionVocabulary: any, subjectsVocabulary: any, relationsVocabulary: any,
properties: EnvProperties): any {
let url: string = this.buildResultLandingInfoUrl(id, identifier, type);
let finalUrl: string = (properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url;
@ -98,7 +100,7 @@ export class ResultLandingService {
(res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['citations'] !== undefined)
? res[1]['extraInfo']['citations']['citation'] : null, // 15
]))
.pipe(map(res => this.parseResultLandingInfo(res, provenanceActionVocabulary, subjectsVocabulary, properties)));
.pipe(map(res => this.parseResultLandingInfo(res, provenanceActionVocabulary, subjectsVocabulary, relationsVocabulary, properties)));
}
// getProvenanceActionVocabulary (properties: EnvProperties): any {
@ -124,7 +126,7 @@ export class ResultLandingService {
return throwError(error || 'Server error');
}
parseResultLandingInfo (data: any, provenanceActionVocabulary: any, subjectsVocabulary: any, properties: EnvProperties): any {
parseResultLandingInfo (data: any, provenanceActionVocabulary: any, subjectsVocabulary: any, relationsVocabulary: any, properties: EnvProperties): any {
this.resultLandingInfo = new ResultLandingInfo();
// res
@ -186,7 +188,12 @@ export class ResultLandingService {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary);
}
if(relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
let relationName = relation.to.class;
let relationName: string = relation.to.class;
if(relation.to.class) {
if(relationsVocabulary != null && relation.to.class in relationsVocabulary) {
relationName = relationsVocabulary[relation.to.class];
}
}
if(!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
this.resultLandingInfo.relatedClassFilters.add(relationName);
}
@ -196,7 +203,7 @@ export class ResultLandingService {
provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
}
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, 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);
}

@ -438,7 +438,7 @@ export class OrcidWorkComponent {
}
private getResultLandingInfo(action: string) {
this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, null, properties).subscribe(
this.subscriptions.push(this.resultLandingService.getResultLandingInfo(this.resultId, null, this.type, null, null, null, properties).subscribe(
resultLandingInfo => {
this.resultLandingInfo = resultLandingInfo;
if (this.resultLandingInfo && this.resultLandingInfo.identifiers) {

@ -2,9 +2,6 @@ import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {SearchResult} from '../utils/entities/searchResult';
import {RefineResultsUtils} from './servicesUtils/refineResults.class';
import {StringUtils} from '../utils/string-utils.class';
import{EnvProperties} from '../utils/properties/env-properties';
import {map} from "rxjs/operators";
@ -31,11 +28,9 @@ export class SearchDataprovidersService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
}
//((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false ):any {
let url = properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
@ -52,100 +47,9 @@ export class SearchDataprovidersService {
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
}
searchCompatibleDataprovidersTable ( properties:EnvProperties):any {
let size: number = 0;
let url: string= properties.searchResourcesAPIURL;
url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
url += "&page=0&size=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['meta'].total));
}
searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
let url: string = properties.searchResourcesAPIURL;
url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
}
searchEntityRegistriesTable (properties:EnvProperties):any {
let size: number = 0;
let url: string= properties.searchResourcesAPIURL;
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
url += "&page=0&size=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['meta'].total));
}
searchEntityRegistries (params: string,refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
let url = properties.searchResourcesAPIURL;
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
}
searchJournalsTable ( properties:EnvProperties):any {
let size: number = 0;
let url: string= properties.searchResourcesAPIURL;
url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
url += "&page=0&size=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)//.map(res => <any> res.json())
.pipe(map(res => res['meta'].total));
}
searchJournals (params: string,refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties):any {
let url: string = properties.searchResourcesAPIURL;
//url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
}
searchDataprovidersForDeposit (id: string,type:string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchResourcesAPIURL;
var compatibilities = "";
@ -165,39 +69,6 @@ export class SearchDataprovidersService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
searchDataprovidersForDepositSearch(params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties, usedBy: string="search" ):any {
let link = properties.searchResourcesAPIURL;
let url = link+"?query=((deletedbyinference = false) AND (oaftype exact datasource)) "+params;
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],
refineFields, "datasource", usedBy)]));
}
searchDataProvidersBySubjects(keyword:string, type:string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchResourcesAPIURL;
var compatibilities = "";
if(type == "Research Data"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
}else if(type == "Publications"){
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
}
let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+
compatibilities+" ":"")+") "+
" and (datasourcesubject all "+'"'+keyword+'"'+") " ;
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
getDataProvidersforEntityRegistry(datasourceId: string, page: number, size: number , properties:EnvProperties):any {
let url = properties.searchResourcesAPIURL;
var basicQuery = "(oaftype exact datasource) "
@ -222,66 +93,6 @@ export class SearchDataprovidersService {
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
/*
searchDataprovidersCSV (params: string, refineParams:string, page: number, size: number):any {
let link = OpenaireProperties. getSearchAPIURLLast()+"datasources";
let url = link+"?";
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => this.parseResultsCSV(res['results']));
}
*/
/*
searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any {
let url = properties.searchAPIURLLAst;
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page - 1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => this.parseResultsCSV(res['results']));
}
*/
/*
searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any {
let url = properties.searchAPIURLLAst;
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page - 1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => this.parseResultsCSV(res['results']));
}
*/
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
@ -319,7 +130,6 @@ export class SearchDataprovidersService {
}
let typeid: string = resData['datasourcetype'].classid;
//console.info(typeid);
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
if(resData.hasOwnProperty('accessinfopackage')) {
@ -349,7 +159,6 @@ export class SearchDataprovidersService {
result['organizations'] = res[1];
result['countries'] = res[0];
result['subjects'] = this.getDataproviderSubjects(resData);
//console.log(result['subjects']);
if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
@ -432,30 +241,9 @@ export class SearchDataprovidersService {
}
return [countries, organizations];
}
/*
parseResultsCSV(data: any): any {
let results: any = [];
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:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
var result: any = [];
result.push(this.quote(resData.officialname));
result.push(this.quote(this.getDataproviderType(resData)));
result.push(this.quote(this.getDataproviderCountriesOrganizations(resData, true, false)[0]));
result.push(this.quote(this.getDataproviderCompatibility(resData)));
results.push(result);
}
return results;
}
*/
numOfDataproviders(url: string, properties:EnvProperties):any {
//let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['total']));
}
@ -491,29 +279,4 @@ export class SearchDataprovidersService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => res['meta']['total']));
}
/*
private quote(word: any): string {
return '"'+word+'"';
}
*/
getDataprovidersTableResults (queryType:string, properties:EnvProperties):any {
let size: number = 0;
let url: string= properties.searchAPIURLLAst;
if(queryType == "compatible"){
url += '?query=((oaftype exact datasource) not (datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
}else if(queryType=="registries"){
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
}else if(queryType=="journals"){
url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
}
url += "&page=0&size=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['meta'].total));
}
}

@ -91,7 +91,7 @@ export class ConfigurationService {
}
async isPageEnabledByStateAsync(properties: EnvProperties, portal: string, page_route: string) {
if (!this.promise || portal !== this.communityInformation.getValue().pid) {
if (!this.promise || (this.communityInformation && this.communityInformation.getValue() && portal !== this.communityInformation.getValue().pid)) {
this.initCommunityInformation(properties, portal);
}

@ -249,64 +249,6 @@ export class FetchDataproviders {
}
}
public getResultsBySubjectsForDeposit(subject: string, type: string, page: number, size: number, properties: EnvProperties) {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.results = [];
this.searchUtils.totalResults = 0;
this.loadPaging = false;
this.subscriptions.push(this._searchDataprovidersService.searchDataProvidersBySubjects(subject, type, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if (this.searchUtils.totalResults == 0) {
this.searchUtils.status = this.errorCodes.NONE;
}
if (this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if (totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
this.loadPaging = true;
this.oldTotalResults = this.searchUtils.totalResults;
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+OpenaireEntities.DATASOURCES+" in share " + type + " by subject: " + subject, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.loadPaging = true;
this.oldTotalResults = 0;
}
));
}
public getResultsForEntity(entity: string, id: string, page: number, size: number, properties: EnvProperties) {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;

@ -106,9 +106,7 @@ export interface EnvProperties {
searchLinkToOrganizations?: string;
searchLinkToCompatibleDataProviders?: string;
searchLinkToEntityRegistriesDataProviders?: string;
searchLinkToEntityRegistriesDataProvidersTable?: string;
searchLinkToJournals?: string;
searchLinkToJournalsTable?: string;
searchLinkToResults?: string;
//Advanced Search for pages
searchLinkToAdvancedPublications?: string;

@ -607,9 +607,19 @@ export class SearchFields {
},
};
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
// public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
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", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic",
"datasourcejurisdiction"];
// public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic",
"datasourcejurisdiction"];
//ORGANIZATION

@ -37,8 +37,7 @@
<!-- Title -->
<div>
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
<a *ngIf="!externalUrl && result.id && !(result.resultType == 'dataprovider' && result.compatibilityUNKNOWN && properties.adminToolsPortalType != 'eosc') "
(click)="onClick()" [queryParams]="createParam()"
<a *ngIf="!externalUrl && result.id" (click)="onClick()" [queryParams]="createParam()"
[routerLink]="url" class="uk-link uk-link-heading uk-width-expand">
<div *ngIf="(result.title) || result.acronym">
<span *ngIf="result.acronym">
@ -52,8 +51,7 @@
[no title available]
</div>
</a>
<a *ngIf="externalUrl && result.id && !(result.resultType == 'dataprovider' && result.compatibilityUNKNOWN) "
(click)="onClick()"
<a *ngIf="externalUrl && result.id" (click)="onClick()"
target="_blank" [href]="externalUrl+result.id" class="custom-external uk-link uk-link-heading uk-width-expand">
<span *ngIf="(result.title) || result.acronym">
<span *ngIf="result.acronym">
@ -68,8 +66,7 @@
</span>
</a>
<div *ngIf="!result.id || (result.resultType == 'dataprovider' && result.compatibilityUNKNOWN && properties.adminToolsPortalType != 'eosc')"
class="uk-width-expand">
<div *ngIf="!result.id" class="uk-width-expand">
<div *ngIf="(result.title) || result.acronym">
<span *ngIf="result.acronym">
{{result.acronym}}
@ -139,7 +136,7 @@
<span
*ngIf="result.compatibility != undefined && result.compatibility != '' && result.compatibility == 'not available'
&& result.resultType != 'service'"
class="uk-label uk-label-danger" title="OpenAIRE Compatibility">
class="uk-label" [class.uk-label-danger]="deposit" title="OpenAIRE Compatibility">
Not yet registered <span *ngIf="properties.adminToolsPortalType == 'eosc'">in OpenAIRE</span>
</span>{{' '}}
</div>

@ -32,6 +32,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
@Input() showOrcid: boolean = true;
@Input() showEnermaps: boolean = false;
@Input() deposit: boolean = false;
ngOnInit(): void {
if(this.hasLink) {

@ -11,6 +11,7 @@ export class ISVocabulariesService {
private vocabularies: Map<string, BehaviorSubject<AutoCompleteValue[]>> = new Map<string, BehaviorSubject<AutoCompleteValue[]>>();
private provenanceActionVocabulary: BehaviorSubject<{}> = new BehaviorSubject(null);
private subjectsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
private relationsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
private subscriptions = [];
private vocabulariesPromises: Map<string, Promise<any>> = new Map<string, Promise<any>>();
constructor(private http: HttpClient) {}
@ -259,6 +260,47 @@ export class ISVocabulariesService {
return subjectsVocabulary;
}
getRelationsVocabulary(properties: EnvProperties): Observable<any> {
let vocabulary = "dnet:relation_relClass.json";
return from(this.getRelationsVocabularyFromServiceAsync(vocabulary, properties));
}
async getRelationsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
if(!this.relationsVocabulary || !this.relationsVocabulary.getValue()) {
await new Promise<any>(resolve => {
this.subscriptions.push(this.getRelationsVocabularyFromService(vocabularyName, properties).subscribe(
vocabularyRes => {
this.relationsVocabulary.next(vocabularyRes);
resolve();
},
error => {
this.relationsVocabulary.next(null);
resolve();
}
));
});
}
return this.relationsVocabulary.getValue();
}
getRelationsVocabularyFromService (vocabularyName: string, properties: EnvProperties): any {
let url = properties.vocabulariesAPI+vocabularyName;
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['terms']))
.pipe(map(res => this.parseRelationsVocabulary(res)));
}
parseRelationsVocabulary(terms: any) {
var relationsVocabulary: {} = {};
for(let term of terms) {
if(term.code != "keyword") {
relationsVocabulary[term.code] = term.englishName;
}
}
return relationsVocabulary;
}
private handleError(error: HttpErrorResponse) {
// in a real world app, we may send the error to some remote logging infrastructure

Loading…
Cancel
Save