pho 0.7.5 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/CHANGES +21 -0
  2. data/Rakefile +1 -1
  3. data/doc/rdoc/classes/Pho.html +0 -5
  4. data/doc/rdoc/classes/Pho/CommandLine.html +108 -108
  5. data/doc/rdoc/classes/Pho/DatatypeProperty.html +15 -15
  6. data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +3 -3
  7. data/doc/rdoc/classes/Pho/Etags.html +36 -36
  8. data/doc/rdoc/classes/Pho/Facet/Results.html +1 -1
  9. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +106 -106
  10. data/doc/rdoc/classes/Pho/FieldWeighting.html +14 -14
  11. data/doc/rdoc/classes/Pho/Job.html +67 -68
  12. data/doc/rdoc/classes/Pho/Jobs.html +62 -62
  13. data/doc/rdoc/classes/Pho/OAI/Records.html +7 -6
  14. data/doc/rdoc/classes/Pho/OAI/Statistics.html +194 -0
  15. data/doc/rdoc/classes/Pho/QueryProfile.html +86 -81
  16. data/doc/rdoc/classes/Pho/ResourceHash.html +1 -1
  17. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +36 -35
  18. data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +2 -3
  19. data/doc/rdoc/classes/Pho/Snapshot.html +36 -36
  20. data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +3 -4
  21. data/doc/rdoc/classes/Pho/Status.html +26 -26
  22. data/doc/rdoc/classes/Pho/Store.html +257 -254
  23. data/doc/rdoc/classes/Pho/StoreSparqlClient.html +14 -14
  24. data/doc/rdoc/classes/Pho/Update/Changeset.html +5 -6
  25. data/doc/rdoc/classes/Pho/Update/Changesets.html +2 -3
  26. data/doc/rdoc/classes/Pho/Update/Statement.html +3 -4
  27. data/doc/rdoc/classes/String.html +1 -1
  28. data/doc/rdoc/created.rid +1 -1
  29. data/doc/rdoc/files/CHANGES.html +33 -4
  30. data/doc/rdoc/files/lib/pho/converter_rb.html +1 -8
  31. data/doc/rdoc/files/lib/pho/oai_rb.html +1 -1
  32. data/doc/rdoc/files/lib/pho/query_profile_rb.html +1 -1
  33. data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
  34. data/doc/rdoc/files/lib/pho_rb.html +5 -3
  35. data/doc/rdoc/fr_class_index.html +0 -2
  36. data/doc/rdoc/fr_file_index.html +0 -1
  37. data/doc/rdoc/fr_method_index.html +132 -136
  38. data/lib/pho.rb +7 -3
  39. data/lib/pho/converter.rb +23 -30
  40. data/lib/pho/oai.rb +5 -4
  41. data/lib/pho/query_profile.rb +6 -1
  42. data/lib/pho/store.rb +17 -12
  43. data/tests/tc_changeset_builder.rb +2 -2
  44. data/tests/tc_converter.rb +3 -3
  45. data/tests/tc_oai.rb +1 -1
  46. data/tests/tc_query_profile.rb +37 -1
  47. data/tests/ts_pho.rb +0 -1
  48. metadata +5 -9
  49. data/doc/rdoc/classes/Pho/RDF.html +0 -120
  50. data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
  51. data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
  52. data/lib/pho/rdf.rb +0 -76
  53. data/tests/tc_rdf_parser.rb +0 -37
