2020-02-25 16:40:56 +01:00
import { Filter , Value } from "./searchHelperClasses.class" ;
2022-05-05 19:35:08 +02:00
import { OpenaireEntities , SearchFields } from "../../utils/properties/searchFields" ;
2022-02-16 17:43:20 +01:00
import { properties } from "../../../../environments/environment" ;
2020-02-25 16:40:56 +01:00
export class DatasourcesHelperClass {
2022-05-13 14:57:31 +02:00
public static getrefineFields ( type : "all" | "registries" | "journals" | "compatible" | "deposit" | "services" ) {
2020-02-25 16:40:56 +01:00
let searchFields :SearchFields = new SearchFields ( ) ;
if ( type == "registries" ) {
return searchFields . ENTITY_REGISTRIES_FIELDS ;
} else if ( type == "journals" ) {
return searchFields . JOURNAL_FIELDS ;
} else if ( type == "compatible" ) {
return searchFields . COMPATIBLE_DATAPROVIDER_FIELDS ;
2020-03-12 18:03:35 +01:00
} else if ( type == "deposit" ) {
return searchFields . DEPOSIT_DATASOURCE_REFINE_FIELDS ;
2020-02-25 16:40:56 +01:00
} else {
return searchFields . DATASOURCE_REFINE_FIELDS ;
}
}
2022-05-13 14:57:31 +02:00
public static getTitle ( type : "all" | "registries" | "journals" | "compatible" | "deposit" | "services" ) {
2020-02-25 16:40:56 +01:00
if ( type == "registries" ) {
2022-09-30 13:51:00 +02:00
return "Research Entity Registries"
2020-02-25 16:40:56 +01:00
} else if ( type == "journals" ) {
return "Journals"
} else if ( type == "compatible" ) {
2022-05-05 19:35:08 +02:00
return "Compatible " + OpenaireEntities . DATASOURCES ;
2022-05-13 14:57:31 +02:00
} else if ( type == "services" ) {
return OpenaireEntities . SERVICES ;
2020-02-25 16:40:56 +01:00
} else {
2022-05-05 19:35:08 +02:00
return OpenaireEntities . DATASOURCES ;
2020-02-25 16:40:56 +01:00
}
}
2022-05-13 14:57:31 +02:00
public static getDescription ( type : "all" | "registries" | "journals" | "compatible" | "deposit" | "services" ) {
2020-08-19 12:16:43 +02:00
if ( type == "registries" ) {
2021-04-28 17:54:30 +02:00
return [ "Entity Registries" , "Discover research Entity Registries." , "For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level." ] ;
2020-08-19 12:16:43 +02:00
} else if ( type == "journals" ) {
2022-05-05 19:35:08 +02:00
return [ "Research journals" , "Discover research Journals. " , "For each entity are available description, subjects, related " + OpenaireEntities . DATASOURCES . toLowerCase ( ) + ", publications and " + OpenaireEntities . RESULTS . toLowerCase ( ) + " per year and type." ] ;
2020-08-19 12:16:43 +02:00
} else if ( type == "compatible" ) {
2022-05-13 14:57:31 +02:00
return [ "research repositories" , "Discover publication, data, software, istitutional and thematic repositories." , "Available repository " + OpenaireEntities . RESULTS . toLowerCase ( ) + " per year and type." ] ;
} else if ( type == "services" ) {
return [ OpenaireEntities . SERVICES , "Discover worldwide research " + OpenaireEntities . SERVICES . toLowerCase ( ) + " and correlated research." , "Statistics data about produced " + OpenaireEntities . RESULTS . toLowerCase ( ) + " per year available." ] ;
2020-08-19 12:16:43 +02:00
} else {
2022-05-05 19:35:08 +02:00
return [ OpenaireEntities . DATASOURCES , "Discover worldwide research " + OpenaireEntities . DATASOURCES . toLowerCase ( ) + " and correlated research." , "Statistics data about produced " + OpenaireEntities . RESULTS . toLowerCase ( ) + " per year available." ] ;
2020-08-19 12:16:43 +02:00
}
}
2022-05-13 14:57:31 +02:00
public static getQueryPrefix ( type : "all" | "registries" | "journals" | "compatible" | "deposit" | "services" ) : string {
2022-06-20 14:56:29 +02:00
if ( type == "registries" ) {
2022-09-30 13:51:00 +02:00
return 'eoscdatasourcetype exact "Research Entity Registry"' ;
2022-06-20 14:56:29 +02:00
} else if ( type == "journals" ) {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
2022-09-30 13:51:00 +02:00
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and eoscdatasourcetype exact "Journal Archive" ' ;
2022-02-16 17:43:20 +01:00
2022-06-20 14:56:29 +02:00
} else if ( type == "compatible" ) {
2022-09-30 13:51:00 +02:00
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and eoscdatasourcetype exact "Repository" ' ;
2022-06-20 14:56:29 +02:00
} else if ( type == "deposit" ) {
2022-09-30 13:51:00 +02:00
return ' oaftype exact datasource and (eoscdatasourcetype exact "Journal Archive" or eoscdatasourcetype exact "Repository")' ;
2022-06-20 14:56:29 +02:00
} else {
return "" ;
}
2020-02-25 16:40:56 +01:00
}
2022-05-13 14:57:31 +02:00
public static createFilters ( type : "all" | "registries" | "journals" | "compatible" | "deposit" | "services" ) : Filter [ ] {
2020-02-25 16:40:56 +01:00
if ( type == "registries" ) {
return this . createRegistriesFilters ( ) ;
} else if ( type == "journals" ) {
return this . createJournalFilters ( ) ;
2022-02-16 17:43:20 +01:00
/ * } e l s e i f ( t y p e = = " c o m p a t i b l e " ) {
return this . createCompatibleFilters ( ) ; * /
2020-02-25 16:40:56 +01:00
} else {
return [ ] ;
}
}
private static createCompatibleFilters ( ) : Filter [ ] {
var filter_names = [ "Type" , "Compatibility Level" ] ;
var filter_ids = [ "datasourcetypeuiid" , "datasourcecompatibilityname" ] ;
var searchFields = new SearchFields ( ) ;
var filter_original_ids = searchFields . COMPATIBLE_DATAPROVIDER_FIELDS ;
var value_names = [
[
"Institutional Repository" , "Thematic Repository" , "Publication Repository" ,
"Institutional Repository Aggregator" ,
"Thematic Repository Aggregator" , "Publication Repository Aggregator" ,
"Data Repository" , "Data Repository Aggregator" , "CRIS System" , "Publication Catalogue" ,
"Software Repository" , "Software Repository Aggregator" ] ,
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" , "OpenAIRE CRIS v1.1" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
2020-02-26 12:24:50 +01:00
//{"englishName":"OpenAIRE 4.0 (inst.&thematic. repo.)","nativeName":"OpenAIRE 4.0 (inst.&thematic. repo.)","encoding":"OPENAIRE","code":"openaire4.0","synonyms":null}
2020-02-25 16:40:56 +01:00
var value_original_ids = [
[ "pubsrepository::institutional" , "pubsrepository::thematic" , "pubsrepository::unknown" , "aggregator::pubsrepository::institutional" , "aggregator::pubsrepository::thematic" , "aggregator::pubsrepository::unknown" ,
"datarepository::unknown" , "aggregator::datarepository" , "crissystem" , "pubscatalogue::unknown" , "softwarerepository" , "aggregator::softwarerepository" ] ,
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" , "OpenAIRE CRIS v1.1" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
var filters : Filter [ ] = [ ] ;
for ( var i = 0 ; i < filter_names . length ; i ++ ) {
var values : Value [ ] = [ ] ;
for ( var j = 0 ; j < value_names [ i ] . length ; j ++ ) {
var value : Value = { name : value_names [ i ] [ j ] , id : value_original_ids [ i ] [ j ] , number : 0 , selected : false }
values . push ( value ) ;
}
var filter : Filter = {
title : filter_names [ i ] ,
filterId : filter_ids [ i ] ,
originalFilterId : filter_original_ids [ i ] ,
values : values ,
countSelectedValues : 0 ,
"filterOperator" : 'or' ,
valueIsExact : true ,
filterType : "checkbox"
} ;
filters . push ( filter ) ;
}
return filters ;
}
private static createRegistriesFilters ( ) : Filter [ ] {
var filter_names = [ "Type" , "Compatibility Level" ] ;
var filter_ids = [ "datasourcetypename" , "datasourcecompatibilityname" ] ;
var searchFields = new SearchFields ( ) ;
var filter_original_ids = searchFields . ENTITY_REGISTRIES_FIELDS ;
var value_names = [
[ "Funder" , "Registry of repositories" , "Scholarly Comm. Infrastructure" , "Registry" , "Information Space" , "Web Source" ] ,
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
var value_original_ids = [
[ "Funder database" , "Registry of repositories" , "Scholarly Comm. Infrastructure" , "Registry" , "Information Space" , "Web Source" ] ,
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
var filters : Filter [ ] = [ ] ;
for ( var i = 0 ; i < filter_names . length ; i ++ ) {
var values : Value [ ] = [ ] ;
for ( var j = 0 ; j < value_names [ i ] . length ; j ++ ) {
var value : Value = { name : value_names [ i ] [ j ] , id : value_original_ids [ i ] [ j ] , number : 0 , selected : false }
values . push ( value ) ;
}
var filter : Filter = {
title : filter_names [ i ] ,
filterId : filter_ids [ i ] ,
originalFilterId : filter_original_ids [ i ] ,
values : values ,
countSelectedValues : 0 ,
"filterOperator" : 'or' ,
valueIsExact : true ,
filterType : "checkbox"
} ;
filters . push ( filter ) ;
}
return filters ;
}
private static createJournalFilters ( ) : Filter [ ] {
var filter_names = [ "Type" , "Compatibility Level" ] ;
var filter_ids = [ "datasourcetypeuiid" , "datasourcecompatibilityname" ] ;
var searchFields = new SearchFields ( ) ;
var filter_original_ids = searchFields . JOURNAL_FIELDS ;
var value_names = [
/ * [
"Institutional Publication Repository" , "Thematic Publication Repository" , "Other Publication Repository" ,
"Institutional Repositories Aggregators" ,
"Thematic Repositories Aggregators" , "Other Repositories Aggregators" ,
"Data Repositories" , "Data Repositories Aggregators" , "Journals" , "Journals Aggregators" , "CRIS Systems" , "Publication Catalogues" ] ,
* /
[ "Journal" , "Journal Aggregator\/Publisher" ] ,
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
var value_original_ids = [
[ "pubsrepository::journal" , "aggregator::pubsrepository::journals" ] ,
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
2020-02-26 12:24:50 +01:00
[ "OpenAIRE Basic (DRIVER OA)" , "OpenAIRE 2.0 (EC funding)" , "OpenAIRE 2.0+ (DRIVER OA, EC funding)" , "OpenAIRE 3.0 (OA, funding)" , "OpenAIRE 4.0 (inst.&thematic. repo.)" , "OpenAIRE Data (funded, referenced datasets)" ,
2020-02-25 16:40:56 +01:00
"collected from a compatible aggregator" , "proprietary" , "under validation" ] ] ;
var filters : Filter [ ] = [ ] ;
for ( var i = 0 ; i < filter_names . length ; i ++ ) {
var values :Value [ ] = [ ] ;
for ( var j = 0 ; j < value_names [ i ] . length ; j ++ ) {
var value :Value = { name : value_names [ i ] [ j ] , id : value_original_ids [ i ] [ j ] , number : 0 , selected :false }
values . push ( value ) ;
}
var filter :Filter = { title : filter_names [ i ] , filterId : filter_ids [ i ] , originalFilterId : filter_original_ids [ i ] , values : values , countSelectedValues :0 , "filterOperator" : 'or' , valueIsExact : true , filterType : "checkbox" } ;
filters . push ( filter ) ;
}
return filters ;
}
}