2020-11-11 15:43:13 +01:00
import { Injectable , OnDestroy } from '@angular/core' ;
2019-06-05 15:33:18 +02:00
import { HttpClient } from "@angular/common/http" ;
import { SearchResult } from '../utils/entities/searchResult' ;
import { RefineResultsUtils } from './servicesUtils/refineResults.class' ;
2020-07-29 13:04:37 +02:00
import { Dates , DOI , StringUtils } from '../utils/string-utils.class' ;
2019-06-05 15:33:18 +02:00
import { ParsingFunctions } from '../landingPages/landing-utils/parsingFunctions.class' ;
import { EnvProperties } from '../utils/properties/env-properties' ;
import { map } from "rxjs/operators" ;
2021-02-10 10:36:39 +01:00
import { properties } from "../../../environments/environment" ;
2023-02-16 15:33:40 +01:00
import { HostedByCollectedFrom } from "../utils/result-preview/result-preview" ;
2019-06-05 15:33:18 +02:00
@Injectable ( )
export class SearchResearchResultsService {
2021-03-10 14:24:19 +01:00
public parsingFunctions : ParsingFunctions = new ParsingFunctions ( ) ;
2021-06-15 14:54:40 +02:00
2023-02-16 15:33:40 +01:00
constructor ( private http : HttpClient = null ) {
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
search ( resultType : string , params : string , refineParams : string , page : number , size : number , sortBy : string , refineFields : string [ ] , properties : EnvProperties ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let link = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let url = link + "?" ;
if ( params != null && params != '' ) {
url += params ;
2020-11-11 15:43:13 +01:00
}
2021-03-10 14:24:19 +01:00
if ( refineParams != null && refineParams != '' ) {
url += refineParams ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
if ( sortBy ) {
url += "&sortBy=" + sortBy ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
url += "&page=" + ( page - 1 ) + "&size=" + size + "&format=json" ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) , RefineResultsUtils . parse ( res [ 'refineResults' ] , refineFields , "publication" ) ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
searchById ( resultType : string , id : string , properties : EnvProperties ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let url = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) + "/" + id + "?format=json" ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > this . parseResults ( resultType , res , properties ) ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
searchAggregators ( resultType : string , id : string , params : string , refineParams : string , page : number , size : number , properties : EnvProperties ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let link = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let url = link + "?" + "&format=json" ;
if ( params != null && params != '' ) {
url += params ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
if ( refineParams != null && refineParams != '' ) {
url += refineParams ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
url += "&page=" + ( page - 1 ) + "&size=" + size ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > this . parseRefineResults ( id , res [ 'refineResults' ] ) ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
searchByListOfDOI ( resultType : string , DOIs : string [ ] , refineParams : string , page : number , size : number , refineFields : string [ ] , properties : EnvProperties ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let link = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let url = link + "?" + "&format=json&" ;
var doisParams = "" ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( var i = 0 ; i < DOIs . length ; i ++ ) {
doisParams += ( doisParams . length > 0 ? "&" : "" ) + 'doi="' + DOIs [ i ] + '"' ;
}
if ( doisParams . length > 0 ) {
url += "&" + doisParams ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
}
if ( refineParams != null && refineParams != '' ) {
url += refineParams ;
}
url += "&page=" + ( page - 1 ) + "&size=" + size ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) , RefineResultsUtils . parse ( res [ 'refineResults' ] , refineFields , "publication" ) ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
advancedSearch ( resultType : string , params : string , page : number , size : number , sortBy : string , properties : EnvProperties , refineParams : string = null , refineFields : string [ ] = null , refineQuery : string = null ) : any {
let url = properties . searchResourcesAPIURL ;
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
var basicQuery = "(oaftype exact result) and (resulttypeid exact " + this . getEntityQueryName ( resultType , false ) + ") " ;
2021-03-10 14:24:19 +01:00
url += "?query=" ;
if ( params != null && params != '' ) {
url += " ( " + basicQuery + " ) " + " and (" + params + ")" ;
} else {
url += " ( " + basicQuery + " ) " ;
}
if ( refineParams != null && refineParams != '' ) {
url += refineParams ;
}
if ( sortBy ) {
let sortOptions = sortBy . split ( "," ) ;
url += "sortBy " + sortOptions [ 0 ] + "/sort." + sortOptions [ 1 ] + " " ;
}
if ( refineQuery ) {
url += "&" + refineQuery ;
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
url += "&page=" + ( page - 1 ) + "&size=" + size ;
url += "&format=json" ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) , RefineResultsUtils . parse ( res [ 'refineResults' ] , refineFields , "publication" ) ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
advancedSearchResults ( resultType : string , params : string , page : number , size : number , sortBy : string , properties : EnvProperties , refineParams : string = null , refineFields : string [ ] = null , refineQuery : string = null ) : any {
let url = properties . searchAPIURLLAst + "resources2/?format=json" ;
if ( params != null && params != '' ) {
url += "&query=(" + params + ")" ;
2020-02-11 12:58:51 +01:00
}
2021-03-10 14:24:19 +01:00
if ( sortBy ) {
2020-02-11 12:58:51 +01:00
let sortOptions = sortBy . split ( "," ) ;
2021-03-10 14:24:19 +01:00
url += ( params ? " " : "&query=(*) " ) + "sortBy " + sortOptions [ 0 ] + "/sort." + sortOptions [ 1 ] + ( params ? " " : " " ) ;
2020-02-24 14:19:16 +01:00
}
2021-03-10 14:24:19 +01:00
if ( refineParams != null && refineParams != '' ) {
2020-02-24 14:19:16 +01:00
url += refineParams ;
2020-02-11 12:58:51 +01:00
}
2021-03-10 14:24:19 +01:00
if ( refineQuery ) {
2020-02-11 12:58:51 +01:00
url += "&" + refineQuery ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
url += "&page=" + ( page - 1 ) + "&size=" + size ;
2020-02-11 12:58:51 +01:00
// url += "&format=json";
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) , RefineResultsUtils . parse ( res [ 'refineResults' ] , refineFields , "publication" ) ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
searchResultForEntity ( resultType : string , params : string , page : number , size : number , properties : EnvProperties ) : any {
let link = properties . searchAPIURLLAst ;
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
//let url = link+params+"/"+this.getEntityQueryName(resultType,true)+ "?format=json";
2021-03-10 14:24:19 +01:00
//url += "&page="+(page-1)+"&size="+size;
//url += "&sortBy=resultdateofacceptance,descending";
2023-02-16 15:33:40 +01:00
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true);
2023-02-16 15:33:40 +01:00
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let url = link + "/" + this . getEntityQueryName ( resultType , true ) ;
2021-03-10 14:24:19 +01:00
url += "?format=json" ;
url += "&fq=" + params ;
url += "&sortBy=resultdateofacceptance,descending" ;
url += "&page=" + ( page - 1 ) + "&size=" + size ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) ] ) ) ;
2020-02-11 12:58:51 +01:00
}
2019-09-11 11:45:54 +02:00
2019-06-05 15:33:18 +02:00
//???? why different from above?
2021-03-10 14:24:19 +01:00
searchForDataproviders ( resultType : string , params : string , page : number , size : number , properties : EnvProperties ) : any {
let link = properties . searchAPIURLLAst ;
let url = link + params ;
url += "&sortBy=resultdateofacceptance,descending" ;
url += "&page=" + ( page - 1 ) + "&size=" + size + "&format=json" ;
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
searchForMyOrcidLinks ( resultType : string , orcidQuery : string , typeQuery : string , page : number , size : number ) : any {
let url = properties . searchAPIURLLAst + "resources2/?format=json" ;
if ( orcidQuery != null && orcidQuery != '' ) {
url += "&query=(" + orcidQuery + ")" ;
2021-02-10 10:36:39 +01:00
}
url += typeQuery ;
2021-03-10 14:24:19 +01:00
url += "&page=" + ( page - 1 ) + "&size=" + size ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > [ res [ 'meta' ] . total , this . parseResults ( resultType , res [ 'results' ] , properties ) ] ) ) ;
2021-02-10 10:36:39 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
parseResults ( resultType : string , data : any , properties : EnvProperties ) : SearchResult [ ] {
let results : SearchResult [ ] = [ ] ;
2023-02-16 15:33:40 +01:00
if ( data == null ) {
2021-06-15 14:54:40 +02:00
return results ;
}
2021-03-10 14:24:19 +01:00
let length = Array . isArray ( data ) ? data.length : 1 ;
2021-06-15 14:54:40 +02:00
2021-03-10 14:24:19 +01:00
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' ] ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
var result : SearchResult = new SearchResult ( ) ;
if ( resData [ 'resulttype' ] ) {
result . entityType = resData [ 'resulttype' ] [ 'classname' ] ;
} else {
result . entityType = resultType ;
}
2023-02-16 15:33:40 +01:00
result [ 'title' ] = { "name" : '' , "accessMode" : '' } ;
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 ;
}
2021-03-10 14:24:19 +01:00
result . types = new Array < string > ( ) ;
let types = new Set < string > ( ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let instance ;
let length = Array . isArray ( resData [ 'children' ] [ 'instance' ] ) ? resData [ 'children' ] [ 'instance' ] . length : 1 ;
2023-02-18 02:44:30 +01:00
result . hostedBy_collectedFrom = new Array < HostedByCollectedFrom > ( ) ;
2021-03-10 14:24:19 +01:00
for ( let i = 0 ; i < length ; i ++ ) {
instance = Array . isArray ( resData [ 'children' ] [ 'instance' ] ) ? resData [ 'children' ] [ 'instance' ] [ i ] : resData [ 'children' ] [ 'instance' ] ;
this . parsingFunctions . parseTypes ( result . types , types , instance ) ;
2023-02-16 15:33:40 +01:00
if ( instance ? . hasOwnProperty ( "hostedby" ) ) {
if ( instance . hasOwnProperty ( "webresource" ) ) {
let url = Array . isArray ( instance [ 'webresource' ] ) ? instance [ 'webresource' ] [ 0 ] . url :instance [ 'webresource' ] . url ;
if ( url . includes ( '&' ) ) {
url = url . replace ( / & a m p ; / g m u , ' & ' ) ;
}
if ( instance . hasOwnProperty ( "hostedby" ) ) {
this . parsingFunctions . parseHostedBy_collectedFrom ( result . hostedBy_collectedFrom , instance , url , result . title . accessMode ) ;
}
}
}
2021-03-10 14:24:19 +01:00
}
2023-02-18 02:44:30 +01:00
result . hostedBy_collectedFrom . sort ( this . parsingFunctions . compareHostedByCollectedFrom ) ;
2023-02-16 15:33:40 +01:00
// Measure
result . measure = this . parsingFunctions . parseMeasures ( resData [ 'measure' ] ) ;
2021-03-10 14:24:19 +01:00
/////////////////////////// Athena Code ///////////////////////////
if ( resData [ 'pid' ] ) {
if ( ! Array . isArray ( resData [ 'pid' ] ) ) {
if ( resData [ 'pid' ] . classid && resData [ 'pid' ] . classid == 'doi' ) {
if ( resData [ 'pid' ] . content != '' && resData [ 'pid' ] . content != null ) {
2023-02-16 15:33:40 +01:00
result . DOIs . push ( ( resData [ 'pid' ] . content + "" ) . replace ( "https://doi.org/" , "" ) ) ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
} else {
for ( let i = 0 ; i < resData [ 'pid' ] . length ; i ++ ) {
if ( resData [ 'pid' ] [ i ] . classid == 'doi' ) {
2021-06-15 14:54:40 +02:00
if ( resData [ 'pid' ] [ i ] . content != '' && resData [ 'pid' ] [ i ] . content != null && resData [ 'pid' ] [ i ] . content ) {
2023-02-16 15:33:40 +01:00
result . DOIs . push ( ( resData [ 'pid' ] [ i ] . content + "" ) . replace ( "https://doi.org/" , "" ) ) ;
2021-02-20 10:20:05 +01:00
}
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
}
result . identifiers = this . parsingFunctions . parseIdentifiers ( resData [ 'pid' ] ) ;
}
/////////////////////////// Athena Code ///////////////////////////
if ( resData [ 'programmingLanguage' ] && resData [ 'programmingLanguage' ] != null ) {
result . programmingLanguages = new Array < string > ( ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
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 [ 'programmingLanguage' ] . length ; i ++ ) {
if ( resData [ 'programmingLanguage' ] [ i ] . classname != "Undetermined" && resData [ 'programmingLanguage' ] [ i ] . classname ) {
result . programmingLanguages . push ( resData [ 'programmingLanguage' ] [ i ] . classname ) ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
}
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( resData [ 'language' ] && resData [ 'language' ] != null ) {
result . languages = new Array < string > ( ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( ! Array . isArray ( resData [ 'language' ] ) ) {
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 ] . classname != "Undetermined" && resData [ 'language' ] [ i ] . classname ) {
result . languages . push ( resData [ 'language' ] [ i ] . classname ) ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
}
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( resData [ 'country' ] && resData [ 'country' ] != null ) {
result . countriesForResults = new Array < string > ( ) ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
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 [ 'country' ] . length ; i ++ ) {
if ( resData [ 'country' ] [ i ] . classname != "Undetermined" && resData [ 'country' ] [ i ] . classname ) {
result . countriesForResults . push ( resData [ 'country' ] [ i ] . classname ) ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
}
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
result [ 'id' ] = Array . isArray ( data ) ? data [ i ] [ 'result' ] [ 'header' ] [ 'dri:objIdentifier' ] : data [ 'result' ] [ 'header' ] [ 'dri:objIdentifier' ] ;
2022-11-07 11:55:55 +01:00
result [ 'objId' ] = result [ 'id' ] ;
2021-03-10 14:24:19 +01:00
let canId = ParsingFunctions . parseRelCanonicalId ( Array . isArray ( data ) ? data [ i ] : data , "result" ) ;
if ( canId ) {
result [ 'id' ] = canId ;
}
result [ 'relcanId' ] = result [ 'id' ] ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( resData [ 'rels' ] . hasOwnProperty ( "rel" ) ) {
let relLength = Array . isArray ( resData [ 'rels' ] [ 'rel' ] ) ? resData [ 'rels' ] [ 'rel' ] . length : 1 ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( let j = 0 ; j < relLength ; j ++ ) {
let relation = Array . isArray ( resData [ 'rels' ] [ 'rel' ] ) ? resData [ 'rels' ] [ 'rel' ] [ j ] : resData [ 'rels' ] [ 'rel' ] ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( relation . hasOwnProperty ( "to" ) ) {
2021-09-27 11:19:24 +02:00
if ( relation [ 'to' ] . class && relation [ 'to' ] . class . toLowerCase ( ) == "isproducedby" ) {
2021-03-10 14:24:19 +01:00
result [ 'projects' ] = this . parseProjects ( result [ 'projects' ] , relation ) ;
2019-09-11 11:45:54 +02:00
}
2021-03-10 14:24:19 +01:00
}
2019-06-05 15:33:18 +02:00
}
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( resData . hasOwnProperty ( "creator" ) && resData [ 'creator' ] != null ) {
if ( result [ 'authors' ] == undefined ) {
result [ 'authors' ] = new Array < { "fullName" : string , "orcid" : string , "orcid_pending" : string } > ( ) ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let authors = resData [ 'creator' ] ;
let length = Array . isArray ( authors ) ? authors.length : 1 ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( let i = 0 ; i < length ; i ++ ) {
let author = Array . isArray ( authors ) ? authors [ i ] : authors ;
if ( author ) {
2023-02-16 15:33:40 +01:00
if ( author . orcid ) {
2021-03-11 13:16:13 +01:00
author . orcid = author . orcid . toUpperCase ( ) ;
}
2023-02-16 15:33:40 +01:00
if ( author . orcid_pending ) {
2021-03-11 13:16:13 +01:00
author . orcid_pending = author . orcid_pending . toUpperCase ( ) ;
}
2021-03-10 14:24:19 +01:00
result [ 'authors' ] [ author . rank ] = {
"fullName" : author . content ,
"orcid" : author . orcid ,
"orcid_pending" : author . orcid_pending
} ;
}
}
result . authors = result . authors . filter ( function ( item ) {
return ( item != undefined && item . fullName != undefined ) ;
} ) ;
}
2023-02-16 15:33:40 +01:00
2022-03-15 22:31:10 +01:00
var date : string = ( resData . dateofacceptance ? resData . dateofacceptance : '' ) + '' ; // transform to string in case it is an integer
2021-03-10 14:24:19 +01:00
result . year = ( date && ( date ) . indexOf ( '-' ) !== - 1 ) ? date . split ( '-' ) [ 0 ] : date ;
2022-02-14 16:04:09 +01:00
2022-09-21 12:32:21 +02:00
let abstracts = this . parsingFunctions . parseDescription ( resData . description , true ) ;
2023-02-16 15:33:40 +01:00
result . description = abstracts ;
2022-11-28 18:22:01 +01:00
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( resData . embargoenddate && resData . embargoenddate != '' ) {
result . embargoEndDate = Dates . getDate ( resData . embargoenddate ) ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( ! Array . isArray ( resData . publisher ) ) {
result . publisher = resData . publisher ;
} else {
for ( let i = 0 ; i < resData . publisher . length ; i ++ ) {
if ( result . publisher != undefined ) {
result . publisher += ', ' + resData [ 'publisher' ] [ i ] ;
} else {
result . publisher = resData [ 'publisher' ] [ i ] ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
if ( resData [ 'context' ] != null ) {
2021-04-02 11:17:00 +02:00
result . enermapsId = ParsingFunctions . getEnermapsConceptId ( this . parsingFunctions . parseContexts ( resData [ 'context' ] ) ) ;
}
2023-04-21 12:37:19 +02:00
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 . dateofacceptance ? Dates . getDate ( resData . dateofacceptance ) : null ;
}
if ( resData . journal && resData . journal != null ) {
result . journal = {
"journal" : "" ,
"issn" : "" ,
"lissn" : "" ,
"eissn" : "" ,
"issue" : "" ,
"volume" : "" ,
"start_page" : "" ,
"end_page" : ""
}
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 ;
}
2023-05-08 09:53:38 +02:00
result . hostedBy_collectedFrom = this . parsingFunctions . addPublisherToHostedBy_collectedFrom (
result . hostedBy_collectedFrom , result . publisher ,
result [ 'journal' ] ? result [ 'journal' ] . journal :null , result . identifiers ) ;
2023-04-21 12:37:19 +02:00
2021-03-10 14:24:19 +01:00
results . push ( result ) ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
return results ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
parseProjects ( projects : {
"id" : string , "acronym" : string , "title" : string ,
"funderShortname" : string , "funderName" : string ,
"code" : string
} [ ] , relation : any ) : {
"id" : string , "acronym" : string , "title" : string ,
"funderShortname" : string , "funderName" : string ,
"code" : string
} [ ] {
if ( projects == undefined ) {
projects = new Array < {
"id" : string , "acronym" : string , "title" : string ,
"funderShortname" : string , "funderName" : string ,
"code" : string
} > ( ) ;
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let countProjects = projects . length ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
projects [ countProjects ] = {
"id" : "" , "acronym" : "" , "title" : "" ,
"funderShortname" : "" , "funderName" : "" ,
"code" : ""
} ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( relation . title != 'unidentified' ) {
projects [ countProjects ] [ 'id' ] = relation [ 'to' ] . content ;
projects [ countProjects ] [ 'acronym' ] = relation . acronym ;
projects [ countProjects ] [ 'title' ] = relation . title ;
projects [ countProjects ] [ 'code' ] = relation . code ;
} else {
projects [ countProjects ] [ 'id' ] = "" ;
projects [ countProjects ] [ 'acronym' ] = "" ;
projects [ countProjects ] [ 'title' ] = "" ;
projects [ countProjects ] [ 'code' ] = "" ;
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( relation . hasOwnProperty ( "funding" ) ) {
let fundingLength = Array . isArray ( relation [ 'funding' ] ) ? relation [ 'funding' ] . length : 1 ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( let z = 0 ; z < fundingLength ; z ++ ) {
let fundingData = Array . isArray ( relation [ 'funding' ] ) ? relation [ 'funding' ] [ z ] : relation [ 'funding' ] ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( fundingData . hasOwnProperty ( "funder" ) ) {
projects [ countProjects ] [ 'funderShortname' ] = fundingData [ 'funder' ] . shortname ;
projects [ countProjects ] [ 'funderName' ] = fundingData [ 'funder' ] . name ;
}
}
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
return projects ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
parseRefineResults ( id : string , data : any ) : any {
var results : any = [ ] ;
if ( data . hasOwnProperty ( "resulthostingdatasource" ) ) {
let length = Array . isArray ( data [ 'resulthostingdatasource' ] ) ? data [ 'resulthostingdatasource' ] . length : 1 ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( let i = 0 ; i < length ; i ++ ) {
let datasource = Array . isArray ( data [ 'resulthostingdatasource' ] ) ? data [ 'resulthostingdatasource' ] [ i ] : data [ 'resulthostingdatasource' ] ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
let result : { "name" : string , "id" : string , "count" : number } = { "name" : "" , "id" : "" , "count" : 0 } ;
result [ 'name' ] = datasource . name ;
result [ 'id' ] = datasource . id . split ( "||" ) [ 0 ] ;
result [ 'count' ] = datasource . count ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( result [ 'id' ] != id && result [ 'name' ] != "Unknown Repository" ) {
results . push ( result ) ;
}
}
}
return results ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
private numOfResults ( url : string , properties : EnvProperties ) : any {
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > res [ 'total' ] ) ) ;
2021-03-10 14:24:19 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
numOfEntityResults ( resultType : string , id : string , entity : string , properties : EnvProperties ) : any {
var parameters : string = "" ;
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
parameters = this . getEntityQueryName ( entity , true ) + "/" + id + "/" + this . getEntityQueryName ( resultType , true ) + "/count" ;
2021-03-10 14:24:19 +01:00
let url = properties . searchAPIURLLAst + parameters + "?format=json" ;
return this . numOfResults ( url , properties ) ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
numOfResearchOutcomes ( params : string , properties : EnvProperties , refineParams : string = null ) : any {
let url = properties . searchAPIURLLAst + "resources2/?format=json&size=0&type=results" ;
if ( params . length > 0 ) {
2020-04-07 13:11:31 +02:00
// var DOIs:string[] = DOI.getDOIsFromString(params);
// var doisParams = "";
//
// for(var i =0 ;i < DOIs.length; i++){
// doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
// }
// if(doisParams.length > 0){
// url += "&"+doisParams;
// }else{
// url += "&query=" + StringUtils.URIEncode(params);
// }
url += "&query=" + params ;
2020-02-19 16:35:48 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( refineParams != null && refineParams != '' ) {
2020-02-19 16:35:48 +01:00
url += refineParams ;
}
2021-03-10 14:24:19 +01:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > res [ 'meta' ] [ 'total' ] ) ) ;
2020-02-19 16:35:48 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
numOfSearchResults ( resultType : string , params : string , properties : EnvProperties , refineParams : string = null ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let url = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) + "/count?format=json" ;
2021-03-10 14:24:19 +01:00
if ( params . length > 0 ) {
var DOIs : string [ ] = DOI . getDOIsFromString ( params ) ;
var doisParams = "" ;
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
for ( var i = 0 ; i < DOIs . length ; i ++ ) {
doisParams += ( doisParams . length > 0 ? "&" : "" ) + 'doi="' + DOIs [ i ] + '"' ;
}
if ( doisParams . length > 0 ) {
url += "&" + doisParams ;
} else {
url += "&q=" + StringUtils . URIEncode ( params ) ;
}
2019-06-05 15:33:18 +02:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
if ( refineParams != null && refineParams != '' ) {
url += refineParams ;
}
return this . numOfResults ( url , properties ) ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
numOfSearchResultsLinkedToPub ( resultType : string , properties : EnvProperties ) : any {
let url = properties . searchAPIURLLAst + "resources?query=" + encodeURIComponent ( "( (oaftype exact result) and (resulttypeid exact " + resultType + ") and (relresulttype=publication) )" ) + "&page=0&size=0&format=json" ;
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > res [ 'meta' ] [ 'total' ] ) ) ;
2019-11-08 14:44:00 +01:00
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
countTotalResults ( resultType : string , properties : EnvProperties , refineParams : string = null ) : any {
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
let url = properties . searchAPIURLLAst + this . getEntityQueryName ( resultType , true ) + "/count?format=json" + refineParams ;
2021-03-10 14:24:19 +01:00
return this . numOfResults ( url , properties ) ;
}
2023-02-16 15:33:40 +01:00
2021-03-10 14:24:19 +01:00
/ *
private quote ( word : any ) : string {
return '"' + word + '"' ;
}
* /
2023-02-16 15:33:40 +01:00
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
private getEntityQueryName ( entityType : string , plural : boolean ) {
2021-03-10 14:24:19 +01:00
if ( entityType == "publication" || entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project" ) {
if ( plural ) {
return entityType + "s" ;
} else {
2019-06-05 15:33:18 +02:00
return entityType ;
}
2021-03-10 14:24:19 +01:00
} else {
return entityType ;
2019-06-05 15:33:18 +02:00
}
2021-03-10 14:24:19 +01:00
}
2021-07-14 13:19:57 +02:00
public countCollectedResultsWithFundingInfo ( datasourceId : string ) {
2023-02-16 15:33:40 +01:00
let url = properties . searchAPIURLLAst + "resources?query=" + encodeURIComponent ( "(oaftype=result and collectedfromdatasourceid exact \"" + datasourceId + "\" and relprojectid=*)" ) + "&page=0&size=0&format=json" ;
2021-07-14 13:19:57 +02:00
return this . http . get ( ( properties . useCache ) ? ( properties . cacheUrl + encodeURIComponent ( url ) ) : url )
2023-02-16 15:33:40 +01:00
. pipe ( map ( res = > res [ 'meta' ] [ 'total' ] ) ) ;
2021-07-14 13:19:57 +02:00
}
2023-11-28 10:04:04 +01:00
fetchByDOIs ( DOIs :string [ ] , query :string ) : any {
let url = properties . searchAPIURLLAst + "/researchProducts/byDoi?type=publications" + ( query ? query : "" ) ;
2023-10-25 16:41:13 +02:00
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" ) ] ) ) ;
}
2019-06-05 15:33:18 +02:00
}