@@ -1,279 +0,0 @@
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: Pho::RDF::Parser</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">Pho::RDF::Parser</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/pho/rdf_rb.html">
59
- lib/pho/rdf.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
- Object
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
- General <a href="../RDF.html">RDF</a> parsing utilities.
84
- </p>
85
- <p>
86
- Currently a convenience wrapper around the Redland Ruby bindings
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="#M000092">parse_ntriples</a>&nbsp;&nbsp;
99
- <a href="#M000093">parse_ntriples_from_string</a>&nbsp;&nbsp;
100
- <a href="#M000094">store_ntriples</a>&nbsp;&nbsp;
101
- <a href="#M000095">store_ntriples_from_string</a>&nbsp;&nbsp;
102
- </div>
103
- </div>
104
-
105
- </div>
106
-
107
-
108
- <!-- if includes -->
109
-
110
- <div id="section">
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
- <!-- if method_list -->
120
- <div id="methods">
121
- <h3 class="section-bar">Public Class methods</h3>
122
-
123
- <div id="method-M000092" class="method-detail">
124
- <a name="M000092"></a>
125
-
126
- <div class="method-heading">
127
- <a href="#M000092" class="method-signature">
128
- <span class="method-name">parse_ntriples</span><span class="method-args">(file, base_uri=nil)</span>
129
- </a>
130
- </div>
131
-
132
- <div class="method-description">
133
- <p>
134
- Parse a file containing ntriples into <a href="../RDF.html">RDF</a>/XML.
135
- Returns a string
136
- </p>
137
- <pre>
138
- file:: File object
139
- base_uri:: optional base uri to be used when parsing. If not set, then uris are resolved
140
- relative to the File
141
- </pre>
142
- <p><a class="source-toggle" href="#"
143
- onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
144
- <div class="method-source-code" id="M000092-source">
145
- <pre>
146
- <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 24</span>
147
- <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword kw">nil</span>)
148
- <span class="ruby-identifier">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>()
149
- <span class="ruby-identifier">parser</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;ntriples&quot;</span>, <span class="ruby-value str">&quot;&quot;</span>)
150
- <span class="ruby-identifier">uri</span> = <span class="ruby-node">&quot;file:#{file.path}&quot;</span>
151
- <span class="ruby-identifier">base_uri</span> = <span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">base_uri</span>
152
- <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse_into_model</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">base_uri</span>)
153
- <span class="ruby-identifier">serializer</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Serializer</span>.<span class="ruby-identifier">new</span>( <span class="ruby-value str">&quot;rdfxml&quot;</span>, <span class="ruby-value str">&quot;application/rdf+xml&quot;</span> )
154
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">serializer</span>.<span class="ruby-identifier">model_to_string</span>(<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>), <span class="ruby-identifier">model</span>)
155
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
156
- <span class="ruby-keyword kw">end</span>
157
- </pre>
158
- </div>
159
- </div>
160
- </div>
161
-
162
- <div id="method-M000093" class="method-detail">
163
- <a name="M000093"></a>
164
-
165
- <div class="method-heading">
166
- <a href="#M000093" class="method-signature">
167
- <span class="method-name">parse_ntriples_from_string</span><span class="method-args">(string, base_uri)</span>
168
- </a>
169
- </div>
170
-
171
- <div class="method-description">
172
- <p>
173
- Parse a string containing ntriples into <a href="../RDF.html">RDF</a>/XML.
174
- Returns a string
175
- </p>
176
- <pre>
177
- string:: the string containing the data
178
- base_uri:: base uri for parsing the data
179
- </pre>
180
- <p><a class="source-toggle" href="#"
181
- onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
182
- <div class="method-source-code" id="M000093-source">
183
- <pre>
184
- <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 39</span>
185
- <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">base_uri</span>)
186
- <span class="ruby-identifier">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>()
187
- <span class="ruby-identifier">parser</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;ntriples&quot;</span>, <span class="ruby-value str">&quot;&quot;</span>)
188
- <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse_string_into_model</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">string</span>, <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>))
189
- <span class="ruby-identifier">serializer</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Serializer</span>.<span class="ruby-identifier">new</span>( <span class="ruby-value str">&quot;rdfxml&quot;</span>, <span class="ruby-value str">&quot;application/rdf+xml&quot;</span> )
190
- <span class="ruby-identifier">data</span> = <span class="ruby-identifier">serializer</span>.<span class="ruby-identifier">model_to_string</span>(<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>), <span class="ruby-identifier">model</span>)
191
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
192
- <span class="ruby-keyword kw">end</span>
193
- </pre>
194
- </div>
195
- </div>
196
- </div>
197
-
198
- <div id="method-M000094" class="method-detail">
199
- <a name="M000094"></a>
200
-
201
- <div class="method-heading">
202
- <a href="#M000094" class="method-signature">
203
- <span class="method-name">store_ntriples</span><span class="method-args">(file, store, base_uri=nil, graph_name=nil)</span>
204
- </a>
205
- </div>
206
-
207
- <div class="method-description">
208
- <p>
209
- Convenience method to parse an ntriples file and store it a Platform store
210
- </p>
211
- <pre>
212
- file:: the file to parse
213
- store:: the store to receive the data
214
- base_uri:: base uri against which the data is parsed
215
- graph_name:: uri of graph in store
216
- TODO: can now be submitted as turtle
217
- </pre>
218
- <p><a class="source-toggle" href="#"
219
- onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
220
- <div class="method-source-code" id="M000094-source">
221
- <pre>
222
- <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 55</span>
223
- <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">store_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
224
- <span class="ruby-identifier">data</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">base_uri</span>)
225
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>)
226
- <span class="ruby-keyword kw">end</span>
227
- </pre>
228
- </div>
229
- </div>
230
- </div>
231
-
232
- <div id="method-M000095" class="method-detail">
233
- <a name="M000095"></a>
234
-
235
- <div class="method-heading">
236
- <a href="#M000095" class="method-signature">
237
- <span class="method-name">store_ntriples_from_string</span><span class="method-args">(string, store, base_uri, graph_name=nil)</span>
238
- </a>
239
- </div>
240
-
241
- <div class="method-description">
242
- <p>
243
- Convenience method to parse an ntriples string and store it a Platform
244
- store
245
- </p>
246
- <pre>
247
- string:: the data to parse
248
- store:: the store to receive the data
249
- base_uri:: base uri against which the data is parsed
250
- graph_name:: uri of graph in store
251
- TODO: can now be submitted as turtle
252
- </pre>
253
- <p><a class="source-toggle" href="#"
254
- onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
255
- <div class="method-source-code" id="M000095-source">
256
- <pre>
257
- <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 67</span>
258
- <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">store_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
259
- <span class="ruby-identifier">data</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">base_uri</span>)
260
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>)
261
- <span class="ruby-keyword kw">end</span>
262
- </pre>
263
- </div>
264
- </div>
265
- </div>
266
-
267
-
268
- </div>
269
-
270
-
271
- </div>
272
-
273
-
274
- <div id="validator-badges">
275
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
276
- </div>
277
-
278
- </body>
279
- </html>
@@ -1,108 +0,0 @@
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>File: rdf.rb</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="fileHeader">
50
- <h1>rdf.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/pho/rdf.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Mon Jun 07 13:27:18 +0100 2010</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- rdf/redland&nbsp;&nbsp;
77
- </div>
78
- </div>
79
-
80
- </div>
81
-
82
-
83
- </div>
84
-
85
-
86
- <!-- if includes -->
87
-
88
- <div id="section">
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
- <!-- if method_list -->
98
-
99
-
100
- </div>
101
-
102
-
103
- <div id="validator-badges">
104
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
- </div>
106
-
107
- </body>
108
- </html>
@@ -1,76 +0,0 @@
1
- module Pho
2
-
3
- #Module containing general RDF utilities and classes
4
- #
5
- #Dependent on the redland ruby bindings
6
- module RDF
7
-
8
- begin
9
- require 'rdf/redland'
10
- rescue LoadError
11
- $stderr.puts "WARNING: Unable to load redland-ruby bindings. Some RDF utils will be unavailable"
12
- end
13
-
14
- #General RDF parsing utilities.
15
- #
16
- #Currently a convenience wrapper around the Redland Ruby bindings
17
- class Parser
18
-
19
- #Parse a file containing ntriples into RDF/XML. Returns a string
20
- #
21
- # file:: File object
22
- # base_uri:: optional base uri to be used when parsing. If not set, then uris are resolved
23
- # relative to the File
24
- def Parser.parse_ntriples(file, base_uri=nil)
25
- model = Redland::Model.new()
26
- parser = Redland::Parser.new("ntriples", "")
27
- uri = "file:#{file.path}"
28
- base_uri = uri unless base_uri
29
- parser.parse_into_model(model, uri, base_uri)
30
- serializer = Redland::Serializer.new( "rdfxml", "application/rdf+xml" )
31
- data = serializer.model_to_string(Redland::Uri.new(base_uri), model)
32
- return data
33
- end
34
-
35
- #Parse a string containing ntriples into RDF/XML. Returns a string
36
- #
37
- # string:: the string containing the data
38
- # base_uri:: base uri for parsing the data
39
- def Parser.parse_ntriples_from_string(string, base_uri)
40
- model = Redland::Model.new()
41
- parser = Redland::Parser.new("ntriples", "")
42
- parser.parse_string_into_model(model, string, Redland::Uri.new(base_uri))
43
- serializer = Redland::Serializer.new( "rdfxml", "application/rdf+xml" )
44
- data = serializer.model_to_string(Redland::Uri.new(base_uri), model)
45
- return data
46
- end
47
-
48
- #Convenience method to parse an ntriples file and store it a Platform store
49
- #
50
- # file:: the file to parse
51
- # store:: the store to receive the data
52
- # base_uri:: base uri against which the data is parsed
53
- # graph_name:: uri of graph in store
54
- # TODO: can now be submitted as turtle
55
- def Parser.store_ntriples(file, store, base_uri=nil, graph_name=nil)
56
- data = Parser.parse_ntriples(file, base_uri)
57
- return store.store_data(data, graph_name)
58
- end
59
-
60
- #Convenience method to parse an ntriples string and store it a Platform store
61
- #
62
- # string:: the data to parse
63
- # store:: the store to receive the data
64
- # base_uri:: base uri against which the data is parsed
65
- # graph_name:: uri of graph in store
66
- # TODO: can now be submitted as turtle
67
- def Parser.store_ntriples_from_string(string, store, base_uri, graph_name=nil)
68
- data = Parser.parse_ntriples_from_string(string, base_uri)
69
- return store.store_data(data, graph_name)
70
- end
71
-
72
- end
73
-
74
- end
75
-
76
- end