2020-06-15 18:57:40 +02:00
|
|
|
------------------------------------------------------
|
|
|
|
------------------------------------------------------
|
|
|
|
-- Additional relations
|
|
|
|
--
|
|
|
|
-- Refereed related tables/views
|
|
|
|
------------------------------------------------------
|
|
|
|
------------------------------------------------------
|
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.publication_refereed purge;
|
|
|
|
|
2022-03-22 15:16:08 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS ${stats_db_name}.publication_refereed STORED AS PARQUET as
|
2020-07-01 12:23:59 +02:00
|
|
|
select substr(r.id, 4) as id, inst.refereed.classname as refereed
|
2020-06-30 00:49:56 +02:00
|
|
|
from ${openaire_db_name}.publication r lateral view explode(r.instance) instances as inst
|
2022-02-03 11:37:10 +01:00
|
|
|
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE;
|
2020-06-30 00:49:56 +02:00
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.dataset_refereed purge;
|
|
|
|
|
2022-03-22 15:16:08 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS ${stats_db_name}.dataset_refereed STORED AS PARQUET as
|
2020-07-01 12:23:59 +02:00
|
|
|
select substr(r.id, 4) as id, inst.refereed.classname as refereed
|
2020-06-30 00:49:56 +02:00
|
|
|
from ${openaire_db_name}.dataset r lateral view explode(r.instance) instances as inst
|
2022-02-03 11:37:10 +01:00
|
|
|
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE;
|
2020-06-30 00:49:56 +02:00
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.software_refereed purge;
|
|
|
|
|
2022-03-22 15:16:08 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS ${stats_db_name}.software_refereed STORED AS PARQUET as
|
2020-07-01 12:23:59 +02:00
|
|
|
select substr(r.id, 4) as id, inst.refereed.classname as refereed
|
2020-06-30 00:49:56 +02:00
|
|
|
from ${openaire_db_name}.software r lateral view explode(r.instance) instances as inst
|
2022-02-03 11:37:10 +01:00
|
|
|
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE;
|
2020-06-30 00:49:56 +02:00
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.otherresearchproduct_refereed purge;
|
|
|
|
|
2022-03-22 15:16:08 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS ${stats_db_name}.otherresearchproduct_refereed STORED AS PARQUET as
|
2020-07-01 12:23:59 +02:00
|
|
|
select substr(r.id, 4) as id, inst.refereed.classname as refereed
|
2020-06-30 00:49:56 +02:00
|
|
|
from ${openaire_db_name}.otherresearchproduct r lateral view explode(r.instance) instances as inst
|
2022-02-03 11:37:10 +01:00
|
|
|
where r.datainfo.deletedbyinference=false and r.datainfo.invisible = FALSE;
|
2020-06-30 00:49:56 +02:00
|
|
|
|
|
|
|
CREATE VIEW IF NOT EXISTS ${stats_db_name}.result_refereed as
|
|
|
|
select * from ${stats_db_name}.publication_refereed
|
|
|
|
union all
|
|
|
|
select * from ${stats_db_name}.dataset_refereed
|
|
|
|
union all
|
|
|
|
select * from ${stats_db_name}.software_refereed
|
|
|
|
union all
|
2023-06-14 18:09:09 +02:00
|
|
|
select * from ${stats_db_name}.otherresearchproduct_refereed;
|
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.indi_impact_measures purge;
|
|
|
|
|
2023-06-21 08:22:39 +02:00
|
|
|
create table if not exists ${stats_db_name}.indi_impact_measures STORED AS PARQUET as
|
2023-06-21 09:02:19 +02:00
|
|
|
select substr(id, 4) as id, measures_ids.id impactmetric, cast(measures_ids.unit.value[0] as double) score,
|
2023-07-13 14:25:00 +02:00
|
|
|
cast(measures_ids.unit.value[0] as decimal(6,3)) score_dec, measures_ids.unit.value[1] impact_class
|
2023-06-14 18:09:09 +02:00
|
|
|
from ${openaire_db_name}.result lateral view explode(measures) measures as measures_ids
|
|
|
|
where measures_ids.id!='views' and measures_ids.id!='downloads';
|
|
|
|
|
2023-11-15 13:32:18 +01:00
|
|
|
DROP TABLE IF EXISTS ${stats_db_name}.result_apc_affiliations purge;
|
|
|
|
|
2023-07-13 14:25:00 +02:00
|
|
|
create table if not exists ${stats_db_name}.result_apc_affiliations STORED AS PARQUET as
|
|
|
|
select distinct substr(rel.target,4) id, substr(rel.source,4) organization, o.legalname.value name,
|
|
|
|
cast(rel.properties[0].value as double) apc_amount,
|
|
|
|
rel.properties[1].value apc_currency
|
|
|
|
from ${openaire_db_name}.relation rel
|
|
|
|
join ${openaire_db_name}.organization o on o.id=rel.source
|
|
|
|
join ${openaire_db_name}.result r on r.id=rel.target
|
2023-09-01 09:57:02 +02:00
|
|
|
where rel.subreltype = 'affiliation' and rel.datainfo.deletedbyinference = false and size(rel.properties)>0;
|