pho 0.4.1 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/CHANGES +18 -1
  2. data/README +10 -0
  3. data/Rakefile +2 -1
  4. data/doc/rdoc/classes/Pho.html +33 -22
  5. data/doc/rdoc/classes/Pho/DatatypeProperty.html +12 -12
  6. data/doc/rdoc/classes/Pho/{RDF_JSON.html → Enrichment.html} +8 -7
  7. data/doc/rdoc/classes/Pho/Enrichment/ResourceEnricher.html +310 -0
  8. data/doc/rdoc/classes/Pho/Etags.html +42 -42
  9. data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
  10. data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
  11. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +110 -105
  12. data/doc/rdoc/classes/Pho/FieldWeighting.html +12 -12
  13. data/doc/rdoc/classes/Pho/FileManagement.html +121 -0
  14. data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +443 -0
  15. data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +258 -0
  16. data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +271 -0
  17. data/doc/rdoc/classes/Pho/Job.html +64 -64
  18. data/doc/rdoc/classes/Pho/Jobs.html +60 -60
  19. data/doc/rdoc/classes/Pho/QueryProfile.html +60 -60
  20. data/doc/rdoc/classes/Pho/RDFCollection.html +4 -378
  21. data/doc/rdoc/classes/Pho/ResourceHash.html +123 -0
  22. data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +323 -0
  23. data/doc/rdoc/classes/Pho/{RDF_JSON → ResourceHash}/SetAlgebra.html +18 -18
  24. data/doc/rdoc/classes/Pho/Snapshot.html +35 -35
  25. data/doc/rdoc/classes/Pho/Sparql.html +137 -0
  26. data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +515 -0
  27. data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +575 -0
  28. data/doc/rdoc/classes/Pho/Status.html +26 -26
  29. data/doc/rdoc/classes/Pho/Store.html +271 -241
  30. data/doc/rdoc/classes/Pho/Update/Changeset.html +73 -73
  31. data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +34 -34
  32. data/doc/rdoc/classes/Pho/Update/Changesets.html +14 -14
  33. data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +31 -23
  34. data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +45 -21
  35. data/doc/rdoc/classes/Pho/Update/Statement.html +29 -29
  36. data/doc/rdoc/classes/String.html +1 -1
  37. data/doc/rdoc/created.rid +1 -1
  38. data/doc/rdoc/files/CHANGES.html +49 -3
  39. data/doc/rdoc/files/README.html +15 -1
  40. data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +1 -1
  41. data/doc/rdoc/files/lib/pho/changeset_rb.html +1 -1
  42. data/doc/rdoc/files/lib/pho/converter_rb.html +108 -0
  43. data/doc/rdoc/files/lib/pho/enrichment_rb.html +101 -0
  44. data/doc/rdoc/files/lib/pho/etags_rb.html +1 -1
  45. data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +1 -1
  46. data/doc/rdoc/files/lib/pho/file_management_rb.html +101 -0
  47. data/doc/rdoc/files/lib/pho/file_manager_rb.html +108 -0
  48. data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +1 -1
  49. data/doc/rdoc/files/lib/pho/resource_hash_rb.html +101 -0
  50. data/doc/rdoc/files/lib/pho/{rdf_json_rb.html → sparql_rb.html} +4 -4
  51. data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
  52. data/doc/rdoc/files/lib/pho_rb.html +7 -2
  53. data/doc/rdoc/fr_class_index.html +12 -2
  54. data/doc/rdoc/fr_file_index.html +6 -1
  55. data/doc/rdoc/fr_method_index.html +176 -139
  56. data/examples/sparql_construct_hash.rb +26 -0
  57. data/examples/sparql_select.rb +18 -0
  58. data/lib/pho.rb +6 -1
  59. data/lib/pho/changeset.rb +24 -9
  60. data/lib/pho/changeset_builder.rb +10 -10
  61. data/lib/pho/converter.rb +74 -0
  62. data/lib/pho/enrichment.rb +81 -0
  63. data/lib/pho/etags.rb +1 -0
  64. data/lib/pho/field_predicate_map.rb +6 -1
  65. data/lib/pho/file_management.rb +102 -0
  66. data/lib/pho/file_manager.rb +61 -0
  67. data/lib/pho/rdf_collection.rb +54 -120
  68. data/lib/pho/{rdf_json.rb → resource_hash.rb} +3 -4
  69. data/lib/pho/sparql.rb +332 -0
  70. data/lib/pho/store.rb +20 -14
  71. data/tests/tc_changeset.rb +46 -0
  72. data/tests/tc_changeset_builder.rb +122 -1
  73. data/tests/tc_converter.rb +95 -0
  74. data/tests/tc_enrichment.rb +83 -0
  75. data/tests/tc_file_manager.rb +88 -0
  76. data/tests/tc_rdf_collection.rb +3 -0
  77. data/tests/{tc_rdf_json.rb → tc_resource_hash.rb} +23 -23
  78. data/tests/tc_search.rb +1 -1
  79. data/tests/tc_sparql.rb +131 -6
  80. data/tests/tc_sparql_helper.rb +214 -0
  81. data/tests/ts_pho.rb +6 -2
  82. metadata +47 -8
