Blame view

Database-Modfire/oldMakefile 3.49 KB
8bb30baa   Eduardo Eloy   inital database c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
all: region
D = $$0


region: rewards
	cut -d, -f1 input/ug_concelhos.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u_vertex.py > ii.csv
	
	cut -d, -f2 input/ug_concelhos.csv > i.csv
	sed -i '1d' i.csv
	paste --delimiter='' ii.csv i.csv > iii.csv
	sqlite3 database2.db < imp/import_region.sql
	sqlite3 database2.db < imp/import_action_external.sql


rewards: vertex
	sqlite3 database2.db 'insert into wood_rewards (ug,presc,wood) select ug, presc,sum(wood)  from action group by ug,presc;'
	sqlite3 database2.db 'insert into cork_rewards (ug,presc,cork) select ug, presc,sum(cork)  from action group by ug,presc;'


vertex: adj_area
	cut -d, -f1 input/vsousa-vertex.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u_vertex.py > ii.csv


	cut -d, -f3,4 input/vsousa-vertex.csv > i.csv
	sed -i '1d' i.csv
	paste --delimiter='' ii.csv i.csv > iii.csv
	sqlite3 database2.db < imp/import_vertex.sql
	


adj_area: symbolic
	cut -d, -f1 input/Adjacencias_VSousa2.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	cat ii.csv > iii.csv
	cut -d, -f2 input/Adjacencias_VSousa2.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	paste --delimiter='' iii.csv ii.csv > i.csv
	cut -d, -f6 input/Adjacencias_VSousa2.csv > iii.csv
	sed -i '1d' iii.csv
	paste --delimiter='' i.csv iii.csv > ii.csv
	python3 adjacent_area.py > i.csv
	sqlite3 database2.db < imp/import_adj_area.sql

symbolic: hascut
	cut -d, -f3,4,6,7,8 input/vsousa-prescr-1.csv > ii.csv
	sed -i '1d' ii.csv
	python3 convert_s.py > iii.csv
	paste --delimiter='' i.csv iii.csv > ii.csv
	sqlite3 database2.db < imp/import_symb.sql

hascut: action
	python3 convert_to_bool.py > ii.csv
	sqlite3 database2.db < imp/import_hascut.sql
	

action: adj
	cut -d, -f1 input/vsousa-prescr-1.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	cut -d, -f2 input/vsousa-prescr-1.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_p.py > iii.csv
	paste --delimiter='' ii.csv iii.csv > i.csv
	cut -d, -f3,4,5,6,7,8 input/vsousa-prescr-1.csv > ii.csv
	sed -i '1d' ii.csv
	paste --delimiter='' i.csv ii.csv > iii.csv
	sqlite3 database2.db < imp/import_action.sql
	
	

adj: area
	cut -d, -f1 input/Adjacencias_VSousa2.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	cat ii.csv > iii.csv
	cut -d, -f2 input/Adjacencias_VSousa2.csv > i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	paste --delimiter='' iii.csv ii.csv > i.csv
	cut -d, -f4 input/Adjacencias_VSousa2.csv > iii.csv
	sed -i '1d' iii.csv
	paste --delimiter='' i.csv iii.csv > ii.csv
	sed -i '/-1/d' ii.csv
	sqlite3 database2.db < imp/import_adj.sql

area: perimeter
	cut -d, -f3 input/Adjacencias_VSousa.csv > i.csv
	sed -i '1d' i.csv
	sed -i '1d' i.csv
	paste --delimiter='' ii.csv i.csv > iii.csv
	sqlite3 database2.db < imp/import_area.sql

perimeter: presc_ids
	cut -d, -f1 input/Adjacencias_VSousa.csv > i.csv
	sed -i '1d' i.csv
	sed -i '1d' i.csv
	python3 convert_u.py > ii.csv
	cut -d, -f2 input/Adjacencias_VSousa.csv > i.csv
	sed -i '1d' i.csv
	sed -i '1d' i.csv
	paste --delimiter='' ii.csv i.csv > iii.csv
	sqlite3 database2.db < imp/import_per.sql


presc_ids: ug_ids 
	cut -d, -f2 input/vsousa-prescr-1.csv > i.csv
	sed -i '1d' i.csv
	awk '!seen[$(D)]++' i.csv > ii.csv
	sqlite3 database2.db < imp/import_presc_ids.sql

ug_ids: create_tables
	cut -d, -f1 input/Adjacencias_VSousa.csv > i.csv
	sed -i '1d' i.csv
	sed -i '1d' i.csv
	sqlite3 database2.db < imp/import_ug.sql	

create_tables:
	sqlite3 database2.db  < create.sql


clean:
	rm -rf *.db
	rm -rf i.csv
	rm -rf ii.csv
	rm -rf iii.csv
	rm -rf MODEL.dzn