1
|
--
|
2
|
-- sqoopQL database dump
|
3
|
--
|
4
|
|
5
|
SET statement_timeout = 0;
|
6
|
SET client_encoding = 'UTF8';
|
7
|
SET standard_conforming_strings = on;
|
8
|
SET check_function_bodies = false;
|
9
|
SET client_min_messages = warning;
|
10
|
|
11
|
--
|
12
|
-- Name: shadow; Type: SCHEMA; Schema: -; Owner: sqoop
|
13
|
--
|
14
|
|
15
|
--
|
16
|
-- Name: shadow; Type: SCHEMA; Schema: -; Owner: sqoop
|
17
|
--
|
18
|
DROP SCHEMA IF EXISTS shadow CASCADE;
|
19
|
CREATE SCHEMA shadow;
|
20
|
|
21
|
|
22
|
--ALTER SCHEMA shadow OWNER TO sqoop;
|
23
|
|
24
|
SET search_path = shadow, pg_catalog;
|
25
|
|
26
|
|
27
|
|
28
|
--
|
29
|
-- Name: concept; Type: TABLE; Schema: public; Owner: dnet; Tablespace:
|
30
|
--
|
31
|
|
32
|
CREATE TABLE shadow.concept (
|
33
|
id text NOT NULL,
|
34
|
name text ,
|
35
|
category text
|
36
|
);
|
37
|
|
38
|
|
39
|
|
40
|
--
|
41
|
-- Name: datasource; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
42
|
--
|
43
|
|
44
|
CREATE TABLE shadow.datasource (
|
45
|
id text NOT NULL,
|
46
|
|
47
|
name text ,
|
48
|
type text,
|
49
|
compatibility text,
|
50
|
latitude text,
|
51
|
longitude text,
|
52
|
dateofvalidation text,
|
53
|
yearofvalidation integer,
|
54
|
url text,
|
55
|
entityType text,
|
56
|
|
57
|
);
|
58
|
|
59
|
|
60
|
--
|
61
|
-- Name: datasource_languages; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
62
|
--
|
63
|
|
64
|
CREATE TABLE shadow.datasource_languages (
|
65
|
id text NOT NULL,
|
66
|
language text NOT NULL
|
67
|
);
|
68
|
|
69
|
|
70
|
--
|
71
|
-- Name: datasource_organizations; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
72
|
--
|
73
|
|
74
|
--
|
75
|
CREATE TABLE shadow.datasource_organizations (
|
76
|
id text NOT NULL,
|
77
|
organization text NOT NULL
|
78
|
);
|
79
|
|
80
|
|
81
|
|
82
|
--
|
83
|
-- Name: result_datasources; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
84
|
--
|
85
|
|
86
|
CREATE TABLE shadow.result_datasources (
|
87
|
id text NOT NULL,
|
88
|
datasource text NOT NULL
|
89
|
);
|
90
|
|
91
|
|
92
|
|
93
|
--
|
94
|
-- Name: datasource_results; Type: VIEW; Schema: shadow; Owner: sqoop
|
95
|
--
|
96
|
|
97
|
CREATE VIEW shadow.datasource_results AS
|
98
|
SELECT result_datasources.datasource AS id, result_datasources.id AS result FROM result_datasources;
|
99
|
|
100
|
|
101
|
|
102
|
--
|
103
|
-- Name: datasource_topics; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
104
|
--
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
--
|
110
|
-- Name: defaults; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
111
|
--
|
112
|
|
113
|
CREATE TABLE shadow.defaults (
|
114
|
tablename text NOT NULL,
|
115
|
xaxis text,
|
116
|
yaxis text,
|
117
|
agg text,
|
118
|
zaxis text,
|
119
|
type text,
|
120
|
tableorder integer NOT NULL
|
121
|
);
|
122
|
|
123
|
|
124
|
|
125
|
--
|
126
|
-- Name: category; Type: TABLE; Schema: public; Owner: dnet; Tablespace:
|
127
|
--
|
128
|
CREATE TABLE shadow.category (
|
129
|
id text NOT NULL,
|
130
|
name text,
|
131
|
context text
|
132
|
);
|
133
|
|
134
|
--
|
135
|
-- Name: claim; Type: TABLE; Schema: public; Owner: dnet; Tablespace:
|
136
|
--
|
137
|
|
138
|
CREATE TABLE shadow.claim (
|
139
|
id text NOT NULL,
|
140
|
date text ,
|
141
|
userid text
|
142
|
);
|
143
|
|
144
|
|
145
|
--
|
146
|
-- Name: context; Type: TABLE; Schema: public; Owner: dnet; Tablespace:
|
147
|
--
|
148
|
|
149
|
CREATE TABLE shadow.context (
|
150
|
id text NOT NULL,
|
151
|
name text
|
152
|
);
|
153
|
|
154
|
--
|
155
|
-- Name: organization; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
156
|
--
|
157
|
|
158
|
CREATE TABLE shadow.organization (
|
159
|
id text NOT NULL,
|
160
|
|
161
|
name text,
|
162
|
country text,
|
163
|
entityType text
|
164
|
|
165
|
);
|
166
|
|
167
|
|
168
|
|
169
|
--
|
170
|
-- Name: organization_datasources; Type: VIEW; Schema: shadow; Owner: sqoop
|
171
|
--
|
172
|
|
173
|
CREATE VIEW shadow.organization_datasources AS
|
174
|
SELECT datasource_organizations.organization AS id, datasource_organizations.id AS datasource FROM datasource_organizations;
|
175
|
|
176
|
|
177
|
|
178
|
--
|
179
|
-- Name: project_organizations; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
180
|
--
|
181
|
|
182
|
CREATE TABLE shadow.project_organizations (
|
183
|
id text NOT NULL,
|
184
|
organization text NOT NULL
|
185
|
);
|
186
|
|
187
|
|
188
|
|
189
|
--
|
190
|
-- Name: organization_projects; Type: VIEW; Schema: shadow; Owner: sqoop
|
191
|
--
|
192
|
|
193
|
CREATE VIEW shadow.organization_projects AS
|
194
|
SELECT project_organizations.id AS project, project_organizations.organization AS id FROM project_organizations;
|
195
|
|
196
|
|
197
|
|
198
|
--
|
199
|
-- Name: project; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
200
|
--
|
201
|
|
202
|
CREATE TABLE shadow.project (
|
203
|
id text NOT NULL,
|
204
|
|
205
|
acronym text ,
|
206
|
title text ,
|
207
|
funding_lvl0 text,
|
208
|
funding_lvl1 text,
|
209
|
funding_lvl2 text,
|
210
|
sc39 text,
|
211
|
url text,
|
212
|
start_year integer,
|
213
|
end_year integer,
|
214
|
duration integer,
|
215
|
haspubs text DEFAULT 'no'::text,
|
216
|
numpubs integer,
|
217
|
enddate text,
|
218
|
startdate text,
|
219
|
daysforlastpub integer,
|
220
|
delayedpubs integer,
|
221
|
entityType text
|
222
|
);
|
223
|
|
224
|
|
225
|
--
|
226
|
-- Name: result_projects; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
227
|
--
|
228
|
|
229
|
|
230
|
--ALTER TABLE shadow.result_projects OWNER TO sqoop;
|
231
|
|
232
|
CREATE TABLE shadow.project_results (
|
233
|
id text NOT NULL,
|
234
|
result text NOT NULL,
|
235
|
daysfromend integer
|
236
|
);
|
237
|
|
238
|
|
239
|
|
240
|
--
|
241
|
-- Name: result; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
242
|
--
|
243
|
|
244
|
CREATE TABLE shadow.result (
|
245
|
id text NOT NULL,
|
246
|
cleanedId text,
|
247
|
title text,
|
248
|
alterntitles text,
|
249
|
publisher text,
|
250
|
journal text,
|
251
|
year integer,
|
252
|
date text ,
|
253
|
access_mode text,
|
254
|
bestlicense text,
|
255
|
type text ,
|
256
|
embargo_end_date text,
|
257
|
delayed text,
|
258
|
authors integer,
|
259
|
authorList text ,
|
260
|
extReferences text,
|
261
|
originalIds text
|
262
|
);
|
263
|
|
264
|
|
265
|
|
266
|
--
|
267
|
-- Name: result_claims; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
268
|
--
|
269
|
|
270
|
CREATE TABLE shadow.result_claims (
|
271
|
id text NOT NULL,
|
272
|
claim text NOT NULL
|
273
|
);
|
274
|
|
275
|
|
276
|
|
277
|
--
|
278
|
-- Name: result_classifications; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
279
|
--
|
280
|
|
281
|
CREATE TABLE shadow.result_classifications (
|
282
|
id text NOT NULL,
|
283
|
type text NOT NULL
|
284
|
);
|
285
|
|
286
|
|
287
|
|
288
|
--
|
289
|
-- Name: result_concepts; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
290
|
--
|
291
|
|
292
|
CREATE TABLE shadow.result_concepts (
|
293
|
id text NOT NULL,
|
294
|
concept text NOT NULL
|
295
|
);
|
296
|
|
297
|
|
298
|
|
299
|
--
|
300
|
-- Name: result_languages; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
301
|
--
|
302
|
|
303
|
CREATE TABLE shadow.result_languages (
|
304
|
id text NOT NULL,
|
305
|
language text NOT NULL
|
306
|
);
|
307
|
|
308
|
|
309
|
--
|
310
|
-- Name: result_results; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
311
|
--
|
312
|
|
313
|
CREATE TABLE shadow.result_results (
|
314
|
id text NOT NULL,
|
315
|
result text NOT NULL
|
316
|
);
|
317
|
|
318
|
|
319
|
|
320
|
--
|
321
|
-- Name: result_topics; Type: TABLE; Schema: shadow; Owner: sqoop; Tablespace:
|
322
|
--
|
323
|
|
324
|
CREATE TABLE shadow.result_topics (
|
325
|
id text NOT NULL,
|
326
|
topic text NOT NULL
|
327
|
);
|
328
|
|
329
|
|
330
|
|
331
|
--
|
332
|
-- DATASOURCE Extra Inserts
|
333
|
--
|
334
|
|
335
|
|
336
|
CREATE TABLE shadow.person (
|
337
|
id text NOT NULL,
|
338
|
|
339
|
firstname text ,
|
340
|
secondname text,
|
341
|
fullname text ,
|
342
|
nationality text ,
|
343
|
coauthorsCount text,
|
344
|
entityType text
|
345
|
);
|
346
|
|
347
|
|
348
|
CREATE TABLE shadow.person_results (
|
349
|
id text NOT NULL,
|
350
|
result text NOT NULL
|
351
|
);
|
352
|
|
353
|
CREATE OR REPLACE FUNCTION shadow.extra_defaults_datasource()
|
354
|
RETURNS void AS
|
355
|
$BODY$
|
356
|
BEGIN
|
357
|
|
358
|
INSERT INTO "shadow".datasource (id,datasource_results,datasource_organizations,datasource_languages,datasource_topics,name,type,compatibility,number) (SELECT 'other','other','other','other','other','Other','Repository','unknown',1 WHERE NOT EXISTS (SELECT 1 FROM "shadow".datasource WHERE name='Unknown Repository'));
|
359
|
UPDATE "shadow".datasource SET name='Other' where name='Unknown Repository';
|
360
|
UPDATE "shadow".result_datasources SET datasource=(SELECT id FROM "shadow".datasource WHERE name='Other') WHERE datasource NOT IN (SELECT id FROM "shadow".datasource);
|
361
|
|
362
|
TRUNCATE TABLE "shadow".defaults;
|
363
|
INSERT INTO "shadow".defaults VALUES ('result', 'year', 'number', 'count', '', 'column', 1);
|
364
|
INSERT INTO "shadow".defaults VALUES ('project', 'funding_lvl1', 'number', 'count', '', 'column', 2);
|
365
|
INSERT INTO "shadow".defaults VALUES ('organization', 'country', 'number', 'count', '', 'column', 3);
|
366
|
INSERT INTO "shadow".defaults VALUES ('datasource', 'oa_compatible', 'number', 'count', '', 'column', 4);
|
367
|
UPDATE "shadow".datasource SET yearofvalidation=null WHERE yearofvalidation='-1';
|
368
|
|
369
|
END
|
370
|
$BODY$
|
371
|
LANGUAGE plpgsql VOLATILE
|
372
|
COST 100;
|
373
|
ALTER FUNCTION shadow.extra_defaults_datasource()
|
374
|
OWNER TO sqoop;
|
375
|
|
376
|
|
377
|
--
|
378
|
-- Project Results Extra Inserts
|
379
|
--
|
380
|
|
381
|
CREATE OR REPLACE FUNCTION shadow.update_project_results()
|
382
|
RETURNS void AS
|
383
|
$BODY$
|
384
|
BEGIN
|
385
|
|
386
|
|
387
|
CREATE OR REPLACE VIEW shadow.project_results_publication AS
|
388
|
SELECT "shadow".result_projects.id AS result,
|
389
|
"shadow".result_projects.project AS project_results,
|
390
|
"shadow"."result"."date" as resultdate,
|
391
|
"shadow"."project"."enddate" as projectenddate,
|
392
|
"shadow".result_projects.daysfromend
|
393
|
as daysfromend FROM "shadow".result_projects,
|
394
|
"shadow".result,
|
395
|
"shadow".project
|
396
|
where "shadow".result_projects.id="shadow".result.result_projects
|
397
|
and "shadow".result.type='publication'
|
398
|
and "shadow".project.project_results= "shadow".result_projects.project;
|
399
|
|
400
|
END
|
401
|
$BODY$
|
402
|
LANGUAGE plpgsql VOLATILE
|
403
|
COST 100;
|
404
|
ALTER FUNCTION shadow.update_project_results()
|
405
|
OWNER TO sqoop;
|
406
|
|
407
|
|
408
|
|
409
|
--
|
410
|
-- Project Has Publications Extra Inserts
|
411
|
--
|
412
|
CREATE OR REPLACE FUNCTION shadow.project_has_pubs()
|
413
|
RETURNS void AS
|
414
|
$BODY$
|
415
|
BEGIN
|
416
|
|
417
|
|
418
|
CREATE OR REPLACE VIEW shadow.project_pub_count AS
|
419
|
SELECT count(*) AS count, project_results_publication.project_results
|
420
|
FROM shadow.project_results_publication
|
421
|
GROUP BY project_results_publication.project_results;
|
422
|
|
423
|
--HAS PUBS
|
424
|
UPDATE "shadow"."project" SET haspubs='yes' WHERE project_results in (select project_results from shadow.project_results_publication );
|
425
|
|
426
|
|
427
|
END
|
428
|
$BODY$
|
429
|
LANGUAGE plpgsql VOLATILE
|
430
|
COST 100;
|
431
|
ALTER FUNCTION shadow.project_has_pubs()
|
432
|
OWNER TO sqoop;
|
433
|
|
434
|
|
435
|
--
|
436
|
-- Project Publications Count Updates
|
437
|
--
|
438
|
|
439
|
|
440
|
CREATE OR REPLACE FUNCTION shadow.project_pubs_count()
|
441
|
RETURNS void AS
|
442
|
$BODY$
|
443
|
BEGIN
|
444
|
|
445
|
--COUNT PUBS
|
446
|
|
447
|
UPDATE "shadow"."project" SET numpubs=( SELECT count from shadow.project_pub_count
|
448
|
WHERE shadow.project_pub_count.project_results = shadow.project.project_results )
|
449
|
where "shadow"."project".project_results in ( SELECT "shadow".project_results_publication.project_results FROM shadow.project_results_publication );
|
450
|
|
451
|
|
452
|
END
|
453
|
$BODY$
|
454
|
LANGUAGE plpgsql VOLATILE
|
455
|
COST 100;
|
456
|
ALTER FUNCTION shadow.project_pubs_count()
|
457
|
OWNER TO sqoop;
|
458
|
|
459
|
|
460
|
|
461
|
--
|
462
|
-- Project Delayed Publications
|
463
|
--
|
464
|
|
465
|
CREATE OR REPLACE FUNCTION shadow.project_delayedpubs()
|
466
|
RETURNS void AS
|
467
|
$BODY$
|
468
|
BEGIN
|
469
|
--delayedpubs PUBS
|
470
|
|
471
|
create or replace view shadow.delayedpubs as SELECT count(*) , project_results from "shadow"."project_results_publication"
|
472
|
WHERE "shadow"."project_results_publication".daysfromend > 0 group by project_results;
|
473
|
|
474
|
UPDATE "shadow"."project" SET delayedpubs = (SELECT "shadow"."delayedpubs".count from "shadow"."delayedpubs"
|
475
|
WHERE "shadow"."delayedpubs".project_results=project.project_results ) where "shadow".project.project_results in ( select project_results from "shadow"."delayedpubs" );
|
476
|
|
477
|
|
478
|
END
|
479
|
$BODY$
|
480
|
LANGUAGE plpgsql VOLATILE
|
481
|
COST 100;
|
482
|
ALTER FUNCTION shadow.project_delayedpubs()
|
483
|
OWNER TO sqoop;
|
484
|
|
485
|
|
486
|
--
|
487
|
-- Project daysforlastpub
|
488
|
--
|
489
|
|
490
|
CREATE OR REPLACE FUNCTION shadow.project_daysforlastpub()
|
491
|
RETURNS void AS
|
492
|
$BODY$
|
493
|
BEGIN
|
494
|
|
495
|
|
496
|
--daysforlastpub
|
497
|
|
498
|
UPDATE "shadow"."project" SET daysforlastpub = (
|
499
|
SELECT max(daysfromend)
|
500
|
FROM "shadow"."project_results_publication" WHERE shadow.project.project_results = shadow.project_results_publication.project_results AND "shadow"."project_results_publication".daysfromend > 0 )
|
501
|
where "shadow".project.project_results in ( select project_results from "shadow"."delayedpubs" );
|
502
|
|
503
|
|
504
|
END
|
505
|
$BODY$
|
506
|
LANGUAGE plpgsql VOLATILE
|
507
|
COST 100;
|
508
|
ALTER FUNCTION shadow.project_daysforlastpub()
|
509
|
OWNER TO sqoop;
|
510
|
|
511
|
--
|
512
|
-- Project delayed
|
513
|
--
|
514
|
|
515
|
|
516
|
CREATE OR REPLACE FUNCTION shadow.project_delayed ()
|
517
|
RETURNS void AS
|
518
|
$BODY$
|
519
|
BEGIN
|
520
|
|
521
|
--delayed
|
522
|
|
523
|
UPDATE "shadow"."result" SET delayed = 'yes' WHERE result.id IN
|
524
|
(SELECT result from shadow.project_results_publication where daysfromend >0);
|
525
|
|
526
|
|
527
|
END
|
528
|
$BODY$
|
529
|
LANGUAGE plpgsql VOLATILE
|
530
|
COST 100;
|
531
|
ALTER FUNCTION shadow.project_delayed()
|
532
|
OWNER TO sqoop;
|
533
|
|
534
|
|
535
|
--
|
536
|
-- Cleaning Up Temps
|
537
|
--
|
538
|
CREATE OR REPLACE FUNCTION shadow.cleanTemps ()
|
539
|
RETURNS void AS
|
540
|
$BODY$
|
541
|
BEGIN
|
542
|
|
543
|
drop view if exists shadow.delayedpubs ;
|
544
|
drop view if exists shadow.project_pub_count ;
|
545
|
drop view if exists shadow.delayedpubs ;
|
546
|
|
547
|
drop view if exists shadow.project_results_publication ;
|
548
|
END
|
549
|
$BODY$
|
550
|
LANGUAGE plpgsql VOLATILE
|
551
|
COST 100;
|
552
|
ALTER FUNCTION shadow.cleanTemps()
|
553
|
OWNER TO sqoop;
|
554
|
|
555
|
|
556
|
---functions
|
557
|
|
558
|
--
|
559
|
-- Name: create_indexes(); Type: FUNCTION; Schema: shadow; Owner: sqoop
|
560
|
--
|
561
|
|
562
|
CREATE FUNCTION shadow.create_indexes() RETURNS void
|
563
|
LANGUAGE plpgsql
|
564
|
AS $$
|
565
|
|
566
|
BEGIN
|
567
|
|
568
|
CREATE INDEX datasource_datasource_languages ON "shadow".datasource USING btree (datasource_languages);
|
569
|
CREATE INDEX datasource_datasource_organizations ON "shadow".datasource USING btree (datasource_organizations);
|
570
|
CREATE INDEX datasource_datasource_results ON "shadow".datasource USING btree (datasource_results);
|
571
|
CREATE INDEX datasource_datasource_topics ON "shadow".datasource USING btree (datasource_topics);
|
572
|
CREATE INDEX datasource_type ON "shadow".datasource USING btree (type);
|
573
|
CREATE INDEX datasource_name ON "shadow".datasource USING btree (name);
|
574
|
CREATE INDEX result_access_mode ON "shadow".result USING btree (access_mode);
|
575
|
CREATE INDEX result_authors ON "shadow".result USING btree (authors);
|
576
|
CREATE INDEX result_id ON "shadow".result USING btree (id);
|
577
|
CREATE INDEX result_result_datasources ON "shadow".result USING btree (result_datasources);
|
578
|
CREATE INDEX result_result_languages ON "shadow".result USING btree (result_languages);
|
579
|
CREATE INDEX result_result_projects ON "shadow".result USING btree (result_projects);
|
580
|
CREATE INDEX result_result_topics ON "shadow".result USING btree (result_topics);
|
581
|
CREATE INDEX result_year ON "shadow".result USING btree (year);
|
582
|
CREATE INDEX result_date ON "shadow"."result" USING btree ("date");
|
583
|
CREATE INDEX result_type ON "shadow"."result" USING btree ("type");
|
584
|
|
585
|
|
586
|
CREATE INDEX project_acronym ON "shadow"."project" USING btree (acronym);
|
587
|
CREATE INDEX project_enddate ON "shadow"."project" USING btree (enddate);
|
588
|
CREATE INDEX project_id ON "shadow"."project" USING btree (id);
|
589
|
CREATE INDEX project_project_results ON "shadow"."project" USING btree (project_results);
|
590
|
CREATE INDEX project_results_result ON "shadow"."project_results" USING btree (result);
|
591
|
CREATE INDEX project_results_project ON "shadow"."project_results" USING btree (id);
|
592
|
END;$$;
|
593
|
|
594
|
|
595
|
ALTER FUNCTION shadow.create_indexes() OWNER TO sqoop;
|
596
|
|
597
|
--
|
598
|
-- Name: create_views(); Type: FUNCTION; Schema: shadow; Owner: sqoop
|
599
|
--
|
600
|
|
601
|
CREATE or replace FUNCTION "shadow".create_views() RETURNS void
|
602
|
LANGUAGE plpgsql
|
603
|
AS $$
|
604
|
|
605
|
BEGIN
|
606
|
|
607
|
CREATE OR REPLACE VIEW "shadow".datasource_results as SELECT datasource as id , id as result FROM "shadow".result_datasources ;
|
608
|
|
609
|
CREATE OR REPLACE VIEW "shadow".organization_datasources as SELECT organization as id , id as datasource FROM "shadow".datasource_organizations ;
|
610
|
|
611
|
CREATE OR REPLACE VIEW "shadow".organization_projects as SELECT id as project, organization as id FROM "shadow".project_organizations ;
|
612
|
|
613
|
|
614
|
|
615
|
CREATE OR REPLACE VIEW shadow.result_projects AS SELECT shadow.project_results.result AS id,
|
616
|
shadow.project_results.id AS project, ( select to_date("shadow"."result"."date", 'YYYY-MM-DD')- to_date("shadow"."project"."enddate", 'YYYY-MM-DD')
|
617
|
from shadow.result, shadow.project where shadow.result.id = shadow.project_results.result
|
618
|
and shadow.project_results.id= shadow.project.id and shadow.result.type='publication' )
|
619
|
as daysfromend FROM shadow.project_results;
|
620
|
|
621
|
CREATE OR REPLACE VIEW "shadow".datasource_topics AS
|
622
|
SELECT distinct "shadow".datasource.id, "shadow".result_topics.topic
|
623
|
FROM "shadow".datasource, "shadow".datasource_results, "shadow".result, "shadow".result_topics
|
624
|
WHERE "shadow".datasource.datasource_results = "shadow".datasource_results.id AND "shadow".datasource_results.result = "shadow".result.id AND
|
625
|
"shadow".result_topics.id = "shadow".result.result_topics;
|
626
|
|
627
|
|
628
|
END;$$;
|
629
|
|