@@ -93,8 +93,8 @@ href="QueryProfile.html">QueryProfile</a>
93
93
  <h3 class="section-bar">Methods</h3>
94
94
 
95
95
  <div class="name-list">
96
- <a href="#M000122">new</a>&nbsp;&nbsp;
97
- <a href="#M000123">to_rdf</a>&nbsp;&nbsp;
96
+ <a href="#M000170">new</a>&nbsp;&nbsp;
97
+ <a href="#M000171">to_rdf</a>&nbsp;&nbsp;
98
98
  </div>
99
99
  </div>
100
100
 
@@ -148,19 +148,19 @@ The weighting applied to the field
148
148
  <div id="methods">
149
149
  <h3 class="section-bar">Public Class methods</h3>
150
150
 
151
- <div id="method-M000122" class="method-detail">
152
- <a name="M000122"></a>
151
+ <div id="method-M000170" class="method-detail">
152
+ <a name="M000170"></a>
153
153
 
154
154
  <div class="method-heading">
155
- <a href="#M000122" class="method-signature">
155
+ <a href="#M000170" class="method-signature">
156
156
  <span class="method-name">new</span><span class="method-args">(uri, name, weight)</span>
157
157
  </a>
158
158
  </div>
159
159
 
160
160
  <div class="method-description">
161
161
  <p><a class="source-toggle" href="#"
162
- onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
163
- <div class="method-source-code" id="M000122-source">
162
+ onclick="toggleCode('M000170-source');return false;">[Source]</a></p>
163
+ <div class="method-source-code" id="M000170-source">
164
164
  <pre>
165
165
  <span class="ruby-comment cmt"># File lib/pho/query_profile.rb, line 15</span>
166
166
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">weight</span>)
@@ -175,11 +175,11 @@ The weighting applied to the field
175
175
 
176
176
  <h3 class="section-bar">Public Instance methods</h3>
177
177
 
178
- <div id="method-M000123" class="method-detail">
179
- <a name="M000123"></a>
178
+ <div id="method-M000171" class="method-detail">
179
+ <a name="M000171"></a>
180
180
 
181
181
  <div class="method-heading">
182
- <a href="#M000123" class="method-signature">
182
+ <a href="#M000171" class="method-signature">
183
183
  <span class="method-name">to_rdf</span><span class="method-args">(ns=true)</span>
184
184
  </a>
185
185
  </div>
@@ -195,8 +195,8 @@ rdf:Description, optionally including namespaces
195
195
  </td></tr>
196
196
  </table>
197
197
  <p><a class="source-toggle" href="#"
198
- onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
199
- <div class="method-source-code" id="M000123-source">
198
+ onclick="toggleCode('M000171-source');return false;">[Source]</a></p>
199
+ <div class="method-source-code" id="M000171-source">
200
200
  <pre>
201
201
  <span class="ruby-comment cmt"># File lib/pho/query_profile.rb, line 23</span>
