pho 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/CHANGES +17 -0
  2. data/Rakefile +10 -2
  3. data/bin/talis_store +37 -92
  4. data/doc/rdoc/classes/Pho.html +11 -0
  5. data/doc/rdoc/classes/Pho/CommandLine.html +508 -0
  6. data/doc/rdoc/classes/Pho/DatatypeProperty.html +15 -15
  7. data/doc/rdoc/classes/Pho/Enrichment.html +1 -1
  8. data/doc/rdoc/classes/Pho/Enrichment/{ResourceEnricher.html → StoreEnricher.html} +158 -58
  9. data/doc/rdoc/classes/Pho/Etags.html +36 -36
  10. data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
  11. data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
  12. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +94 -94
  13. data/doc/rdoc/classes/Pho/FieldWeighting.html +14 -14
  14. data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +126 -91
  15. data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +68 -62
  16. data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +22 -57
  17. data/doc/rdoc/classes/Pho/Job.html +68 -67
  18. data/doc/rdoc/classes/Pho/Jobs.html +62 -62
  19. data/doc/rdoc/classes/Pho/QueryProfile.html +64 -64
  20. data/doc/rdoc/classes/Pho/RDF.html +120 -0
  21. data/doc/rdoc/classes/Pho/RDF/Parser.html +277 -0
  22. data/doc/rdoc/classes/Pho/ResourceHash.html +1 -1
  23. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +48 -46
  24. data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +15 -14
  25. data/doc/rdoc/classes/Pho/Snapshot.html +36 -36
  26. data/doc/rdoc/classes/Pho/Sparql.html +50 -0
  27. data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +147 -68
  28. data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +195 -114
  29. data/doc/rdoc/classes/Pho/Status.html +26 -26
  30. data/doc/rdoc/classes/Pho/Store.html +271 -264
  31. data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
  32. data/doc/rdoc/classes/Pho/Update.html +1 -0
  33. data/doc/rdoc/classes/Pho/Update/Changeset.html +69 -68
  34. data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
  35. data/doc/rdoc/classes/Pho/Update/Changesets.html +15 -14
  36. data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +18 -18
  37. data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +24 -24
  38. data/doc/rdoc/classes/Pho/Update/Statement.html +28 -27
  39. data/doc/rdoc/classes/String.html +1 -1
  40. data/doc/rdoc/created.rid +1 -1
  41. data/doc/rdoc/files/CHANGES.html +53 -1
  42. data/doc/rdoc/files/lib/pho/changeset_rb.html +1 -1
  43. data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
  44. data/doc/rdoc/files/lib/pho/converter_rb.html +1 -1
  45. data/doc/rdoc/files/lib/pho/enrichment_rb.html +1 -1
  46. data/doc/rdoc/files/lib/pho/file_management_rb.html +1 -1
  47. data/doc/rdoc/files/lib/pho/file_manager_rb.html +1 -1
  48. data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +1 -1
  49. data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
  50. data/doc/rdoc/files/lib/pho/sparql_rb.html +1 -1
  51. data/doc/rdoc/files/lib/pho/store_rb.html +8 -1
  52. data/doc/rdoc/files/lib/pho_rb.html +4 -2
  53. data/doc/rdoc/fr_class_index.html +6 -1
  54. data/doc/rdoc/fr_file_index.html +2 -0
  55. data/doc/rdoc/fr_method_index.html +192 -172
  56. data/examples/calais/bio.txt +7 -0
  57. data/examples/calais/dump.rb +17 -0
  58. data/examples/calais/enlighten.rb +23 -0
  59. data/examples/calais/output.rdf +25 -0
  60. data/examples/sinatra/viewer.rb +20 -0
  61. data/lib/pho.rb +4 -1
  62. data/lib/pho/changeset.rb +17 -1
  63. data/lib/pho/command_line.rb +166 -0
  64. data/lib/pho/converter.rb +8 -3
  65. data/lib/pho/enrichment.rb +93 -28
  66. data/lib/pho/file_management.rb +32 -19
  67. data/lib/pho/file_manager.rb +22 -26
  68. data/lib/pho/rdf.rb +74 -0
  69. data/lib/pho/rdf_collection.rb +2 -17
  70. data/lib/pho/sparql.rb +150 -38
  71. data/lib/pho/store.rb +28 -2
  72. data/tests/tc_contentbox.rb +41 -0
  73. data/tests/tc_enrichment.rb +41 -4
  74. data/tests/tc_file_manager.rb +97 -7
  75. data/tests/tc_rdf_collection.rb +25 -13
  76. data/tests/tc_rdf_parser.rb +37 -0
  77. data/tests/tc_sparql.rb +72 -2
  78. data/tests/tc_sparql_helper.rb +16 -0
  79. data/tests/ts_pho.rb +2 -1
  80. metadata +20 -3
