-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrdfx.install
287 lines (274 loc) · 9.11 KB
/
rdfx.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
<?php
// $Id$
/**
* @file
* Install, update and uninstall functions for the rdfx module.
*/
/**
* Implements hook_schema().
*/
function rdfx_schema() {
$schema['rdfx_vocabulary_graphs'] = array(
'description' => 'Vocabulary graph, including stubs for any external terms.',
'fields' => array(
'gid' => array(
'description' => 'Graph ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'main_ns' => array(
'description' => 'The {rdfx_namespaces}.nsid for this vocabulary.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'date_created' => array(
'description' => 'The Unix timestamp when the vocabulary was created or imported.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'date_updated' => array(
'description' => 'The Unix timestamp when the vocabulary was updated.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('gid'),
);
$schema['rdfx_namespaces'] = array(
'description' => 'Namespace mappings defined in the vocabulary graph. Mappings are defined on a per graph basis (i.e. foaf will be defined multiple times, once for each vocabulary graph that uses foaf terms).',
'fields' => array(
'nsid' => array(
'description' => 'Namespace ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'gid' => array(
'description' => 'The {rdfx_vocabulary_graphs}.gid of the graph that defined this mapping.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'prefix' => array(
'description' => 'The prefix as defined by the user for the main namespace, and by the source file for the additional namespaces.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'uri' => array(
'description' => 'The URI as defined by the user for the main namespace, and by the source file for the additional namespaces.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
),
'primary key' => array('nsid'),
'unique keys' => array(
'gid_uri' => array('gid', 'uri'),
),
);
$schema['rdfx_terms'] = array(
'description' => 'Terms defined or used in the vocabulary graph. Terms are stored on a per graph basis (i.e. foaf:Person will be stored once for each vocabulary graph that asserts something about it).',
'fields' => array(
'tid' => array(
'description' => 'Term ID.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nsid' => array(
'description' => 'The {rdfx_namespaces}.nsid for this term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'local_name' => array(
'description' => 'The local name of this term.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
'default' => '',
),
),
'primary key' => array('tid'),
'unique keys' => array(
'nsid_ln' => array('nsid', 'local_name'),
),
);
$schema['rdfx_term_types'] = array(
'description' => 'The RDFS and OWL types that apply to the term. Only terms within the main_ns of a vocabulary graph should have term types.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'The term type. Types should use defined constants.',
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
),
),
'primary key' => array('tid', 'type'),
);
$schema['rdfx_vocabulary_details'] = array(
'description' => 'Additional information about a vocabulary.',
'fields' => array(
'gid' => array(
'description' => 'The {rdfx_vocabulary_graphs}.gid of the vocabulary graph.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'language' => array(
'description' => 'The language code. Language codes should follow the format in _locale_get_predefined_list() in includes/iso.inc.',
'type' => 'varchar',
'length' => '12',
'not null' => TRUE,
),
'label' => array(
'description' => 'The name of the vocabulary in language.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'description' => array(
'description' => 'The description of the vocabulary in language',
'type' => 'varchar',
'length' => '4095',
'not null' => FALSE,
),
),
'primary key' => array('gid', 'language'),
);
$schema['rdfx_term_details'] = array(
'description' => 'Additional information about a term. Only terms within the main_ns of a vocabulary graph should have term details.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the term.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'language' => array(
'description' => 'The language code. Language codes should follow the format in _locale_get_predefined_list() in includes/iso.inc.',
'type' => 'varchar',
'length' => '12',
'not null' => TRUE,
),
'label' => array(
'description' => 'The label for term tid in language.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'comment' => array(
'description' => 'The comment for term tid in language',
'type' => 'varchar',
'length' => '4095',
'not null' => FALSE,
),
),
'primary key' => array('tid', 'language'),
);
$schema['rdfx_term_domains'] = array(
'description' => 'Domains of properties. Properties within the main_ns can declare classes outside of the main_ns as domains, but not vice versa.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the property.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'domain_tid' => array(
'description' => 'The {rdfx_terms}.tid of the domain class.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('tid', 'domain_tid'),
);
$schema['rdfx_term_inverses'] = array(
'description' => 'Inverse properties.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the property.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'inverse_tid' => array(
'description' => 'The {rdfx_terms}.tid of the inverse property.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('tid', 'inverse_tid'),
);
$schema['rdfx_term_ranges'] = array(
'description' => 'Ranges of properties. Properties within the main_ns can declare classes outside of the main_ns as ranges, but not vice versa.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the property.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'range_tid' => array(
'description' => 'The {rdfx_terms}.tid of the range class.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('tid', 'range_tid'),
);
$schema['rdfx_term_superclasses'] = array(
'description' => 'Superclasses of classes. Classes within the main_ns can declare classes outside of the main_ns as superclasses, but not as subclasses.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the subclass.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'superclass_tid' => array(
'description' => 'The {rdfx_terms}.tid of the superclass.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('tid', 'superclass_tid'),
);
$schema['rdfx_term_superproperties'] = array(
'description' => 'Superproperties of properties. Properties within the main_ns can declare properties outside of the main_ns as superproperties, but not as subproperties.',
'fields' => array(
'tid' => array(
'description' => 'The {rdfx_terms}.tid of the subproperty.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'superproperty_tid' => array(
'description' => 'The {rdfx_terms}.tid of the superproperty.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array('tid', 'superproperty_tid'),
);
return $schema;
}