activerdf_redland 1.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/doc/rdoc/classes/RedlandAdapter.html +371 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000001.html +47 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000002.html +42 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000003.html +23 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000004.html +51 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000005.html +18 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000006.html +34 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000007.html +37 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000008.html +21 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000009.html +18 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000011.html +18 -0
- data/doc/rdoc/classes/RedlandAdapter.src/M000012.html +21 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/LICENSE.html +756 -0
- data/doc/rdoc/files/README.html +120 -0
- data/doc/rdoc/files/lib/activerdf_redland/init_rb.html +114 -0
- data/doc/rdoc/files/lib/activerdf_redland/redland_rb.html +125 -0
- data/doc/rdoc/fr_class_index.html +27 -0
- data/doc/rdoc/fr_file_index.html +30 -0
- data/doc/rdoc/fr_method_index.html +38 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/activerdf_redland/redland.rb +42 -2
- data/test/test_redland_adapter.rb +6 -0
- metadata +32 -5
data/CHANGELOG
CHANGED
@@ -0,0 +1,371 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: RedlandAdapter</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">RedlandAdapter</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/activerdf_redland/redland_rb.html">
|
59
|
+
lib/activerdf_redland/redland.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
ActiveRdfAdapter
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Adapter to Redland database uses SPARQL for querying
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000007">add</a>
|
96
|
+
<a href="#M000008">delete</a>
|
97
|
+
<a href="#M000011">dump</a>
|
98
|
+
<a href="#M000010">flush</a>
|
99
|
+
<a href="#M000005">get_query_results</a>
|
100
|
+
<a href="#M000006">get_sparql_query_results</a>
|
101
|
+
<a href="#M000002">initialize_postgresql</a>
|
102
|
+
<a href="#M000003">load</a>
|
103
|
+
<a href="#M000001">new</a>
|
104
|
+
<a href="#M000004">query</a>
|
105
|
+
<a href="#M000009">save</a>
|
106
|
+
<a href="#M000012">size</a>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if includes -->
|
114
|
+
|
115
|
+
<div id="section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<!-- if method_list -->
|
125
|
+
<div id="methods">
|
126
|
+
<h3 class="section-bar">Public Class methods</h3>
|
127
|
+
|
128
|
+
<div id="method-M000001" class="method-detail">
|
129
|
+
<a name="M000001"></a>
|
130
|
+
|
131
|
+
<div class="method-heading">
|
132
|
+
<a href="RedlandAdapter.src/M000001.html" target="Code" class="method-signature"
|
133
|
+
onclick="popupCode('RedlandAdapter.src/M000001.html');return false;">
|
134
|
+
<span class="method-name">new</span><span class="method-args">(params = {})</span>
|
135
|
+
</a>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div class="method-description">
|
139
|
+
<p>
|
140
|
+
instantiate connection to Redland database
|
141
|
+
</p>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
146
|
+
|
147
|
+
<div id="method-M000007" class="method-detail">
|
148
|
+
<a name="M000007"></a>
|
149
|
+
|
150
|
+
<div class="method-heading">
|
151
|
+
<a href="RedlandAdapter.src/M000007.html" target="Code" class="method-signature"
|
152
|
+
onclick="popupCode('RedlandAdapter.src/M000007.html');return false;">
|
153
|
+
<span class="method-name">add</span><span class="method-args">(s, p, o)</span>
|
154
|
+
</a>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
<p>
|
159
|
+
<a href="RedlandAdapter.html#M000007">add</a> triple to datamodel
|
160
|
+
</p>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div id="method-M000008" class="method-detail">
|
165
|
+
<a name="M000008"></a>
|
166
|
+
|
167
|
+
<div class="method-heading">
|
168
|
+
<a href="RedlandAdapter.src/M000008.html" target="Code" class="method-signature"
|
169
|
+
onclick="popupCode('RedlandAdapter.src/M000008.html');return false;">
|
170
|
+
<span class="method-name">delete</span><span class="method-args">(s,p,o)</span>
|
171
|
+
</a>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="method-description">
|
175
|
+
<p>
|
176
|
+
deletes triple(s,p,o) from datastore nil parameters match anything: <a
|
177
|
+
href="RedlandAdapter.html#M000008">delete</a>(nil,nil,nil) will <a
|
178
|
+
href="RedlandAdapter.html#M000008">delete</a> all triples
|
179
|
+
</p>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div id="method-M000011" class="method-detail">
|
184
|
+
<a name="M000011"></a>
|
185
|
+
|
186
|
+
<div class="method-heading">
|
187
|
+
<a href="RedlandAdapter.src/M000011.html" target="Code" class="method-signature"
|
188
|
+
onclick="popupCode('RedlandAdapter.src/M000011.html');return false;">
|
189
|
+
<span class="method-name">dump</span><span class="method-args">()</span>
|
190
|
+
</a>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div class="method-description">
|
194
|
+
<p>
|
195
|
+
returns all triples in the datastore
|
196
|
+
</p>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div id="method-M000010" class="method-detail">
|
201
|
+
<a name="M000010"></a>
|
202
|
+
|
203
|
+
<div class="method-heading">
|
204
|
+
<span class="method-name">flush</span><span class="method-args">()</span>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p>
|
209
|
+
Alias for <a href="RedlandAdapter.html#M000009">save</a>
|
210
|
+
</p>
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
<div id="method-M000005" class="method-detail">
|
215
|
+
<a name="M000005"></a>
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
<a href="RedlandAdapter.src/M000005.html" target="Code" class="method-signature"
|
219
|
+
onclick="popupCode('RedlandAdapter.src/M000005.html');return false;">
|
220
|
+
<span class="method-name">get_query_results</span><span class="method-args">(query, result_format=nil)</span>
|
221
|
+
</a>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="method-description">
|
225
|
+
<p>
|
226
|
+
executes <a href="RedlandAdapter.html#M000004">query</a> and returns
|
227
|
+
results as SPARQL JSON or XML results requires svn version of redland-ruby
|
228
|
+
bindings
|
229
|
+
</p>
|
230
|
+
<ul>
|
231
|
+
<li><a href="RedlandAdapter.html#M000004">query</a>: ActiveRDF Query object
|
232
|
+
|
233
|
+
</li>
|
234
|
+
<li>result_format: :json or :xml
|
235
|
+
|
236
|
+
</li>
|
237
|
+
</ul>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div id="method-M000006" class="method-detail">
|
242
|
+
<a name="M000006"></a>
|
243
|
+
|
244
|
+
<div class="method-heading">
|
245
|
+
<a href="RedlandAdapter.src/M000006.html" target="Code" class="method-signature"
|
246
|
+
onclick="popupCode('RedlandAdapter.src/M000006.html');return false;">
|
247
|
+
<span class="method-name">get_sparql_query_results</span><span class="method-args">(qs, result_format=nil)</span>
|
248
|
+
</a>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="method-description">
|
252
|
+
<p>
|
253
|
+
executes sparql <a href="RedlandAdapter.html#M000004">query</a> and returns
|
254
|
+
results as SPARQL JSON or XML results
|
255
|
+
</p>
|
256
|
+
<ul>
|
257
|
+
<li><a href="RedlandAdapter.html#M000004">query</a>: sparql <a
|
258
|
+
href="RedlandAdapter.html#M000004">query</a> string
|
259
|
+
|
260
|
+
</li>
|
261
|
+
<li>result_format: :json or :xml
|
262
|
+
|
263
|
+
</li>
|
264
|
+
</ul>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="method-M000002" class="method-detail">
|
269
|
+
<a name="M000002"></a>
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<a href="RedlandAdapter.src/M000002.html" target="Code" class="method-signature"
|
273
|
+
onclick="popupCode('RedlandAdapter.src/M000002.html');return false;">
|
274
|
+
<span class="method-name">initialize_postgresql</span><span class="method-args">(params = {})</span>
|
275
|
+
</a>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div class="method-description">
|
279
|
+
<p>
|
280
|
+
instantiate connection to Redland database in Postgres
|
281
|
+
</p>
|
282
|
+
</div>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div id="method-M000003" class="method-detail">
|
286
|
+
<a name="M000003"></a>
|
287
|
+
|
288
|
+
<div class="method-heading">
|
289
|
+
<a href="RedlandAdapter.src/M000003.html" target="Code" class="method-signature"
|
290
|
+
onclick="popupCode('RedlandAdapter.src/M000003.html');return false;">
|
291
|
+
<span class="method-name">load</span><span class="method-args">(location, syntax="ntriples")</span>
|
292
|
+
</a>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<div class="method-description">
|
296
|
+
<p>
|
297
|
+
<a href="RedlandAdapter.html#M000003">load</a> a file from the given
|
298
|
+
location with the given syntax into the model. use Redland syntax strings,
|
299
|
+
e.g. "ntriples" or "rdfxml", defaults to
|
300
|
+
"ntriples"
|
301
|
+
</p>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="method-M000004" class="method-detail">
|
306
|
+
<a name="M000004"></a>
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<a href="RedlandAdapter.src/M000004.html" target="Code" class="method-signature"
|
310
|
+
onclick="popupCode('RedlandAdapter.src/M000004.html');return false;">
|
311
|
+
<span class="method-name">query</span><span class="method-args">(query) {|*clauses| ...}</span>
|
312
|
+
</a>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<div class="method-description">
|
316
|
+
<p>
|
317
|
+
yields <a href="RedlandAdapter.html#M000004">query</a> results (as many as
|
318
|
+
requested in select clauses) executed on data source
|
319
|
+
</p>
|
320
|
+
</div>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div id="method-M000009" class="method-detail">
|
324
|
+
<a name="M000009"></a>
|
325
|
+
|
326
|
+
<div class="method-heading">
|
327
|
+
<a href="RedlandAdapter.src/M000009.html" target="Code" class="method-signature"
|
328
|
+
onclick="popupCode('RedlandAdapter.src/M000009.html');return false;">
|
329
|
+
<span class="method-name">save</span><span class="method-args">()</span>
|
330
|
+
</a>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<div class="method-description">
|
334
|
+
<p>
|
335
|
+
saves updates to the model into the redland file location
|
336
|
+
</p>
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
<div id="method-M000012" class="method-detail">
|
341
|
+
<a name="M000012"></a>
|
342
|
+
|
343
|
+
<div class="method-heading">
|
344
|
+
<a href="RedlandAdapter.src/M000012.html" target="Code" class="method-signature"
|
345
|
+
onclick="popupCode('RedlandAdapter.src/M000012.html');return false;">
|
346
|
+
<span class="method-name">size</span><span class="method-args">()</span>
|
347
|
+
</a>
|
348
|
+
</div>
|
349
|
+
|
350
|
+
<div class="method-description">
|
351
|
+
<p>
|
352
|
+
returns <a href="RedlandAdapter.html#M000012">size</a> of datasources as
|
353
|
+
number of triples warning: expensive method as it iterates through all
|
354
|
+
statements
|
355
|
+
</p>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
|
360
|
+
</div>
|
361
|
+
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
<div id="validator-badges">
|
367
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</body>
|
371
|
+
</html>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (RedlandAdapter)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/activerdf_redland/redland.rb, line 16</span>
|
14
|
+
16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span> = {})
|
15
|
+
17: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:postgresql</span>
|
16
|
+
18: <span class="ruby-identifier">initialize_postgresql</span>(<span class="ruby-identifier">params</span>)
|
17
|
+
19: <span class="ruby-keyword kw">return</span>
|
18
|
+
20: <span class="ruby-keyword kw">end</span>
|
19
|
+
21:
|
20
|
+
22: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">:memory</span>
|
21
|
+
23: <span class="ruby-comment cmt"># setup file locations for redland database</span>
|
22
|
+
24: <span class="ruby-identifier">type</span> = <span class="ruby-value str">'bdb'</span>
|
23
|
+
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'/'</span>)
|
24
|
+
26: <span class="ruby-identifier">path</span>, <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>])
|
25
|
+
27: <span class="ruby-keyword kw">else</span>
|
26
|
+
28: <span class="ruby-identifier">path</span> = <span class="ruby-value str">'.'</span>
|
27
|
+
29: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>]
|
28
|
+
30: <span class="ruby-keyword kw">end</span>
|
29
|
+
31: <span class="ruby-keyword kw">else</span>
|
30
|
+
32: <span class="ruby-comment cmt"># fall back to in-memory redland </span>
|
31
|
+
33: <span class="ruby-identifier">type</span> = <span class="ruby-value str">'memory'</span>; <span class="ruby-identifier">path</span> = <span class="ruby-value str">''</span>; <span class="ruby-identifier">file</span> = <span class="ruby-value str">'.'</span>
|
32
|
+
34: <span class="ruby-keyword kw">end</span>
|
33
|
+
35:
|
34
|
+
36:
|
35
|
+
37: <span class="ruby-keyword kw">begin</span>
|
36
|
+
38: <span class="ruby-ivar">@store</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">HashStore</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">path</span>, <span class="ruby-keyword kw">false</span>)
|
37
|
+
39: <span class="ruby-ivar">@model</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@store</span>
|
38
|
+
40: <span class="ruby-ivar">@reads</span> = <span class="ruby-keyword kw">true</span>
|
39
|
+
41: <span class="ruby-ivar">@writes</span> = <span class="ruby-keyword kw">true</span>
|
40
|
+
42: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"initialised Redland adapter to #{@model.inspect}"</span>
|
41
|
+
43:
|
42
|
+
44: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">RedlandError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
43
|
+
45: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRdfError</span>, <span class="ruby-node">"could not initialise Redland database: #{e.message}"</span>
|
44
|
+
46: <span class="ruby-keyword kw">end</span>
|
45
|
+
47: <span class="ruby-keyword kw">end</span></pre>
|
46
|
+
</body>
|
47
|
+
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>initialize_postgresql (RedlandAdapter)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/activerdf_redland/redland.rb, line 50</span>
|
14
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_postgresql</span>(<span class="ruby-identifier">params</span> = {})
|
15
|
+
51: <span class="ruby-comment cmt"># author: Richard Dale</span>
|
16
|
+
52: <span class="ruby-identifier">type</span> = <span class="ruby-value str">'postgresql'</span>
|
17
|
+
53: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:name</span>]
|
18
|
+
54:
|
19
|
+
55: <span class="ruby-identifier">options</span> = []
|
20
|
+
56: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"new='#{params[:new]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:new</span>]
|
21
|
+
57: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"bulk='#{params[:bulk]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:bulk</span>]
|
22
|
+
58: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"merge='#{params[:merge]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:merge</span>]
|
23
|
+
59: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"host='#{params[:host]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:host</span>]
|
24
|
+
60: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"database='#{params[:database]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:database</span>]
|
25
|
+
61: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"user='#{params[:user]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:user</span>]
|
26
|
+
62: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"password='#{params[:password]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:password</span>]
|
27
|
+
63: <span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"port='#{params[:port]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:port</span>]
|
28
|
+
64:
|
29
|
+
65:
|
30
|
+
66: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"RedlandAdapter: initializing with type: #{type} name: #{name} options: #{options.join(',')}"</span>
|
31
|
+
67:
|
32
|
+
68: <span class="ruby-keyword kw">begin</span>
|
33
|
+
69: <span class="ruby-ivar">@store</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">TripleStore</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>))
|
34
|
+
70: <span class="ruby-ivar">@model</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@store</span>
|
35
|
+
71: <span class="ruby-ivar">@reads</span> = <span class="ruby-keyword kw">true</span>
|
36
|
+
72: <span class="ruby-ivar">@writes</span> = <span class="ruby-keyword kw">true</span>
|
37
|
+
73: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">RedlandError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
38
|
+
74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRdfError</span>, <span class="ruby-node">"could not initialise Redland database: #{e.message}"</span>
|
39
|
+
75: <span class="ruby-keyword kw">end</span>
|
40
|
+
76: <span class="ruby-keyword kw">end</span></pre>
|
41
|
+
</body>
|
42
|
+
</html>
|