@@ -0,0 +1,120 @@
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>Module: Pho::RDF</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>Module</strong></td>
53
+ <td class="class-name-in-header">Pho::RDF</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
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Module containing general <a href="RDF.html">RDF</a> utilities and classes
78
+ </p>
79
+ <p>
80
+ Dependent on the redland ruby bindings
81
+ </p>
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+
92
+ <!-- if includes -->
93
+
94
+ <div id="section">
95
+
96
+ <div id="class-list">
97
+ <h3 class="section-bar">Classes and Modules</h3>
98
+
99
+ Class <a href="RDF/Parser.html" class="link">Pho::RDF::Parser</a><br />
100
+
101
+ </div>
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+
111
+
112
+ </div>
113
+
114
+
115
+ <div id="validator-badges">
116
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
117
+ </div>
118
+
119
+ </body>
120
+ </html>
@@ -0,0 +1,277 @@
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="#M000084">parse_ntriples</a>&nbsp;&nbsp;
99
+ <a href="#M000085">parse_ntriples_from_string</a>&nbsp;&nbsp;
100
+ <a href="#M000086">store_ntriples</a>&nbsp;&nbsp;
101
+ <a href="#M000087">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-M000084" class="method-detail">
124
+ <a name="M000084"></a>
125
+
126
+ <div class="method-heading">
127
+ <a href="#M000084" 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('M000084-source');return false;">[Source]</a></p>
144
+ <div class="method-source-code" id="M000084-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-M000085" class="method-detail">
163
+ <a name="M000085"></a>
164
+
165
+ <div class="method-heading">
166
+ <a href="#M000085" 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('M000085-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000085-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-M000086" class="method-detail">
199
+ <a name="M000086"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="#M000086" 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
+ </pre>
217
+ <p><a class="source-toggle" href="#"
218
+ onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
219
+ <div class="method-source-code" id="M000086-source">
220
+ <pre>
221
+ <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 54</span>
222
+ <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>)
223
+ <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>)
224
+ <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>)
225
+ <span class="ruby-keyword kw">end</span>
226
+ </pre>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <div id="method-M000087" class="method-detail">
232
+ <a name="M000087"></a>
233
+
234
+ <div class="method-heading">
235
+ <a href="#M000087" class="method-signature">
236
+ <span class="method-name">store_ntriples_from_string</span><span class="method-args">(string, store, base_uri, graph_name=nil)</span>
237
+ </a>
238
+ </div>
239
+
240
+ <div class="method-description">
241
+ <p>
242
+ Convenience method to parse an ntriples string and store it a Platform
243
+ store
244
+ </p>
245
+ <pre>
246
+ string:: the data to parse
247
+ store:: the store to receive the data
248
+ base_uri:: base uri against which the data is parsed
249
+ graph_name:: uri of graph in store
250
+ </pre>
251
+ <p><a class="source-toggle" href="#"
252
+ onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
253
+ <div class="method-source-code" id="M000087-source">
254
+ <pre>
255
+ <span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 65</span>
256
+ <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>)
257
+ <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>)
258
+ <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>)
259
+ <span class="ruby-keyword kw">end</span>
260
+ </pre>
261
+ </div>
262
+ </div>
263
+ </div>
264
+
265
+
266
+ </div>
267
+
268
+
269
+ </div>
270
+
271
+
272
+ <div id="validator-badges">
273
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
274
+ </div>
275
+
276
+ </body>
277
+ </html>
@@ -79,7 +79,7 @@
79
79
  <div id="description">
80
80
  <p>
81
81
  Module providing code for manipulating resource hashes structured according
82
- to the RDF in JSON spec
82
+ to the <a href="RDF.html">RDF</a> in JSON spec
83
83
  </p>
84
84
 
85
85
  </div>
@@ -92,12 +92,12 @@ Class for converting to and from resource hashes
92
92
  <h3 class="section-bar">Methods</h3>
93
93
 
94
94
  <div class="name-list">
