-
Notifications
You must be signed in to change notification settings - Fork 1
/
islandora_metadata_analyzer.install
executable file
·332 lines (308 loc) · 9.53 KB
/
islandora_metadata_analyzer.install
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?php
/**
* Implements hook_install().
*/
function islandora_metadata_analyzer_install() {
// Make real foreign keys.
db_query('
ALTER TABLE {islandora_metadata_analyzer_paths}
ADD CONSTRAINT {islandora_metadata_analyzer_results}
FOREIGN KEY (result_id) REFERENCES {islandora_metadata_analyzer_results} (result_id) ON DELETE CASCADE
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_path_data}
ADD CONSTRAINT {islandora_metadata_analyzer_paths}
FOREIGN KEY (path_id) REFERENCES {islandora_metadata_analyzer_paths} (path_id) ON DELETE CASCADE
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_data_pids}
ADD CONSTRAINT {islandora_metadata_analyzer_path_data}
FOREIGN KEY (path_data_id) REFERENCES {islandora_metadata_analyzer_path_data} (path_data_id) ON DELETE CASCADE
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_all_pids}
ADD CONSTRAINT {islandora_metadata_analyzer_all_paths}
FOREIGN KEY (path_id) REFERENCES {islandora_metadata_analyzer_all_paths} (path_id) ON DELETE CASCADE
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_all_paths}
ADD CONSTRAINT {islandora_metadata_analyzer_results2}
FOREIGN KEY (result_id) REFERENCES {islandora_metadata_analyzer_results} (result_id) ON DELETE CASCADE
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_pids}
ADD CONSTRAINT {islandora_metadata_analyzer_results3}
FOREIGN KEY (result_id) REFERENCES {islandora_metadata_analyzer_results} (result_id) ON DELETE CASCADE
');
}
/**
* Implements hook_uninstall().
*/
function islandora_metadata_analyzer_uninstall() {
// Make real foreign keys.
db_query('
ALTER TABLE {islandora_metadata_analyzer_paths}
DROP FOREIGN KEY {islandora_metadata_analyzer_results}
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_path_data}
DROP FOREIGN KEY {islandora_metadata_analyzer_paths}
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_data_pids}
DROP FOREIGN KEY {islandora_metadata_analyzer_path_data}
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_all_pids}
DROP FOREIGN KEY {islandora_metadata_analyzer_all_paths}
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_all_paths}
DROP FOREIGN KEY {islandora_metadata_analyzer_results2}
');
db_query('
ALTER TABLE {islandora_metadata_analyzer_pids}
DROP FOREIGN KEY {islandora_metadata_analyzer_results3}
');
}
/**
* Implements hook_schema
*/
function islandora_metadata_analyzer_schema() {
$schema['islandora_metadata_analyzer_results'] = array(
'description' => t('Storage area for results.'),
'fields' => array(
'result_id' => array(
'description' => 'The primary identifier for each result.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'title' => array(
'description' => t('Title of result set'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'unnamed result',
),
'query_time' => array(
'description' => t('Time for query'),
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '0',
),
'pid' => array(
'description' => t('PID of parent collection'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'no:pid',
),
'element_data' => array(
'description' => t('Data collected on elements'),
'type' => 'blob',
'length' => 'normal',
'not null' => TRUE,
),
'record_count' => array(
'description' => t('Count of Records Processed'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'stream' => array(
'description' => t('Metadata stream processed'),
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
'default' => 'no stream',
),
),
'primary key' => array('result_id'),
);
/*Metadata paths*/
$schema['islandora_metadata_analyzer_paths'] = array(
'description' => t('Storage area for results.'),
'fields' => array(
'path_id' => array(
'description' => 'The primary identifier for each path.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'result_id' => array(
'description' => t('Key to parent result set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'path' => array(
'description' => t('Metadata Path'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nopath',
),
),
'primary key' => array('path_id'),
'foreign keys' => array(
'islandora_metadata_analyzer_results' => array(
'table' => 'islandora_metadata_analyzer_results',
'columns' => array('results_id' => 'results_id'),
),
),
);
/*Hold path and data relationship*/
$schema['islandora_metadata_analyzer_path_data'] = array(
'description' => t('Storage area for path data.'),
'fields' => array(
'path_data_id' => array(
'description' => 'The primary identifier for each path.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'path_id' => array(
'description' => t('Key to parent path set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'path_data' => array(
'description' => t('Path Data'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nodata',
),
),
'primary key' => array('path_data_id'),
'foreign keys' => array(
'islandora_metadata_analyzer_paths' => array(
'table' => 'islandora_metadata_analyzer_paths',
'columns' => array('path_id' => 'path_id'),
),
),
);
/*Table to hold the pids and data relationship*/
$schema['islandora_metadata_analyzer_data_pids'] = array(
'description' => t('Storage area for PID.'),
'fields' => array(
'pid_id' => array(
'description' => 'The primary identifier for each path.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'path_data_id' => array(
'description' => t('Key to parent path set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'pid' => array(
'description' => t('PIDs with data'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nodata',
),
),
'primary key' => array('pid_id'),
'foreign keys' => array(
'islandora_metadata_analyzer_path_data' => array(
'table' => 'islandora_metadata_analyzer_path_data',
'columns' => array('path_data_id' => 'path_data_id'),
),
),
);
$schema['islandora_metadata_analyzer_pids'] = array(
'description' => t('Storage area for all PIDs looked at during analysis.'),
'fields' => array(
'result_id' => array(
'description' => t('Key to parent path set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'pid' => array(
'description' => t('PIDs looked at in analysis'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nodata',
),
),
'foreign keys' => array(
'islandora_metadata_analyzer_results3' => array(
'table' => 'islandora_metadata_analyzer_results',
'columns' => array('results_id' => 'results_id'),
),
),
);
$schema['islandora_metadata_analyzer_all_paths'] = array(
'description' => t('Storage area for results.'),
'fields' => array(
'path_id' => array(
'description' => 'The primary identifier for each path.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'result_id' => array(
'description' => t('Key to parent result set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'path' => array(
'description' => t('Metadata Path'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nopath',
),
),
'primary key' => array('path_id'),
'foreign keys' => array(
'islandora_metadata_analyzer_results' => array(
'table' => 'islandora_metadata_analyzer_results',
'columns' => array('results_id' => 'results_id'),
),
),
);
$schema['islandora_metadata_analyzer_all_pids'] = array(
'description' => t('Storage area for PID for each element'),
'fields' => array(
'path_id' => array(
'description' => t('Key to parent path set'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => '0',
),
'pid' => array(
'description' => t('PIDs looked at in analysis'),
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 'nodata',
),
),
'foreign keys' => array(
'islandora_metadata_analyzer_all_paths2' => array(
'table' => 'islandora_metadata_analyzer_all_paths',
'columns' => array('path_id' => 'path_id'),
),
),
);
return $schema;
}
?>