diff --git a/dhp-workflows/dhp-stats-update/pom.xml b/dhp-workflows/dhp-stats-update/pom.xml
new file mode 100644
index 000000000..6a22f2f7b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/pom.xml
@@ -0,0 +1,31 @@
+
+
+
+ dhp-workflows
+ eu.dnetlib.dhp
+ 1.1.6-SNAPSHOT
+
+ 4.0.0
+ dhp-statistics-workflow
+
+
+ org.apache.spark
+ spark-core_2.11
+
+
+ org.apache.spark
+ spark-sql_2.11
+
+
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+
+ false
+
+
+
+
+
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/config-default.xml b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/config-default.xml
new file mode 100644
index 000000000..e2953693f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/config-default.xml
@@ -0,0 +1,30 @@
+
+
+ jobTracker
+ ${jobTracker}
+
+
+ nameNode
+ ${nameNode}
+
+
+ oozie.use.system.libpath
+ true
+
+
+ oozie.action.sharelib.for.spark
+ spark2
+
+
+ hive_metastore_uris
+ thrift://iis-cdh5-test-m3.ocean.icm.edu.pl:9083
+
+
+ hive_jdbc_url
+ jdbc:hive2://iis-cdh5-test-m3.ocean.icm.edu.pl:10000
+
+
+ oozie.wf.workflow.notification.url
+ {serviceUrl}/v1/oozieNotification/jobUpdate?jobId=$jobId%26status=$status
+
+
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step1.sql
new file mode 100644
index 000000000..ec8a0e4ff
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step1.sql
@@ -0,0 +1,11 @@
+-- DROP database if EXISTS ${hive_db_name} cascade;
+-- CREATE database ${hive_db_name};
+--
+-- CREATE TABLE ${hive_db_name}.Persons (
+-- PersonID int,
+-- LastName varchar(255));
+--
+-- INSERT INTO ${hive_db_name}.Persons VALUES (1, "test_db_spyros_rec_111");
+
+DROP database IF EXISTS ${stats_db_name} CASCADE;
+CREATE database ${stats_db_name};
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_1.sql
new file mode 100644
index 000000000..568148753
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_1.sql
@@ -0,0 +1,7 @@
+----------------------------------------------------------------
+----------------------------------------------------------------
+-- Organization table/view and Organization related tables/views
+----------------------------------------------------------------
+----------------------------------------------------------------
+DROP TABLE IF EXISTS ${stats_db_name}.organization;
+CREATE TABLE ${stats_db_name}.organization AS SELECT substr(o.id, 4) as id, o.legalname.value as name, o.country.classid as country from ${openaire_db_name}.organization o WHERE o.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_2.sql
new file mode 100644
index 000000000..4937c8425
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_2.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.organization_datasources AS SELECT organization AS id, id AS datasource FROM ${stats_db_name}.datasource_organizations;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_3.sql
new file mode 100644
index 000000000..768cf2a6e
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step10_3.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.organization_projects AS SELECT id AS project, organization as id FROM ${stats_db_name}.project_organizations;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step11.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step11.sql
new file mode 100644
index 000000000..145be77b0
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step11.sql
@@ -0,0 +1,10 @@
+------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------------
+-- Tables/views from external tables/views (Fundref, Country, CountyGDP, roarmap, rndexpediture)
+------------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------------
+CREATE OR REPLACE VIEW ${stats_db_name}.fundref AS SELECT * FROM ${external_stats_db_name}.fundref;
+CREATE OR REPLACE VIEW ${stats_db_name}.country AS SELECT * FROM ${external_stats_db_name}.country;
+CREATE OR REPLACE VIEW ${stats_db_name}.countrygdp AS SELECT * FROM ${external_stats_db_name}.countrygdp;
+CREATE OR REPLACE VIEW ${stats_db_name}.roarmap AS SELECT * FROM ${external_stats_db_name}.roarmap;
+CREATE OR REPLACE VIEW ${stats_db_name}.rndexpediture AS SELECT * FROM ${external_stats_db_name}.rndexpediture;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_1.sql
new file mode 100644
index 000000000..c1ec8873a
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_1.sql
@@ -0,0 +1,6 @@
+----------------------------
+-- Post processing - Updates
+----------------------------
+
+--Datasource temporary table updates
+UPDATE ${stats_db_name}.datasource_tmp set harvested ='true' WHERE datasource_tmp.id IN (SELECT DISTINCT d.id FROM ${stats_db_name}.datasource_tmp d, ${stats_db_name}.result_datasources rd where d.id=rd.datasource);
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_2.sql
new file mode 100644
index 000000000..b772bc374
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_2.sql
@@ -0,0 +1,2 @@
+-- Project temporary table update and final project table creation with final updates that can not be applied to ORC tables
+UPDATE ${stats_db_name}.project_tmp SET haspubs='yes' WHERE project_tmp.id IN (SELECT pr.id FROM ${stats_db_name}.project_results pr, ${stats_db_name}.result r WHERE pr.result=r.id AND r.type='publication');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_3.sql
new file mode 100644
index 000000000..b5e942ed6
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_3.sql
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS ${stats_db_name}.project;
+
+CREATE TABLE ${stats_db_name}.project stored as parquet as
+SELECT p.id , p.acronym, p.title, p.funder, p.funding_lvl0, p.funding_lvl1, p.funding_lvl2, p.ec39, p.type, p.startdate, p.enddate, p.start_year, p.end_year, p.duration,
+CASE WHEN prr1.id IS NULL THEN 'no' ELSE 'yes' END as haspubs,
+CASE WHEN prr1.id IS NULL THEN 0 ELSE prr1.np END as numpubs,
+CASE WHEN prr2.id IS NULL THEN 0 ELSE prr2.daysForlastPub END as daysforlastpub,
+CASE WHEN prr2.id IS NULL THEN 0 ELSE prr2.dp END as delayedpubs,
+p.callidentifier, p.code
+FROM ${stats_db_name}.project_tmp p
+LEFT JOIN (SELECT pr.id, count(distinct pr.result) AS np
+ FROM ${stats_db_name}.project_results pr INNER JOIN ${stats_db_name}.result r ON pr.result=r.id
+ WHERE r.type='publication'
+ GROUP BY pr.id) AS prr1 on prr1.id = p.id
+LEFT JOIN (SELECT pp.id, max(datediff(to_date(r.date), to_date(pp.enddate)) ) as daysForlastPub , count(distinct r.id) as dp
+ FROM ${stats_db_name}.project_tmp pp, ${stats_db_name}.project_results pr, ${stats_db_name}.result r
+ WHERE pp.id=pr.id AND pr.result=r.id AND r.type='publication' AND datediff(to_date(r.date), to_date(pp.enddate)) > 0
+ GROUP BY pp.id) AS prr2
+ on prr2.id = p.id;
+
\ No newline at end of file
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_4.sql
new file mode 100644
index 000000000..2fab61e8d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_4.sql
@@ -0,0 +1,2 @@
+-- Publication temporary table updates
+UPDATE ${stats_db_name}.publication_tmp SET delayed = 'yes' WHERE publication_tmp.id IN (SELECT distinct r.id FROM stats_wf_db_obs.result r, ${stats_db_name}.project_results pr, ${stats_db_name}.project_tmp p WHERE r.id=pr.result AND pr.id=p.id AND to_date(r.date)-to_date(p.enddate) > 0);
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_5.sql
new file mode 100644
index 000000000..3c7ee35de
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_5.sql
@@ -0,0 +1,2 @@
+-- Dataset temporary table updates
+UPDATE ${stats_db_name}.dataset_tmp SET delayed = 'yes' WHERE dataset_tmp.id IN (SELECT distinct r.id FROM stats_wf_db_obs.result r, ${stats_db_name}.project_results pr, ${stats_db_name}.project_tmp p WHERE r.id=pr.result AND pr.id=p.id AND to_date(r.date)-to_date(p.enddate) > 0);
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_6.sql
new file mode 100644
index 000000000..5d38693bc
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_6.sql
@@ -0,0 +1,2 @@
+-- Software temporary table updates
+UPDATE ${stats_db_name}.software_tmp SET delayed = 'yes' WHERE software_tmp.id IN (SELECT distinct r.id FROM ${stats_db_name}.result r, ${stats_db_name}.project_results pr, ${stats_db_name}.project_tmp p WHERE r.id=pr.result AND pr.id=p.id AND to_date(r.date)-to_date(p.enddate) > 0);
\ No newline at end of file
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_7.sql
new file mode 100644
index 000000000..4a5d4ce61
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_7.sql
@@ -0,0 +1,2 @@
+-- Oherresearchproduct temporary table updates
+UPDATE ${stats_db_name}.otherresearchproduct_tmp SET delayed = 'yes' WHERE otherresearchproduct_tmp.id IN (SELECT distinct r.id FROM ${stats_db_name}.result r, ${stats_db_name}.project_results pr, ${stats_db_name}.project_tmp p WHERE r.id=pr.result AND pr.id=p.id AND to_date(r.date)-to_date(p.enddate) > 0);
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_8.sql
new file mode 100644
index 000000000..ad375bf3f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step12_8.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.project_results_publication AS SELECT result_projects.id AS result, result_projects.project AS project_results, result.date as resultdate, project.enddate as projectenddate, result_projects.daysfromend as daysfromend FROM ${stats_db_name}.result_projects, ${stats_db_name}.result, ${stats_db_name}.project WHERE result_projects.id=result.id and result.type='publication' and project.id=result_projects.project;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step13.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step13.sql
new file mode 100644
index 000000000..f68ccab64
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step13.sql
@@ -0,0 +1,26 @@
+------------------------------------------------------------------------------------------------------
+-- Creating parquet tables from the updated temporary tables and removing unnecessary temporary tables
+------------------------------------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS ${stats_db_name}.datasource;
+CREATE TABLE ${stats_db_name}.datasource stored as parquet as select * from ${stats_db_name}.datasource_tmp;
+
+DROP TABLE IF EXISTS ${stats_db_name}.publication;
+CREATE TABLE ${stats_db_name}.publication stored as parquet as select * from ${stats_db_name}.publication_tmp;
+
+DROP TABLE IF EXISTS ${stats_db_name}.dataset;
+CREATE TABLE ${stats_db_name}.dataset stored as parquet as select * from ${stats_db_name}.dataset_tmp;
+
+DROP TABLE IF EXISTS ${stats_db_name}.software;
+CREATE TABLE ${stats_db_name}.software stored as parquet as select * from ${stats_db_name}.software_tmp;
+
+DROP TABLE IF EXISTS ${stats_db_name}.otherresearchproduct;
+CREATE TABLE ${stats_db_name}.otherresearchproduct stored as parquet as select * from ${stats_db_name}.otherresearchproduct_tmp;
+
+DROP TABLE ${stats_db_name}.project_tmp;
+DROP TABLE ${stats_db_name}.datasource_tmp;
+DROP TABLE ${stats_db_name}.publication_tmp;
+DROP TABLE ${stats_db_name}.dataset_tmp;
+DROP TABLE ${stats_db_name}.software_tmp;
+DROP TABLE ${stats_db_name}.otherresearchproduct_tmp;
+
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step14.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step14.sql
new file mode 100644
index 000000000..24e9e3107
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step14.sql
@@ -0,0 +1,7 @@
+----------------------------------------------
+-- Re-creating views from final parquet tables
+---------------------------------------------
+
+-- Result
+CREATE OR REPLACE VIEW ${stats_db_name}.result as SELECT *, bestlicence as access_mode FROM ${stats_db_name}.publication UNION ALL SELECT *, bestlicence as access_mode FROM ${stats_db_name}.software UNION ALL SELECT *, bestlicence as access_mode FROM ${stats_db_name}.dataset UNION ALL SELECT *, bestlicence as access_mode FROM ${stats_db_name}.otherresearchproduct;
+
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_1.sql
new file mode 100644
index 000000000..d20bb73e2
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_1.sql
@@ -0,0 +1,10 @@
+--------------------------------------------------------------
+--------------------------------------------------------------
+-- 2. Publication table/view and Publication related tables/views
+--------------------------------------------------------------
+--------------------------------------------------------------
+
+-- Publication temporary table
+DROP TABLE IF EXISTS ${stats_db_name}.publication_tmp;
+
+CREATE TABLE ${stats_db_name}.publication_tmp (id STRING, title STRING, publisher STRING, journal STRING, date STRING, year STRING, bestlicence STRING, embargo_end_date STRING, delayed BOOLEAN, authors INT, source STRING, abstract BOOLEAN, type STRING ) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_2.sql
new file mode 100644
index 000000000..1c67596db
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_2.sql
@@ -0,0 +1,19 @@
+-- The following throws the following exception on CRN HUE Hive:
+-- Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 2:34 Invalid function 'date_format'
+-- But runs OK on OCEAN HUE Hive
+
+INSERT INTO ${stats_db_name}.publication_tmp SELECT substr(p.id, 4) as id, p.title[0].value as title, p.publisher.value as publisher, p.journal.name as journal ,
+p.dateofacceptance.value as date, date_format(p.dateofacceptance.value,'yyyy') as year, p.bestaccessright.classname as bestlicence,
+p.embargoenddate.value as embargo_end_date, false as delayed, size(p.author) as authors , concat_ws('\u003B',p.source.value) as source,
+case when size(p.description) > 0 then true else false end as abstract,
+'publication' as type
+from ${openaire_db_name}.publication p
+where p.datainfo.deletedbyinference=false;
+
+-- INSERT INTO ${hive_db_name}.publication_tmp SELECT substr(p.id, 4) as id, p.title[0].value as title, p.publisher.value as publisher, p.journal.name as journal,
+-- p.dateofacceptance.value as date, date_format(p.dateofacceptance.value,'yyyy') as year, p.bestaccessright.classname as bestlicence,
+-- p.embargoenddate.value as embargo_end_date, false as delayed, size(p.author) as authors , concat_ws('\u003B',p.source.value) as source,
+-- case when size(p.description) > 0 then true else false end as abstract,
+-- 'publication' as type
+-- from openaire.publication p
+-- where p.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_3.sql
new file mode 100644
index 000000000..bf0e85550
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_3.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.publication_classifications AS SELECT substr(p.id, 4) as id, instancetype.classname as type from ${openaire_db_name}.publication p LATERAL VIEW explode(p.instance.instancetype) instances as instancetype;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_4.sql
new file mode 100644
index 000000000..a38bcf62d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_4.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.publication_concepts AS SELECT substr(p.id, 4) as id, contexts.context.id as concept from ${openaire_db_name}.publication p LATERAL VIEW explode(p.context) contexts as context;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_5.sql
new file mode 100644
index 000000000..299833452
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_5.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.publication_datasources as SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource FROM (SELECT substr(p.id, 4) as id, substr(instances.instance.hostedby.key, 4) as datasource from ${openaire_db_name}.publication p lateral view explode(p.instance) instances as instance) p LEFT OUTER JOIN (SELECT substr(d.id, 4) id from ${openaire_db_name}.datasource d WHERE d.datainfo.deletedbyinference=false) d on p.datasource = d.id;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_6.sql
new file mode 100644
index 000000000..fd4dbe05c
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_6.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.publication_languages AS select substr(p.id, 4) as id, p.language.classname as language from ${openaire_db_name}.publication p;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_7.sql
new file mode 100644
index 000000000..24cd59670
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_7.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.publication_oids AS SELECT substr(p.id, 4) as id, oids.ids as oid from ${openaire_db_name}.publication p LATERAL VIEW explode(p.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_8.sql
new file mode 100644
index 000000000..1ddb2bd3b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_8.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.publication_pids as select substr(p.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid from ${openaire_db_name}.publication p lateral view explode(p.pid) pids as ppid;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_9.sql
new file mode 100644
index 000000000..5507eeb7a
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step2_9.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.publication_topics as select substr(p.id, 4) as id, subjects.subject.qualifier.classname as type, subjects.subject.value as topic from ${openaire_db_name}.publication p lateral view explode(p.subject) subjects as subject;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step3.sql
new file mode 100644
index 000000000..567b94994
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step3.sql
@@ -0,0 +1,2 @@
+-- 3. Publication_citations
+CREATE TABLE ${stats_db_name}.publication_citations AS SELECT substr(p.id, 4) AS id, xpath_string(citation.value, "//citation/id[@type='openaire']/@value") AS result FROM ${openaire_db_name}.publication p lateral view explode(p.extrainfo) citations AS citation WHERE xpath_string(citation.value, "//citation/id[@type='openaire']/@value") !="";
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_1.sql
new file mode 100644
index 000000000..3668059a6
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_1.sql
@@ -0,0 +1,9 @@
+------------------------------------------------------
+------------------------------------------------------
+-- 4. Dataset table/view and Dataset related tables/views
+------------------------------------------------------
+------------------------------------------------------
+
+-- Dataset temporary table supporting updates
+DROP TABLE IF EXISTS ${stats_db_name}.dataset_tmp;
+CREATE TABLE ${stats_db_name}.dataset_tmp (id STRING, title STRING, publisher STRING, journal STRING, date STRING, year STRING, bestlicence STRING, embargo_end_date STRING, delayed BOOLEAN, authors INT, source STRING, abstract BOOLEAN, type STRING ) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_10.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_10.sql
new file mode 100644
index 000000000..85a8eac7f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_10.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.dataset_topics as select substr(p.id, 4) as id, subjects.subject.qualifier.classname as type, subjects.subject.value as topic from ${openaire_db_name}.dataset p lateral view explode(p.subject) subjects as subject;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_2.sql
new file mode 100644
index 000000000..3c8bb7c0f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_2.sql
@@ -0,0 +1,7 @@
+INSERT INTO ${stats_db_name}.dataset_tmp select substr(d.id, 4) as id, d.title[0].value as title, d.publisher.value as publisher, cast(null as string) as journal,
+d.dateofacceptance.value as date, date_format(d.dateofacceptance.value,'yyyy') as year, d.bestaccessright.classname as bestlicence,
+d.embargoenddate.value as embargo_end_date, false as delayed, size(d.author) as authors , concat_ws('\u003B',d.source.value) as source,
+ case when size(d.description) > 0 then true else false end as abstract,
+'dataset' as type
+from ${openaire_db_name}.dataset d
+where d.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_3.sql
new file mode 100644
index 000000000..54e23621a
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_3.sql
@@ -0,0 +1,2 @@
+-- Dataset_citations
+Create table ${stats_db_name}.dataset_citations as select substr(d.id, 4) as id, xpath_string(citation.value, "//citation/id[@type='openaire']/@value") as result from ${openaire_db_name}.dataset d lateral view explode(d.extrainfo) citations as citation where xpath_string(citation.value, "//citation/id[@type='openaire']/@value") !="";
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_4.sql
new file mode 100644
index 000000000..7bc81c7f8
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_4.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.dataset_classifications AS SELECT substr(p.id, 4) as id, instancetype.classname as type from ${openaire_db_name}.dataset p LATERAL VIEW explode(p.instance.instancetype) instances as instancetype;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_5.sql
new file mode 100644
index 000000000..73aff989d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_5.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.dataset_concepts AS SELECT substr(p.id, 4) as id, contexts.context.id as concept from ${openaire_db_name}.dataset p LATERAL VIEW explode(p.context) contexts as context;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_6.sql
new file mode 100644
index 000000000..1ca686f70
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_6.sql
@@ -0,0 +1,3 @@
+CREATE TABLE ${stats_db_name}.dataset_datasources as SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource FROM (SELECT substr(p.id, 4) as id, substr(instances.instance.hostedby.key, 4) as datasource
+from ${openaire_db_name}.dataset p lateral view explode(p.instance) instances as instance) p LEFT OUTER JOIN
+(SELECT substr(d.id, 4) id from ${openaire_db_name}.datasource d WHERE d.datainfo.deletedbyinference=false) d on p.datasource = d.id;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_7.sql
new file mode 100644
index 000000000..70c0b3e4f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_7.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.dataset_languages AS select substr(p.id, 4) as id, p.language.classname as language from ${openaire_db_name}.dataset p;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_8.sql
new file mode 100644
index 000000000..c750ad00b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_8.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.dataset_oids AS SELECT substr(p.id, 4) as id, oids.ids as oid from ${openaire_db_name}.dataset p LATERAL VIEW explode(p.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_9.sql
new file mode 100644
index 000000000..1d9f4c596
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step4_9.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.dataset_pids as select substr(p.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid from ${openaire_db_name}.dataset p lateral view explode(p.pid) pids as ppid;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_1.sql
new file mode 100644
index 000000000..89f869760
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_1.sql
@@ -0,0 +1,9 @@
+--------------------------------------------------------
+--------------------------------------------------------
+-- 5. Software table/view and Software related tables/views
+--------------------------------------------------------
+--------------------------------------------------------
+
+-- Software temporary table supporting updates
+DROP TABLE IF EXISTS ${stats_db_name}.software_tmp;
+CREATE TABLE ${stats_db_name}.software_tmp (id STRING, title STRING, publisher STRING, journal STRING, date STRING, year STRING, bestlicence STRING, embargo_end_date STRING, delayed BOOLEAN, authors INT, source STRING, abstract BOOLEAN, type STRING ) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_10.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_10.sql
new file mode 100644
index 000000000..acc70958b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_10.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.software_topics as select substr(p.id, 4) as id, subjects.subject.qualifier.classname as type, subjects.subject.value as topic from ${openaire_db_name}.software p lateral view explode(p.subject) subjects as subject;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_2.sql
new file mode 100644
index 000000000..4a3f10c64
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_2.sql
@@ -0,0 +1,7 @@
+INSERT INTO ${stats_db_name}.software_tmp select substr(s.id, 4) as id, s.title[0].value as title, s.publisher.value as publisher, cast(null as string) as journal,
+s.dateofacceptance.value as date, date_format(s.dateofacceptance.value,'yyyy') as year, s.bestaccessright.classname as bestlicence,
+s.embargoenddate.value as embargo_end_date, false as delayed, size(s.author) as authors , concat_ws('\u003B',s.source.value) as source,
+ case when size(s.description) > 0 then true else false end as abstract,
+'software' as type
+from ${openaire_db_name}.software s
+where s.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_3.sql
new file mode 100644
index 000000000..f8073a583
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_3.sql
@@ -0,0 +1,2 @@
+-- Software_citations
+Create table ${stats_db_name}.software_citations as select substr(s.id, 4) as id, xpath_string(citation.value, "//citation/id[@type='openaire']/@value") as result from ${openaire_db_name}.software s lateral view explode(s.extrainfo) citations as citation where xpath_string(citation.value, "//citation/id[@type='openaire']/@value") !="";
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_4.sql
new file mode 100644
index 000000000..b340cfc24
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_4.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.software_classifications AS SELECT substr(p.id, 4) as id, instancetype.classname as type from ${openaire_db_name}.software p LATERAL VIEW explode(p.instance.instancetype) instances as instancetype;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_5.sql
new file mode 100644
index 000000000..d2b0f3d1d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_5.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.software_concepts AS SELECT substr(p.id, 4) as id, contexts.context.id as concept from ${openaire_db_name}.software p LATERAL VIEW explode(p.context) contexts as context;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_6.sql
new file mode 100644
index 000000000..dfe32075b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_6.sql
@@ -0,0 +1,3 @@
+CREATE TABLE ${stats_db_name}.software_datasources as SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource FROM (SELECT substr(p.id, 4) as id, substr(instances.instance.hostedby.key, 4) as datasource
+from ${openaire_db_name}.software p lateral view explode(p.instance) instances as instance) p LEFT OUTER JOIN
+(SELECT substr(d.id, 4) id from ${openaire_db_name}.datasource d WHERE d.datainfo.deletedbyinference=false) d on p.datasource = d.id;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_7.sql
new file mode 100644
index 000000000..0fdb0fab3
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_7.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.software_languages AS select substr(p.id, 4) as id, p.language.classname as language from ${openaire_db_name}.software p;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_8.sql
new file mode 100644
index 000000000..79c4b313d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_8.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.software_oids AS SELECT substr(p.id, 4) as id, oids.ids as oid from ${openaire_db_name}.software p LATERAL VIEW explode(p.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_9.sql
new file mode 100644
index 000000000..a8aaa5d83
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step5_9.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.software_pids as select substr(p.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid from ${openaire_db_name}.software p lateral view explode(p.pid) pids as ppid;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_1.sql
new file mode 100644
index 000000000..4e59465fa
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_1.sql
@@ -0,0 +1,9 @@
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+-- 6. Otherresearchproduct table/view and Otherresearchproduct related tables/views
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+-- Otherresearchproduct temporary table supporting updates
+DROP TABLE IF EXISTS ${stats_db_name}.otherresearchproduct_tmp;
+CREATE TABLE ${stats_db_name}.otherresearchproduct_tmp ( id STRING, title STRING, publisher STRING, journal STRING, date STRING, year STRING, bestlicence STRING, embargo_end_date STRING, delayed BOOLEAN, authors INT, source STRING, abstract BOOLEAN, type STRING ) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_10.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_10.sql
new file mode 100644
index 000000000..e2e788634
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_10.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.otherresearchproduct_topics as select substr(p.id, 4) as id, subjects.subject.qualifier.classname as type, subjects.subject.value as topic from ${openaire_db_name}.otherresearchproduct p lateral view explode(p.subject) subjects as subject;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_2.sql
new file mode 100644
index 000000000..7c7ed370d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_2.sql
@@ -0,0 +1,7 @@
+INSERT INTO ${stats_db_name}.otherresearchproduct_tmp select substr(o.id, 4) as id, o.title[0].value as title, o.publisher.value as publisher, cast(null as string) as journal,
+o.dateofacceptance.value as date, date_format(o.dateofacceptance.value,'yyyy') as year, o.bestaccessright.classname as bestlicence,
+o.embargoenddate.value as embargo_end_date, false as delayed, size(o.author) as authors , concat_ws('\u003B',o.source.value) as source,
+case when size(o.description) > 0 then true else false end as abstract,
+'other' as type
+from ${openaire_db_name}.otherresearchproduct o
+where o.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_3.sql
new file mode 100644
index 000000000..c6b9255df
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_3.sql
@@ -0,0 +1,2 @@
+-- Otherresearchproduct_citations
+Create table ${stats_db_name}.otherresearchproduct_citations as select substr(o.id, 4) as id, xpath_string(citation.value, "//citation/id[@type='openaire']/@value") as result from ${openaire_db_name}.otherresearchproduct o lateral view explode(o.extrainfo) citations as citation where xpath_string(citation.value, "//citation/id[@type='openaire']/@value") !="";
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_4.sql
new file mode 100644
index 000000000..0a93764b6
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_4.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.otherresearchproduct_classifications AS SELECT substr(p.id, 4) as id, instancetype.classname as type from ${openaire_db_name}.otherresearchproduct p LATERAL VIEW explode(p.instance.instancetype) instances as instancetype;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_5.sql
new file mode 100644
index 000000000..a37f2f25e
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_5.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.otherresearchproduct_concepts AS SELECT substr(p.id, 4) as id, contexts.context.id as concept from ${openaire_db_name}.otherresearchproduct p LATERAL VIEW explode(p.context) contexts as context;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_6.sql
new file mode 100644
index 000000000..b7aa69e9a
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_6.sql
@@ -0,0 +1,3 @@
+CREATE TABLE ${stats_db_name}.otherresearchproduct_datasources as SELECT p.id, case when d.id is null then 'other' else p.datasource end as datasource FROM (SELECT substr(p.id, 4) as id, substr(instances.instance.hostedby.key, 4) as datasource
+from ${openaire_db_name}.otherresearchproduct p lateral view explode(p.instance) instances as instance) p LEFT OUTER JOIN
+(SELECT substr(d.id, 4) id from ${openaire_db_name}.datasource d WHERE d.datainfo.deletedbyinference=false) d on p.datasource = d.id;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_7.sql
new file mode 100644
index 000000000..ba9208cf6
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_7.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.otherresearchproduct_languages AS select substr(p.id, 4) as id, p.language.classname as language from ${openaire_db_name}.otherresearchproduct p;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_8.sql
new file mode 100644
index 000000000..4f2c5c3bb
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_8.sql
@@ -0,0 +1 @@
+CREATE TABLE ${stats_db_name}.otherresearchproduct_oids AS SELECT substr(p.id, 4) as id, oids.ids as oid from ${openaire_db_name}.otherresearchproduct p LATERAL VIEW explode(p.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_9.sql
new file mode 100644
index 000000000..4ab11adfe
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step6_9.sql
@@ -0,0 +1 @@
+create table ${stats_db_name}.otherresearchproduct_pids as select substr(p.id, 4) as id, ppid.qualifier.classname as type, ppid.value as pid from ${openaire_db_name}.otherresearchproduct p lateral view explode(p.pid) pids as ppid;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_1.sql
new file mode 100644
index 000000000..0c775452d
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_1.sql
@@ -0,0 +1,8 @@
+------------------------------------------------------
+------------------------------------------------------
+-- 7. Project table/view and Project related tables/views
+------------------------------------------------------
+------------------------------------------------------
+-- Project_oids Table
+DROP TABLE IF EXISTS ${stats_db_name}.project_oids;
+CREATE TABLE ${stats_db_name}.project_oids AS SELECT substr(p.id, 4) as id, oids.ids as oid from ${openaire_db_name}.project p LATERAL VIEW explode(p.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_2.sql
new file mode 100644
index 000000000..27770c390
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_2.sql
@@ -0,0 +1,3 @@
+-- Project_organizations Table
+DROP TABLE IF EXISTS ${stats_db_name}.project_organizations;
+CREATE TABLE ${stats_db_name}.project_organizations AS SELECT substr(r.source, 4) as id, substr(r.target, 4) AS organization from ${openaire_db_name}.relation r WHERE r.reltype='projectOrganization';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_3.sql
new file mode 100644
index 000000000..fcefd7dcc
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_3.sql
@@ -0,0 +1,3 @@
+-- Project_results Table
+DROP TABLE IF EXISTS ${stats_db_name}.project_results;
+CREATE TABLE ${stats_db_name}.project_results AS SELECT substr(r.target, 4) as id, substr(r.source, 4) AS result from ${openaire_db_name}.relation r WHERE r.reltype='resultProject';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_4.sql
new file mode 100644
index 000000000..a80573765
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_4.sql
@@ -0,0 +1,5 @@
+-- Project table
+----------------
+-- Creating and populating temporary Project table
+DROP TABLE IF EXISTS ${stats_db_name}.project_tmp;
+CREATE TABLE ${stats_db_name}.project_tmp (id STRING, acronym STRING, title STRING, funder STRING, funding_lvl0 STRING, funding_lvl1 STRING, funding_lvl2 STRING, ec39 STRING, type STRING, startdate STRING, enddate STRING, start_year STRING, end_year STRING, duration INT, haspubs STRING, numpubs INT, daysforlastpub INT, delayedpubs INT, callidentifier STRING, code STRING) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_5.sql
new file mode 100644
index 000000000..c633d9177
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step7_5.sql
@@ -0,0 +1 @@
+INSERT INTO ${stats_db_name}.project_tmp SELECT substr(p.id, 4) as id, p.acronym.value as acronym, p.title.value as title, xpath_string(p.fundingtree[0].value, '//funder/name') as funder, xpath_string(p.fundingtree[0].value, '//funding_level_0/name') as funding_lvl0, xpath_string(p.fundingtree[0].value, '//funding_level_1/name') as funding_lvl1, xpath_string(p.fundingtree[0].value, '//funding_level_2/name') as funding_lvl2, p.ecsc39.value as ec39, p.contracttype.classname as type, p.startdate.value as startdate, p.enddate.value as enddate, date_format(p.startdate.value, 'yyyy') as start_year, date_format(p.enddate.value, 'yyyy') as end_year, 0 as duration, 'no' as haspubs, 0 as numpubs, 0 as daysforlastpub, 0 as delayedpubs, p.callidentifier.value as callidentifier, p.code.value as code from ${openaire_db_name}.project p WHERE p.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_1.sql
new file mode 100644
index 000000000..e855e59ff
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_1.sql
@@ -0,0 +1,8 @@
+----------------------------------------------------
+----------------------------------------------------
+-- 8. Result table/view and Result related tables/views
+----------------------------------------------------
+----------------------------------------------------
+
+-- Views on temporary tables that should be re-created in the end
+CREATE OR REPLACE VIEW ${stats_db_name}.result as SELECT *, bestlicence as access_mode FROM ${stats_db_name}.publication_tmp UNION ALL SELECT *,bestlicence as access_mode FROM ${stats_db_name}.software_tmp UNION ALL SELECT *,bestlicence as access_mode FROM ${stats_db_name}.dataset_tmp UNION ALL SELECT *,bestlicence as access_mode FROM ${stats_db_name}.otherresearchproduct_tmp;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_10.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_10.sql
new file mode 100644
index 000000000..c9ad0760f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_10.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS ${stats_db_name}.result_organization;
+CREATE TABLE ${stats_db_name}.result_organization AS SELECT substr(r.target, 4) as id, substr(r.source, 4) as organization from ${openaire_db_name}.relation r where r.reltype='resultOrganization';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_11.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_11.sql
new file mode 100644
index 000000000..a2c0d85be
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_11.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS ${stats_db_name}.result_projects;
+CREATE TABLE ${stats_db_name}.result_projects AS select pr.result as id, pr.id as project, datediff(p.enddate, p.startdate) as daysfromend from ${stats_db_name}.result r join ${stats_db_name}.project_results pr on r.id=pr.result join ${stats_db_name}.project_tmp p on p.id=pr.id;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_2.sql
new file mode 100644
index 000000000..94a230d21
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_2.sql
@@ -0,0 +1,2 @@
+-- Views on final tables
+CREATE OR REPLACE VIEW ${stats_db_name}.result_datasources as SELECT * FROM ${stats_db_name}.publication_datasources UNION ALL SELECT * FROM ${stats_db_name}.software_datasources UNION ALL SELECT * FROM ${stats_db_name}.dataset_datasources UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_datasources;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_3.sql
new file mode 100644
index 000000000..3d61dc8fa
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_3.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_citations as SELECT * FROM ${stats_db_name}.publication_citations UNION ALL SELECT * FROM ${stats_db_name}.software_citations UNION ALL SELECT * FROM ${stats_db_name}.dataset_citations UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_citations;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_4.sql
new file mode 100644
index 000000000..c27c9964f
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_4.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_classifications as SELECT * FROM ${stats_db_name}.publication_classifications UNION ALL SELECT * FROM ${stats_db_name}.software_classifications UNION ALL SELECT * FROM ${stats_db_name}.dataset_classifications UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_classifications;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_5.sql
new file mode 100644
index 000000000..1f81adb73
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_5.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_concepts as SELECT * FROM ${stats_db_name}.publication_concepts UNION ALL SELECT * FROM ${stats_db_name}.software_concepts UNION ALL SELECT * FROM ${stats_db_name}.dataset_concepts UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_concepts;
\ No newline at end of file
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_6.sql
new file mode 100644
index 000000000..2ea29f2f3
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_6.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_languages as SELECT * FROM ${stats_db_name}.publication_languages UNION ALL SELECT * FROM ${stats_db_name}.software_languages UNION ALL SELECT * FROM ${stats_db_name}.dataset_languages UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_languages;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_7.sql
new file mode 100644
index 000000000..b4e69d413
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_7.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_oids as SELECT * FROM ${stats_db_name}.publication_oids UNION ALL SELECT * FROM ${stats_db_name}.software_oids UNION ALL SELECT * FROM ${stats_db_name}.dataset_oids UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_oids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_8.sql
new file mode 100644
index 000000000..36e753f5c
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_8.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_pids as SELECT * FROM ${stats_db_name}.publication_pids UNION ALL SELECT * FROM ${stats_db_name}.software_pids UNION ALL SELECT * FROM ${stats_db_name}.dataset_pids UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_pids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_9.sql
new file mode 100644
index 000000000..075ab266b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step8_9.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.result_topics as SELECT * FROM ${stats_db_name}.publication_topics UNION ALL SELECT * FROM ${stats_db_name}.software_topics UNION ALL SELECT * FROM ${stats_db_name}.dataset_topics UNION ALL SELECT * FROM ${stats_db_name}.otherresearchproduct_topics;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_1.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_1.sql
new file mode 100644
index 000000000..c2274d2e0
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_1.sql
@@ -0,0 +1,10 @@
+------------------------------------------------------------
+------------------------------------------------------------
+-- 9. Datasource table/view and Datasource related tables/views
+------------------------------------------------------------
+------------------------------------------------------------
+-- Datasource table creation & update
+-------------------------------------
+-- Creating and populating temporary datasource table
+DROP TABLE IF EXISTS ${stats_db_name}.datasource_tmp;
+create table ${stats_db_name}.datasource_tmp(`id` string, `name` string, `type` string, `dateofvalidation` string, `yearofvalidation` string, `harvested` boolean, `piwik_id` int, `latitude` string, `longitude` string, `websiteurl` string, `compatibility` string) clustered by (id) into 100 buckets stored as orc tblproperties('transactional'='true');
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_2.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_2.sql
new file mode 100644
index 000000000..fd89e0d5b
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_2.sql
@@ -0,0 +1,3 @@
+insert into ${stats_db_name}.datasource_tmp SELECT substr(d.id, 4) as id, officialname.value as name, datasourcetype.classname as type, dateofvalidation.value as dateofvalidation, date_format(d.dateofvalidation.value,'yyyy') as yearofvalidation, false as harvested, 0 as piwik_id, d.latitude.value as latitude, d.longitude.value as longitude, d.websiteurl.value as websiteurl, d.openairecompatibility.classid as compatibility
+from ${openaire_db_name}.datasource d
+WHERE d.datainfo.deletedbyinference=false;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_3.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_3.sql
new file mode 100644
index 000000000..2266bc724
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_3.sql
@@ -0,0 +1,7 @@
+-- Updating temporary table with everything that is not based on results -> This is done with the following "dual" table. To see if default values are there
+-- Creating a temporary dual table that will be removed after the following insert
+CREATE TABLE ${stats_db_name}.dual(dummy char(1));
+INSERT INTO ${stats_db_name}.dual values('X');
+INSERT INTO ${stats_db_name}.datasource_tmp (`id`, `name`, `type`, `dateofvalidation`, `yearofvalidation`, `harvested`, `piwik_id`, `latitude`, `longitude`, `websiteurl`, `compatibility`)
+SELECT 'other', 'Other', 'Repository', NULL, NULL, false, 0, NULL, NULL, NULL, 'unknown' FROM ${stats_db_name}.dual WHERE 'other' not in (SELECT id FROM ${stats_db_name}.datasource_tmp WHERE name='Unknown Repository');
+DROP TABLE ${stats_db_name}.dual;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_4.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_4.sql
new file mode 100644
index 000000000..dd5f9b314
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_4.sql
@@ -0,0 +1 @@
+UPDATE ${stats_db_name}.datasource_tmp SET name='Other' where name='Unknown Repository';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_5.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_5.sql
new file mode 100644
index 000000000..77ee81b04
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_5.sql
@@ -0,0 +1 @@
+UPDATE ${stats_db_name}.datasource_tmp SET yearofvalidation=null WHERE yearofvalidation='-1';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_6.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_6.sql
new file mode 100644
index 000000000..d4ca2e10e
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_6.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS ${stats_db_name}.datasource_languages;
+CREATE TABLE ${stats_db_name}.datasource_languages AS SELECT substr(d.id, 4) as id, langs.languages as language from openaire.datasource d LATERAL VIEW explode(d.odlanguages.value) langs as languages;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_7.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_7.sql
new file mode 100644
index 000000000..194633cb7
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_7.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS ${stats_db_name}.datasource_oids;
+CREATE TABLE ${stats_db_name}.datasource_oids AS SELECT substr(d.id, 4) as id, oids.ids as oid from ${openaire_db_name}.datasource d LATERAL VIEW explode(d.originalid) oids as ids;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_8.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_8.sql
new file mode 100644
index 000000000..c25858d2c
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_8.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS ${stats_db_name}.datasource_organizations;
+CREATE TABLE ${stats_db_name}.datasource_organizations AS select substr(r.target, 4) as id, substr(r.source, 4) as organization from ${openaire_db_name}.relation r where r.reltype='datasourceOrganization';
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_9.sql b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_9.sql
new file mode 100644
index 000000000..ec4aa0569
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/scripts/step9_9.sql
@@ -0,0 +1 @@
+CREATE OR REPLACE VIEW ${stats_db_name}.datasource_results AS SELECT datasource AS id, id AS result FROM ${stats_db_name}.result_datasources;
diff --git a/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/workflow.xml b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/workflow.xml
new file mode 100644
index 000000000..40f4b14ba
--- /dev/null
+++ b/dhp-workflows/dhp-stats-update/src/main/resources/graph/oozie_app/workflow.xml
@@ -0,0 +1,1479 @@
+
+
+
+ stats_db_name
+ the target stats database name
+
+
+ openaire_db_name
+ the original graph database name
+
+
+ external_stats_db_name
+ the external stats that should be added since they are not included in the graph database
+
+
+
+
+
+
+ Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+ external_stats_db_name=${external_stats_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
+ ${jobTracker}
+ ${nameNode}
+
+
+ hive.metastore.uris
+ ${hive_metastore_uris}
+
+
+ ${hive_jdbc_url}
+
+ stats_db_name=${stats_db_name}
+ openaire_db_name=${openaire_db_name}
+
+
+
+
+
+
+
diff --git a/dhp-workflows/pom.xml b/dhp-workflows/pom.xml
index 4b5fb4b4f..312826dac 100644
--- a/dhp-workflows/pom.xml
+++ b/dhp-workflows/pom.xml
@@ -21,6 +21,7 @@
dhp-graph-provision
dhp-dedup-scholexplorer
dhp-graph-provision-scholexplorer
+ dhp-stats-update