95
- <a href="#M000077">parse</a>&nbsp;&nbsp;
96
- <a href="#M000073">parse_json</a>&nbsp;&nbsp;
97
- <a href="#M000075">parse_ntriples</a>&nbsp;&nbsp;
98
- <a href="#M000074">parse_rdfxml</a>&nbsp;&nbsp;
99
- <a href="#M000076">parse_turtle</a>&nbsp;&nbsp;
100
- <a href="#M000078">serialize_json</a>&nbsp;&nbsp;
95
+ <a href="#M000080">parse</a>&nbsp;&nbsp;
96
+ <a href="#M000076">parse_json</a>&nbsp;&nbsp;
97
+ <a href="#M000078">parse_ntriples</a>&nbsp;&nbsp;
98
+ <a href="#M000077">parse_rdfxml</a>&nbsp;&nbsp;
99
+ <a href="#M000079">parse_turtle</a>&nbsp;&nbsp;
100
+ <a href="#M000081">serialize_json</a>&nbsp;&nbsp;
101
101
  </div>
102
102
  </div>
103
103
 
@@ -119,11 +119,11 @@ Class for converting to and from resource hashes
119
119
  <div id="methods">
120
120
  <h3 class="section-bar">Public Class methods</h3>
121
121
 
122
- <div id="method-M000077" class="method-detail">
123
- <a name="M000077"></a>
122
+ <div id="method-M000080" class="method-detail">
123
+ <a name="M000080"></a>
124
124
 
125
125
  <div class="method-heading">
126
- <a href="#M000077" class="method-signature">
126
+ <a href="#M000080" class="method-signature">
127
127
  <span class="method-name">parse</span><span class="method-args">(data, base_uri, format=&quot;rdfxml&quot;)</span>
128
128
  </a>
129
129
  </div>
@@ -139,10 +139,10 @@ href="../ResourceHash.html">ResourceHash</a>
139
139
  base_uri:: base uri of the data
140
140
  </pre>
141
141
  <p><a class="source-toggle" href="#"
142
- onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
143
- <div class="method-source-code" id="M000077-source">
142
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000080-source">
144
144
  <pre>
145
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 48</span>
145
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 53</span>
146
146
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">&quot;rdfxml&quot;</span>)
147
147
  <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>()
148
148
  <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">format</span>
@@ -162,28 +162,29 @@ href="../ResourceHash.html">ResourceHash</a>
162
162
  </div>
163
163
  </div>
164
164
 
165
- <div id="method-M000073" class="method-detail">
166
- <a name="M000073"></a>
165
+ <div id="method-M000076" class="method-detail">
166
+ <a name="M000076"></a>
167
167
 
168
168
  <div class="method-heading">
169
- <a href="#M000073" class="method-signature">
169
+ <a href="#M000076" class="method-signature">
170
170
  <span class="method-name">parse_json</span><span class="method-args">(json)</span>
171
171
  </a>
172
172
  </div>
173
173
 
174
174
  <div class="method-description">
175
175
  <p>
176
- Parse JSON structured according to the RDF-in-JSON specification into a
177
- Ruby resource hash. Simply invokes the JSON parser.
176
+ Parse JSON structured according to the <a
177
+ href="../RDF.html">RDF</a>-in-JSON specification into a Ruby resource hash.
178
+ Simply invokes the JSON parser.
178
179
  </p>
179
180
  <pre>
180
181
  json:: valid RDF-in-JSON
181
182
  </pre>
182
183
  <p><a class="source-toggle" href="#"
183
- onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
184
- <div class="method-source-code" id="M000073-source">
184
+ onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
185
+ <div class="method-source-code" id="M000076-source">
185
186
  <pre>
186
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 18</span>
187
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 23</span>
187
188
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_json</span>(<span class="ruby-identifier">json</span>)
188
189
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">json</span>)
189
190
  <span class="ruby-keyword kw">end</span>
@@ -192,11 +193,11 @@ Ruby resource hash. Simply invokes the JSON parser.
192
193
  </div>
193
194
  </div>
194
195
 
195
- <div id="method-M000075" class="method-detail">
196
- <a name="M000075"></a>
196
+ <div id="method-M000078" class="method-detail">
197
+ <a name="M000078"></a>
197
198
 
198
199
  <div class="method-heading">
199
- <a href="#M000075" class="method-signature">
200
+ <a href="#M000078" class="method-signature">
200
201
  <span class="method-name">parse_ntriples</span><span class="method-args">(ntriples, base_uri)</span>
201
202
  </a>
202
203
  </div>
@@ -209,10 +210,10 @@ Parse a string containing N-Triples into a resource hash
209
210
  ntriples:: a String containing N-Triples
210
211
  </pre>
211
212
  <p><a class="source-toggle" href="#"
212
- onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
213
- <div class="method-source-code" id="M000075-source">
213
+ onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
214
+ <div class="method-source-code" id="M000078-source">
214
215
  <pre>