202
202
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_rdf</span>(<span class="ruby-identifier">ns</span>=<span class="ruby-keyword kw">true</span>)
@@ -0,0 +1,121 @@
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::FileManagement</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::FileManagement</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/pho/file_manager_rb.html">
59
+ lib/pho/file_manager.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../files/lib/pho/rdf_collection_rb.html">
63
+ lib/pho/rdf_collection.rb
64
+ </a>
65
+ <br />
66
+ <a href="../../files/lib/pho/file_management_rb.html">
67
+ lib/pho/file_management.rb
68
+ </a>
69
+ <br />
70
+ </td>
71
+ </tr>
72
+
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+
88
+ </div>
89
+
90
+
91
+ <!-- if includes -->
92
+
93
+ <div id="section">
94
+
95
+ <div id="class-list">
96
+ <h3 class="section-bar">Classes and Modules</h3>
97
+
98
+ Class <a href="FileManagement/AbstractFileManager.html" class="link">Pho::FileManagement::AbstractFileManager</a><br />
99
+ Class <a href="FileManagement/FileManager.html" class="link">Pho::FileManagement::FileManager</a><br />
100
+ Class <a href="FileManagement/RDFManager.html" class="link">Pho::FileManagement::RDFManager</a><br />
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <!-- if method_list -->
111
+
112
+
113
+ </div>
114
+
115
+
116
+ <div id="validator-badges">
117
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
118
+ </div>
119
+
120
+ </body>
121
+ </html>
@@ -0,0 +1,443 @@
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::FileManagement::AbstractFileManager</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::FileManagement::AbstractFileManager</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/pho/file_management_rb.html">
59
+ lib/pho/file_management.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
+ TODO: move files into hidden directory TODO: add directory traversal
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="#M000029">failures</a>&nbsp;&nbsp;
96
+ <a href="#M000032">get_fail_file_for</a>&nbsp;&nbsp;
97
+ <a href="#M000033">get_ok_file_for</a>&nbsp;&nbsp;
98
+ <a href="#M000025">new</a>&nbsp;&nbsp;
99
+ <a href="#M000028">reset</a>&nbsp;&nbsp;
100
+ <a href="#M000027">retry_failures</a>&nbsp;&nbsp;
101
+ <a href="#M000026">store</a>&nbsp;&nbsp;
102
+ <a href="#M000030">successes</a>&nbsp;&nbsp;
103
+ <a href="#M000031">summary</a>&nbsp;&nbsp;
104
+ </div>
105
+ </div>
106
+
107
+ </div>
108
+
109
+
110
+ <!-- if includes -->
111
+
112
+ <div id="section">
113
+
114
+
115
+ <div id="constants-list">
116
+ <h3 class="section-bar">Constants</h3>
117
+
118
+ <div class="name-list">
119
+ <table summary="Constants">
120
+ <tr class="top-aligned-row context-row">
121
+ <td class="context-item-name">OK</td>
122
+ <td>=</td>
123
+ <td class="context-item-value">&quot;ok&quot;.freeze</td>
124
+ </tr>
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">FAIL</td>
127
+ <td>=</td>
128
+ <td class="context-item-value">&quot;fail&quot;.freeze</td>
129
+ </tr>
130
+ </table>
131
+ </div>
132
+ </div>
133
+
134
+
135
+
136
+ <div id="attribute-list">
137
+ <h3 class="section-bar">Attributes</h3>
138
+
139
+ <div class="name-list">
140
+ <table>
141
+ <tr class="top-aligned-row context-row">
142
+ <td class="context-item-name">dir</td>
143
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
144
+ <td class="context-item-desc"></td>
145
+ </tr>
146
+ <tr class="top-aligned-row context-row">
147
+ <td class="context-item-name">store</td>
148
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
149
+ <td class="context-item-desc"></td>
150
+ </tr>
151
+ </table>
152
+ </div>
153
+ </div>
154
+
155
+
156
+
157
+ <!-- if method_list -->
158
+ <div id="methods">
159
+ <h3 class="section-bar">Public Class methods</h3>
160
+
161
+ <div id="method-M000025" class="method-detail">
162
+ <a name="M000025"></a>
163
+
164
+ <div class="method-heading">
165
+ <a href="#M000025" class="method-signature">
166
+ <span class="method-name">new</span><span class="method-args">(store, dir, ok_suffix=OK, fail_suffix=FAIL, sleep=1)</span>
167
+ </a>
168
+ </div>
169
+
170
+ <div class="method-description">
171
+ <p><a class="source-toggle" href="#"
172
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
173
+ <div class="method-source-code" id="M000025-source">
174
+ <pre>
175
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 15</span>
176
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">ok_suffix</span>=<span class="ruby-constant">OK</span>, <span class="ruby-identifier">fail_suffix</span>=<span class="ruby-constant">FAIL</span>, <span class="ruby-identifier">sleep</span>=<span class="ruby-value">1</span>)
177
+ <span class="ruby-ivar">@store</span> = <span class="ruby-identifier">store</span>
178
+ <span class="ruby-ivar">@dir</span> = <span class="ruby-identifier">dir</span>
179
+ <span class="ruby-ivar">@sleep</span> = <span class="ruby-identifier">sleep</span>
180
+ <span class="ruby-ivar">@ok_suffix</span> = <span class="ruby-identifier">ok_suffix</span>
181
+ <span class="ruby-ivar">@fail_suffix</span> = <span class="ruby-identifier">fail_suffix</span>
182
+ <span class="ruby-keyword kw">end</span>
183
+ </pre>
184
+ </div>
185
+ </div>
186
+ </div>
187
+
188
+ <h3 class="section-bar">Public Instance methods</h3>
189
+
190
+ <div id="method-M000029" class="method-detail">
191
+ <a name="M000029"></a>
192
+
193
+ <div class="method-heading">
194
+ <a href="#M000029" class="method-signature">
195
+ <span class="method-name">failures</span><span class="method-args">()</span>
196
+ </a>
197
+ </div>
198
+
199
+ <div class="method-description">
200
+ <p>
201
+ List <a href="AbstractFileManager.html#M000029">failures</a>
202
+ </p>
203
+ <p><a class="source-toggle" href="#"
204
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
205
+ <div class="method-source-code" id="M000029-source">
206
+ <pre>
207
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 55</span>
208
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">failures</span>()
209
+ <span class="ruby-identifier">fails</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
210
+ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dir</span>, <span class="ruby-value str">&quot;*&quot;</span>) ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
211
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">!=</span> <span class="ruby-node">&quot;.#{@fail_suffix}&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">!=</span> <span class="ruby-node">&quot;.#{@ok_suffix}&quot;</span>
212
+ <span class="ruby-identifier">fails</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>( <span class="ruby-identifier">get_fail_file_for</span>(<span class="ruby-identifier">file</span>) )
213
+ <span class="ruby-keyword kw">end</span>
214
+ <span class="ruby-keyword kw">end</span>
215
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fails</span>
216
+ <span class="ruby-keyword kw">end</span>
217
+ </pre>
218
+ </div>
219
+ </div>
220
+ </div>
221
+
222
+ <div id="method-M000032" class="method-detail">
223
+ <a name="M000032"></a>
224
+
225
+ <div class="method-heading">
226
+ <a href="#M000032" class="method-signature">
227
+ <span class="method-name">get_fail_file_for</span><span class="method-args">(filename)</span>
228
+ </a>
229
+ </div>
230
+
231
+ <div class="method-description">
232
+ <p><a class="source-toggle" href="#"
233
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
234
+ <div class="method-source-code" id="M000032-source">
235
+ <pre>
236
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 87</span>
237
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_fail_file_for</span>(<span class="ruby-identifier">filename</span>)
238
+ <span class="ruby-identifier">ext</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">filename</span>)
239
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/#{ext}/</span>, <span class="ruby-node">&quot;.#{@fail_suffix}&quot;</span>)
240
+ <span class="ruby-keyword kw">end</span>
241
+ </pre>
242
+ </div>
243
+ </div>
244
+ </div>
245
+
246
+ <div id="method-M000033" class="method-detail">
247
+ <a name="M000033"></a>
248
+
249
+ <div class="method-heading">
250
+ <a href="#M000033" class="method-signature">
251
+ <span class="method-name">get_ok_file_for</span><span class="method-args">(filename)</span>
252
+ </a>
253
+ </div>
254
+
255
+ <div class="method-description">
256
+ <p><a class="source-toggle" href="#"
257
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
258
+ <div class="method-source-code" id="M000033-source">
259
+ <pre>
260
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 92</span>
261
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_ok_file_for</span>(<span class="ruby-identifier">filename</span>)
262
+ <span class="ruby-identifier">ext</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">filename</span>)
263
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/#{ext}/</span>, <span class="ruby-node">&quot;.#{@ok_suffix}&quot;</span>)
264
+ <span class="ruby-keyword kw">end</span>
265
+ </pre>
266
+ </div>
267
+ </div>
268
+ </div>
269
+
270
+ <div id="method-M000028" class="method-detail">
271
+ <a name="M000028"></a>
272
+
273
+ <div class="method-heading">
274
+ <a href="#M000028" class="method-signature">
275
+ <span class="method-name">reset</span><span class="method-args">(reset_store=false)</span>
276
+ </a>
277
+ </div>
278
+
279
+ <div class="method-description">
280
+ <p>
281
+ Reset the directory to clear out any previous statuses <a
282
+ href="../Store.html">Store</a> can also be <a
283
+ href="AbstractFileManager.html#M000028">reset</a> at the same time: use
284
+ with care!
285
+ </p>
286
+ <p><a class="source-toggle" href="#"
287
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
288
+ <div class="method-source-code" id="M000028-source">
289
+ <pre>
290
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 45</span>
291
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>(<span class="ruby-identifier">reset_store</span>=<span class="ruby-keyword kw">false</span>)
292
+ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dir</span>, <span class="ruby-node">&quot;*.#{@fail_suffix}&quot;</span>) ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
293
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file</span>)
294
+ <span class="ruby-keyword kw">end</span>
295
+ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dir</span>, <span class="ruby-node">&quot;*.#{@ok_suffix}&quot;</span>) ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
296
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">file</span>)
297
+ <span class="ruby-keyword kw">end</span>
298
+ <span class="ruby-keyword kw">end</span>
299
+ </pre>
300
+ </div>
301
+ </div>
302
+ </div>
303
+
304
+ <div id="method-M000027" class="method-detail">
305
+ <a name="M000027"></a>
306
+
307
+ <div class="method-heading">
308
+ <a href="#M000027" class="method-signature">
309
+ <span class="method-name">retry_failures</span><span class="method-args">()</span>
310
+ </a>
311
+ </div>
312
+
313
+ <div class="method-description">
314
+ <p>
315
+ Retry anything known to have failed
316
+ </p>
317
+ <p><a class="source-toggle" href="#"
318
+ onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
319
+ <div class="method-source-code" id="M000027-source">
320
+ <pre>
321
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 33</span>
322
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">retry_failures</span>()
323
+ <span class="ruby-identifier">retries</span> = <span class="ruby-identifier">failures</span>()
324
+ <span class="ruby-identifier">retries</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filename</span><span class="ruby-operator">|</span>
325
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">get_fail_file_for</span>(<span class="ruby-identifier">filename</span>) )
326
+ <span class="ruby-comment cmt">#store it</span>
327
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">filename</span>)
328
+ <span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">filename</span>)
329
+ <span class="ruby-keyword kw">end</span>
330
+ <span class="ruby-keyword kw">end</span>
331
+ </pre>
332
+ </div>
333
+ </div>
334
+ </div>
335
+
336
+ <div id="method-M000026" class="method-detail">
337
+ <a name="M000026"></a>
338
+
339
+ <div class="method-heading">
340
+ <a href="#M000026" class="method-signature">
341
+ <span class="method-name">store</span><span class="method-args">()</span>
342
+ </a>
343
+ </div>
344
+
345
+ <div class="method-description">
346
+ <p>
347
+ <a href="../Store.html">Store</a> all files that match the file name in
348
+ directory
349
+ </p>
350
+ <p><a class="source-toggle" href="#"
351
+ onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
352
+ <div class="method-source-code" id="M000026-source">
353
+ <pre>
354
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 24</span>
355
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store</span>()
356
+ <span class="ruby-identifier">files_to_store</span> = <span class="ruby-identifier">new_files</span>()
357
+ <span class="ruby-identifier">files_to_store</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filename</span><span class="ruby-operator">|</span>
358
+ <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">filename</span>)
359
+ <span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">filename</span>)
360
+ <span class="ruby-keyword kw">end</span>
361
+ <span class="ruby-keyword kw">end</span>
362
+ </pre>
363
+ </div>
364
+ </div>
365
+ </div>
366
+
367
+ <div id="method-M000030" class="method-detail">
368
+ <a name="M000030"></a>
369
+
370
+ <div class="method-heading">
371
+ <a href="#M000030" class="method-signature">
372
+ <span class="method-name">successes</span><span class="method-args">()</span>
373
+ </a>
374
+ </div>
375
+
376
+ <div class="method-description">
377
+ <p>
378
+ List <a href="AbstractFileManager.html#M000030">successes</a>
379
+ </p>
380
+ <p><a class="source-toggle" href="#"
381
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
382
+ <div class="method-source-code" id="M000030-source">
383
+ <pre>
384
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 66</span>
385
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">successes</span>()
386
+ <span class="ruby-identifier">successes</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
387
+ <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dir</span>, <span class="ruby-value str">&quot;*&quot;</span>) ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
388
+ <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">!=</span> <span class="ruby-node">&quot;.#{@fail_suffix}&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">!=</span> <span class="ruby-node">&quot;.#{@ok_suffix}&quot;</span>
389
+ <span class="ruby-identifier">successes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>( <span class="ruby-identifier">get_ok_file_for</span>(<span class="ruby-identifier">file</span>) )
390
+ <span class="ruby-keyword kw">end</span>
391
+ <span class="ruby-keyword kw">end</span>
392
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">successes</span>
393
+ <span class="ruby-keyword kw">end</span>
394
+ </pre>
395
+ </div>
396
+ </div>
397
+ </div>
398
+
399
+ <div id="method-M000031" class="method-detail">
400
+ <a name="M000031"></a>
401
+
402
+ <div class="method-heading">
403
+ <a href="#M000031" class="method-signature">
404
+ <span class="method-name">summary</span><span class="method-args">()</span>
405
+ </a>
406
+ </div>
407
+
408
+ <div class="method-description">
409
+ <p>
410
+ Summarize the state of the collection to the provied IO object Creates a
411
+ simple report
412
+ </p>
413
+ <p><a class="source-toggle" href="#"
414
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
415
+ <div class="method-source-code" id="M000031-source">
416
+ <pre>
417
+ <span class="ruby-comment cmt"># File lib/pho/file_management.rb, line 78</span>
418
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">summary</span>()
419
+ <span class="ruby-identifier">failures</span> = <span class="ruby-identifier">failures</span>()
420
+ <span class="ruby-identifier">successes</span> = <span class="ruby-identifier">successes</span>()
421
+ <span class="ruby-identifier">newfiles</span> = <span class="ruby-identifier">new_files</span>()
422
+ <span class="ruby-identifier">total</span> = <span class="ruby-identifier">failures</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">successes</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">newfiles</span>.<span class="ruby-identifier">size</span>
423
+ <span class="ruby-identifier">summary</span> = <span class="ruby-node">&quot;#{@dir} contains #{total} files: #{successes.size} stored, #{failures.size} failed, #{newfiles.size} new&quot;</span>
424
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">summary</span>
425
+ <span class="ruby-keyword kw">end</span>
426
+ </pre>
427
+ </div>
428
+ </div>
429
+ </div>
430
+
431
+
432
+ </div>
433
+
434
+
435
+ </div>
436
+
437
+
438
+ <div id="validator-badges">
439
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
440
+ </div>
441
+
442
+ </body>
443
+ </html>