activerdf_rdflite 1.2.3 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/doc/rdoc/classes/FetchingAdapter.html +150 -0
- data/doc/rdoc/classes/FetchingAdapter.src/M000015.html +36 -0
- data/doc/rdoc/classes/RDFLite.html +390 -0
- data/doc/rdoc/classes/RDFLite.src/M000001.html +55 -0
- data/doc/rdoc/classes/RDFLite.src/M000002.html +18 -0
- data/doc/rdoc/classes/RDFLite.src/M000003.html +20 -0
- data/doc/rdoc/classes/RDFLite.src/M000004.html +18 -0
- data/doc/rdoc/classes/RDFLite.src/M000005.html +45 -0
- data/doc/rdoc/classes/RDFLite.src/M000006.html +32 -0
- data/doc/rdoc/classes/RDFLite.src/M000007.html +20 -0
- data/doc/rdoc/classes/RDFLite.src/M000008.html +24 -0
- data/doc/rdoc/classes/RDFLite.src/M000009.html +36 -0
- data/doc/rdoc/classes/RDFLite.src/M000010.html +33 -0
- data/doc/rdoc/classes/RDFLite.src/M000011.html +19 -0
- data/doc/rdoc/classes/RDFLite.src/M000012.html +27 -0
- data/doc/rdoc/classes/SuggestingAdapter.html +190 -0
- data/doc/rdoc/classes/SuggestingAdapter.src/M000013.html +23 -0
- data/doc/rdoc/classes/SuggestingAdapter.src/M000014.html +46 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/LICENSE.html +756 -0
- data/doc/rdoc/files/README.html +127 -0
- data/doc/rdoc/files/lib/activerdf_rdflite/fetching_rb.html +115 -0
- data/doc/rdoc/files/lib/activerdf_rdflite/init_rb.html +116 -0
- data/doc/rdoc/files/lib/activerdf_rdflite/rdflite_rb.html +127 -0
- data/doc/rdoc/files/lib/activerdf_rdflite/suggesting_rb.html +115 -0
- data/doc/rdoc/fr_class_index.html +30 -0
- data/doc/rdoc/fr_file_index.html +32 -0
- data/doc/rdoc/fr_method_index.html +42 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/activerdf_rdflite/rdflite.rb +45 -48
- data/test/test_escaped_data.nt +2 -0
- data/test/test_rdflite.rb +33 -6
- metadata +40 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== activerdf_rdflite (1.3) Tue, 27 Feb 2007 20:53:21 +0000
|
2
|
+
* fixed literals with escape characters rdflite
|
3
|
+
* fixed parsing of content-encoded (HTML) literals
|
4
|
+
* refactored rdflite to use generic NTriplesParser
|
5
|
+
* added test cases for encoded and escaped literals
|
6
|
+
|
1
7
|
== activerdf_rdflite (1.2.3) Tue, 13 Feb 2007 20:07:01 +0000
|
2
8
|
* gems published automatically from Rakefile
|
3
9
|
* changing rapper invocation in fetching adapter
|
@@ -0,0 +1,150 @@
|
|
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: FetchingAdapter</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">FetchingAdapter</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/activerdf_rdflite/fetching_rb.html">
|
59
|
+
lib/activerdf_rdflite/fetching.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
|
+
<a href="RDFLite.html">
|
69
|
+
RDFLite
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
<a href="FetchingAdapter.html">FetchingAdapter</a> is an extension to
|
86
|
+
rdflite for fetching RDF from online sources.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000015">fetch</a>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if includes -->
|
106
|
+
|
107
|
+
<div id="section">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<!-- if method_list -->
|
117
|
+
<div id="methods">
|
118
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
119
|
+
|
120
|
+
<div id="method-M000015" class="method-detail">
|
121
|
+
<a name="M000015"></a>
|
122
|
+
|
123
|
+
<div class="method-heading">
|
124
|
+
<a href="FetchingAdapter.src/M000015.html" target="Code" class="method-signature"
|
125
|
+
onclick="popupCode('FetchingAdapter.src/M000015.html');return false;">
|
126
|
+
<span class="method-name">fetch</span><span class="method-args">(url)</span>
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="method-description">
|
131
|
+
<p>
|
132
|
+
fetches RDF/XML data from given url and adds it to the datastore, using the
|
133
|
+
source url as context identifier.
|
134
|
+
</p>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
<div id="validator-badges">
|
146
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
</body>
|
150
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
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>fetch (FetchingAdapter)</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_rdflite/fetching.rb, line 13</span>
|
14
|
+
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch</span> <span class="ruby-identifier">url</span>
|
15
|
+
14: <span class="ruby-comment cmt"># check if url starts with http://</span>
|
16
|
+
15: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">url</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/http:\/\/(.*)/</span>)
|
17
|
+
16:
|
18
|
+
17: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"fetching from #{url}"</span>
|
19
|
+
18:
|
20
|
+
19: <span class="ruby-comment cmt">#model = Redland::Model.new</span>
|
21
|
+
20: <span class="ruby-comment cmt">#parser = Redland::Parser.new('rdfxml')</span>
|
22
|
+
21: <span class="ruby-comment cmt">#scan = Redland::Uri.new('http://feature.librdf.org/raptor-scanForRDF')</span>
|
23
|
+
22: <span class="ruby-comment cmt">#enable = Redland::Literal.new('1')</span>
|
24
|
+
23: <span class="ruby-comment cmt">#Redland::librdf_parser_set_feature(parser, scan.uri, enable.node)</span>
|
25
|
+
24: <span class="ruby-comment cmt">#parser.parse_into_model(model, url)</span>
|
26
|
+
25: <span class="ruby-comment cmt">#triples = Redland::Serializer.ntriples.model_to_string(nil, model)</span>
|
27
|
+
26:
|
28
|
+
27: <span class="ruby-identifier">triples</span> = <span class="ruby-node">`rapper --scan --quiet "#{url}"`</span>
|
29
|
+
28: <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">triples</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">$/</span>)
|
30
|
+
29: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"found #{lines.size} triples"</span>
|
31
|
+
30:
|
32
|
+
31: <span class="ruby-identifier">context</span> = <span class="ruby-constant">RDFS</span><span class="ruby-operator">::</span><span class="ruby-constant">Resource</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">url</span>)
|
33
|
+
32: <span class="ruby-identifier">add_ntriples</span>(<span class="ruby-identifier">triples</span>, <span class="ruby-identifier">context</span>)
|
34
|
+
33: <span class="ruby-keyword kw">end</span></pre>
|
35
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,390 @@
|
|
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: RDFLite</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">RDFLite</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/activerdf_rdflite/rdflite_rb.html">
|
59
|
+
lib/activerdf_rdflite/rdflite.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
|
+
<a href="RDFLite.html">RDFLite</a> is a lightweight RDF database on top of
|
84
|
+
sqlite3. It can act as adapter in ActiveRDF. It supports on-disk and
|
85
|
+
in-memory usage, and allows keyword search if ferret is installed.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000006">add</a>
|
98
|
+
<a href="#M000009">add_ntriples</a>
|
99
|
+
<a href="#M000004">clear</a>
|
100
|
+
<a href="#M000005">delete</a>
|
101
|
+
<a href="#M000003">dump</a>
|
102
|
+
<a href="#M000007">flush</a>
|
103
|
+
<a href="#M000008">load</a>
|
104
|
+
<a href="#M000001">new</a>
|
105
|
+
<a href="#M000010">query</a>
|
106
|
+
<a href="#M000002">size</a>
|
107
|
+
<a href="#M000012">subproperties</a>
|
108
|
+
<a href="#M000011">translate</a>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if includes -->
|
116
|
+
|
117
|
+
<div id="section">
|
118
|
+
|
119
|
+
|
120
|
+
<div id="constants-list">
|
121
|
+
<h3 class="section-bar">Constants</h3>
|
122
|
+
|
123
|
+
<div class="name-list">
|
124
|
+
<table summary="Constants">
|
125
|
+
<tr class="top-aligned-row context-row">
|
126
|
+
<td class="context-item-name">SPOC</td>
|
127
|
+
<td>=</td>
|
128
|
+
<td class="context-item-value">['s','p','o','c']</td>
|
129
|
+
<td width="3em"> </td>
|
130
|
+
<td class="context-item-desc">
|
131
|
+
constants for extracting resources/literals from sql results
|
132
|
+
|
133
|
+
</td>
|
134
|
+
</tr>
|
135
|
+
<tr class="top-aligned-row context-row">
|
136
|
+
<td class="context-item-name">Resource</td>
|
137
|
+
<td>=</td>
|
138
|
+
<td class="context-item-value">/<([^>]*)>/</td>
|
139
|
+
</tr>
|
140
|
+
<tr class="top-aligned-row context-row">
|
141
|
+
<td class="context-item-name">Literal</td>
|
142
|
+
<td>=</td>
|
143
|
+
<td class="context-item-value">/"((?:\\"|[^"])*)"/</td>
|
144
|
+
</tr>
|
145
|
+
</table>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<!-- if method_list -->
|
155
|
+
<div id="methods">
|
156
|
+
<h3 class="section-bar">Public Class methods</h3>
|
157
|
+
|
158
|
+
<div id="method-M000001" class="method-detail">
|
159
|
+
<a name="M000001"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="RDFLite.src/M000001.html" target="Code" class="method-signature"
|
163
|
+
onclick="popupCode('RDFLite.src/M000001.html');return false;">
|
164
|
+
<span class="method-name">new</span><span class="method-args">(params = {})</span>
|
165
|
+
</a>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="method-description">
|
169
|
+
<p>
|
170
|
+
instantiates <a href="RDFLite.html">RDFLite</a> database available
|
171
|
+
parameters:
|
172
|
+
</p>
|
173
|
+
<ul>
|
174
|
+
<li>:location => filepath (defaults to memory)
|
175
|
+
|
176
|
+
</li>
|
177
|
+
<li>:keyword => true/false (defaults to false)
|
178
|
+
|
179
|
+
</li>
|
180
|
+
<li>:pidx, :oidx, etc. => true/false (enable/disable these indices)
|
181
|
+
|
182
|
+
</li>
|
183
|
+
</ul>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
188
|
+
|
189
|
+
<div id="method-M000006" class="method-detail">
|
190
|
+
<a name="M000006"></a>
|
191
|
+
|
192
|
+
<div class="method-heading">
|
193
|
+
<a href="RDFLite.src/M000006.html" target="Code" class="method-signature"
|
194
|
+
onclick="popupCode('RDFLite.src/M000006.html');return false;">
|
195
|
+
<span class="method-name">add</span><span class="method-args">(s,p,o,c=nil)</span>
|
196
|
+
</a>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div class="method-description">
|
200
|
+
<p>
|
201
|
+
adds triple(s,p,o) to datastore s,p must be resources, o can be primitive
|
202
|
+
data or resource
|
203
|
+
</p>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="method-M000009" class="method-detail">
|
208
|
+
<a name="M000009"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="RDFLite.src/M000009.html" target="Code" class="method-signature"
|
212
|
+
onclick="popupCode('RDFLite.src/M000009.html');return false;">
|
213
|
+
<span class="method-name">add_ntriples</span><span class="method-args">(ntriples, context)</span>
|
214
|
+
</a>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method-description">
|
218
|
+
<p>
|
219
|
+
adds ntriples from given context into datastore
|
220
|
+
</p>
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div id="method-M000004" class="method-detail">
|
225
|
+
<a name="M000004"></a>
|
226
|
+
|
227
|
+
<div class="method-heading">
|
228
|
+
<a href="RDFLite.src/M000004.html" target="Code" class="method-signature"
|
229
|
+
onclick="popupCode('RDFLite.src/M000004.html');return false;">
|
230
|
+
<span class="method-name">clear</span><span class="method-args">()</span>
|
231
|
+
</a>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
<p>
|
236
|
+
deletes all triples from datastore
|
237
|
+
</p>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div id="method-M000005" class="method-detail">
|
242
|
+
<a name="M000005"></a>
|
243
|
+
|
244
|
+
<div class="method-heading">
|
245
|
+
<a href="RDFLite.src/M000005.html" target="Code" class="method-signature"
|
246
|
+
onclick="popupCode('RDFLite.src/M000005.html');return false;">
|
247
|
+
<span class="method-name">delete</span><span class="method-args">(s, p, o, c=nil)</span>
|
248
|
+
</a>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="method-description">
|
252
|
+
<p>
|
253
|
+
deletes triple(s,p,o,c) from datastore symbol parameters match anything:
|
254
|
+
delete(:s,:p,:o) will delete all triples you can specify a context to limit
|
255
|
+
deletion to that context: delete(:s,:p,:o, ‘<a
|
256
|
+
href="http://context">context</a>’) will delete all triples with that
|
257
|
+
context
|
258
|
+
</p>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div id="method-M000003" class="method-detail">
|
263
|
+
<a name="M000003"></a>
|
264
|
+
|
265
|
+
<div class="method-heading">
|
266
|
+
<a href="RDFLite.src/M000003.html" target="Code" class="method-signature"
|
267
|
+
onclick="popupCode('RDFLite.src/M000003.html');return false;">
|
268
|
+
<span class="method-name">dump</span><span class="method-args">()</span>
|
269
|
+
</a>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div class="method-description">
|
273
|
+
<p>
|
274
|
+
returns all triples in the datastore
|
275
|
+
</p>
|
276
|
+
</div>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div id="method-M000007" class="method-detail">
|
280
|
+
<a name="M000007"></a>
|
281
|
+
|
282
|
+
<div class="method-heading">
|
283
|
+
<a href="RDFLite.src/M000007.html" target="Code" class="method-signature"
|
284
|
+
onclick="popupCode('RDFLite.src/M000007.html');return false;">
|
285
|
+
<span class="method-name">flush</span><span class="method-args">()</span>
|
286
|
+
</a>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
<div class="method-description">
|
290
|
+
<p>
|
291
|
+
flushes openstanding changes to underlying sqlite3
|
292
|
+
</p>
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div id="method-M000008" class="method-detail">
|
297
|
+
<a name="M000008"></a>
|
298
|
+
|
299
|
+
<div class="method-heading">
|
300
|
+
<a href="RDFLite.src/M000008.html" target="Code" class="method-signature"
|
301
|
+
onclick="popupCode('RDFLite.src/M000008.html');return false;">
|
302
|
+
<span class="method-name">load</span><span class="method-args">(file)</span>
|
303
|
+
</a>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
<div class="method-description">
|
307
|
+
<p>
|
308
|
+
loads triples from file in ntriples format
|
309
|
+
</p>
|
310
|
+
</div>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
<div id="method-M000010" class="method-detail">
|
314
|
+
<a name="M000010"></a>
|
315
|
+
|
316
|
+
<div class="method-heading">
|
317
|
+
<a href="RDFLite.src/M000010.html" target="Code" class="method-signature"
|
318
|
+
onclick="popupCode('RDFLite.src/M000010.html');return false;">
|
319
|
+
<span class="method-name">query</span><span class="method-args">(query)</span>
|
320
|
+
</a>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div class="method-description">
|
324
|
+
<p>
|
325
|
+
executes ActiveRDF query on datastore
|
326
|
+
</p>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div id="method-M000002" class="method-detail">
|
331
|
+
<a name="M000002"></a>
|
332
|
+
|
333
|
+
<div class="method-heading">
|
334
|
+
<a href="RDFLite.src/M000002.html" target="Code" class="method-signature"
|
335
|
+
onclick="popupCode('RDFLite.src/M000002.html');return false;">
|
336
|
+
<span class="method-name">size</span><span class="method-args">()</span>
|
337
|
+
</a>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
<div class="method-description">
|
341
|
+
<p>
|
342
|
+
returns the number of triples in the datastore (incl. possible duplicates)
|
343
|
+
</p>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div id="method-M000012" class="method-detail">
|
348
|
+
<a name="M000012"></a>
|
349
|
+
|
350
|
+
<div class="method-heading">
|
351
|
+
<a href="RDFLite.src/M000012.html" target="Code" class="method-signature"
|
352
|
+
onclick="popupCode('RDFLite.src/M000012.html');return false;">
|
353
|
+
<span class="method-name">subproperties</span><span class="method-args">(resource)</span>
|
354
|
+
</a>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div class="method-description">
|
358
|
+
</div>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div id="method-M000011" class="method-detail">
|
362
|
+
<a name="M000011"></a>
|
363
|
+
|
364
|
+
<div class="method-heading">
|
365
|
+
<a href="RDFLite.src/M000011.html" target="Code" class="method-signature"
|
366
|
+
onclick="popupCode('RDFLite.src/M000011.html');return false;">
|
367
|
+
<span class="method-name">translate</span><span class="method-args">(query)</span>
|
368
|
+
</a>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
<div class="method-description">
|
372
|
+
<p>
|
373
|
+
translates ActiveRDF query into internal sqlite query string
|
374
|
+
</p>
|
375
|
+
</div>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
|
379
|
+
</div>
|
380
|
+
|
381
|
+
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<div id="validator-badges">
|
386
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
387
|
+
</div>
|
388
|
+
|
389
|
+
</body>
|
390
|
+
</html>
|
@@ -0,0 +1,55 @@
|
|
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 (RDFLite)</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_rdflite/rdflite.rb, line 34</span>
|
14
|
+
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">params</span> = {})
|
15
|
+
35: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"initialised rdflite with params #{params.to_s}"</span>
|
16
|
+
36:
|
17
|
+
37: <span class="ruby-ivar">@reads</span> = <span class="ruby-keyword kw">true</span>
|
18
|
+
38: <span class="ruby-ivar">@writes</span> = <span class="ruby-keyword kw">true</span>
|
19
|
+
39:
|
20
|
+
40: <span class="ruby-comment cmt"># if no file-location given, we use in-memory store</span>
|
21
|
+
41: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">':memory:'</span>
|
22
|
+
42: <span class="ruby-ivar">@db</span> = <span class="ruby-constant">SQLite3</span><span class="ruby-operator">::</span><span class="ruby-constant">Database</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>)
|
23
|
+
43:
|
24
|
+
44: <span class="ruby-comment cmt"># disable keyword search by default, enable only if ferret is found</span>
|
25
|
+
45: <span class="ruby-ivar">@keyword_search</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:keyword</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:keyword</span>]
|
26
|
+
46: <span class="ruby-ivar">@keyword_search</span> <span class="ruby-operator">&=</span> <span class="ruby-ivar">@@have_ferret</span>
|
27
|
+
47:
|
28
|
+
48: <span class="ruby-ivar">@reasoning</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:reasoning</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
|
29
|
+
49:
|
30
|
+
50: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keyword_search?</span>
|
31
|
+
51: <span class="ruby-comment cmt"># we initialise the ferret index, either as a file or in memory</span>
|
32
|
+
52: <span class="ruby-identifier">infos</span> = <span class="ruby-constant">Ferret</span><span class="ruby-operator">::</span><span class="ruby-constant">Index</span><span class="ruby-operator">::</span><span class="ruby-constant">FieldInfos</span>.<span class="ruby-identifier">new</span>
|
33
|
+
53:
|
34
|
+
54: <span class="ruby-comment cmt"># we setup the fields not to store object's contents</span>
|
35
|
+
55: <span class="ruby-identifier">infos</span>.<span class="ruby-identifier">add_field</span>(<span class="ruby-identifier">:subject</span>, <span class="ruby-identifier">:store</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:yes</span>, <span class="ruby-identifier">:index</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:no</span>, <span class="ruby-identifier">:term_vector</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:no</span>)
|
36
|
+
56: <span class="ruby-identifier">infos</span>.<span class="ruby-identifier">add_field</span>(<span class="ruby-identifier">:object</span>, <span class="ruby-identifier">:store</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:no</span>) <span class="ruby-comment cmt">#, :index => :omit_norms)</span>
|
37
|
+
57:
|
38
|
+
58: <span class="ruby-ivar">@ferret</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>]
|
39
|
+
59: <span class="ruby-constant">Ferret</span><span class="ruby-operator">::</span><span class="ruby-constant">I</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:location</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">'.ferret'</span>, <span class="ruby-identifier">:field_infos</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">infos</span>)
|
40
|
+
60: <span class="ruby-keyword kw">else</span>
|
41
|
+
61: <span class="ruby-constant">Ferret</span><span class="ruby-operator">::</span><span class="ruby-constant">I</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:field_infos</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">infos</span>)
|
42
|
+
62: <span class="ruby-keyword kw">end</span>
|
43
|
+
63: <span class="ruby-keyword kw">end</span>
|
44
|
+
64:
|
45
|
+
65: <span class="ruby-comment cmt"># turn off filesystem synchronisation for speed</span>
|
46
|
+
66: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">synchronous</span> = <span class="ruby-value str">'off'</span>
|
47
|
+
67:
|
48
|
+
68: <span class="ruby-comment cmt"># create triples table. ignores duplicated triples</span>
|
49
|
+
69: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-value str">'create table if not exists triple(s,p,o,c, unique(s,p,o,c) on conflict ignore)'</span>)
|
50
|
+
70:
|
51
|
+
71: <span class="ruby-identifier">create_indices</span>(<span class="ruby-identifier">params</span>)
|
52
|
+
72: <span class="ruby-ivar">@db</span>
|
53
|
+
73: <span class="ruby-keyword kw">end</span></pre>
|
54
|
+
</body>
|
55
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>size (RDFLite)</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_rdflite/rdflite.rb, line 76</span>
|
14
|
+
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
|
15
|
+
77: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-value str">'select count(*) from triple'</span>)[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>
|
16
|
+
78: <span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|