215
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 32</span>
216
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 37</span>
216
217
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">base_uri</span>)
217
218
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">&quot;ntriples&quot;</span>)
218
219
  <span class="ruby-keyword kw">end</span>
@@ -221,27 +222,28 @@ Parse a string containing N-Triples into a resource hash
221
222
  </div>
222
223
  </div>
223
224
 
224
- <div id="method-M000074" class="method-detail">
225
- <a name="M000074"></a>
225
+ <div id="method-M000077" class="method-detail">
226
+ <a name="M000077"></a>
226
227
 
227
228
  <div class="method-heading">
228
- <a href="#M000074" class="method-signature">
229
+ <a href="#M000077" class="method-signature">
229
230
  <span class="method-name">parse_rdfxml</span><span class="method-args">(rdfxml, base_uri)</span>
230
231
  </a>
231
232
  </div>
232
233
 
233
234
  <div class="method-description">
234
235
  <p>
235
- Parse a string containing RDF/XML into a resource hash
236
+ Parse a string containing <a href="../RDF.html">RDF</a>/XML into a resource
237
+ hash
236
238
  </p>
237
239
  <pre>
238
240
  rdfxml: a String containing RDF/XML
239
241
  </pre>
240
242
  <p><a class="source-toggle" href="#"
241
- onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
242
- <div class="method-source-code" id="M000074-source">
243
+ onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
244
+ <div class="method-source-code" id="M000077-source">
243
245
  <pre>
244
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 25</span>
246
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 30</span>
245
247
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_rdfxml</span>(<span class="ruby-identifier">rdfxml</span>, <span class="ruby-identifier">base_uri</span>)
246
248
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">rdfxml</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">&quot;rdfxml&quot;</span>)
247
249
  <span class="ruby-keyword kw">end</span>
@@ -250,11 +252,11 @@ Parse a string containing RDF/XML into a resource hash
250
252
  </div>
251
253
  </div>
252
254
 
253
- <div id="method-M000076" class="method-detail">
254
- <a name="M000076"></a>
255
+ <div id="method-M000079" class="method-detail">
256
+ <a name="M000079"></a>
255
257
 
256
258
  <div class="method-heading">
257
- <a href="#M000076" class="method-signature">
259
+ <a href="#M000079" class="method-signature">
258
260
  <span class="method-name">parse_turtle</span><span class="method-args">(turtle, base_uri)</span>
259
261
  </a>
260
262
  </div>
@@ -267,10 +269,10 @@ Parse a string containing Turtle into a resource hash
267
269
  ntriples:: a String containing Turtle
268
270
  </pre>
269
271
  <p><a class="source-toggle" href="#"
270
- onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
271
- <div class="method-source-code" id="M000076-source">
272
+ onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
273
+ <div class="method-source-code" id="M000079-source">
272
274
  <pre>
273
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 39</span>
275
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 44</span>
274
276
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_turtle</span>(<span class="ruby-identifier">turtle</span>, <span class="ruby-identifier">base_uri</span>)
275
277
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">turtle</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">&quot;turtle&quot;</span>)
276
278
  <span class="ruby-keyword kw">end</span>
@@ -279,27 +281,27 @@ Parse a string containing Turtle into a resource hash
279
281
  </div>
280
282
  </div>
281
283
 
282
- <div id="method-M000078" class="method-detail">
283
- <a name="M000078"></a>
284
+ <div id="method-M000081" class="method-detail">
285
+ <a name="M000081"></a>
284
286
 
285
287
  <div class="method-heading">
286
- <a href="#M000078" class="method-signature">
288
+ <a href="#M000081" class="method-signature">
287
289
  <span class="method-name">serialize_json</span><span class="method-args">(hash)</span>
288
290
  </a>
289
291
  </div>
290
292
 
291
293
  <div class="method-description">
292
294
  <p>
293
- Serialize a resource hash as RDF-in-JSON
295
+ Serialize a resource hash as <a href="../RDF.html">RDF</a>-in-JSON
294
296
  </p>
295
297
  <pre>
296
298
  hash:: the resource hash to serialize
297
299
  </pre>
298
300
  <p><a class="source-toggle" href="#"
299
- onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
300
- <div class="method-source-code" id="M000078-source">
301
+ onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
302
+ <div class="method-source-code" id="M000081-source">
301
303
  <pre>
302
- <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 66</span>
304
+ <span class="ruby-comment cmt"># File lib/pho/converter.rb, line 71</span>
303
305
  <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">serialize_json</span>(<span class="ruby-identifier">hash</span>)
304
306
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">hash</span>)
305
307
  <span class="ruby-keyword kw">end</span>