pho 0.7.8 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +8 -0
- data/Rakefile +4 -2
- data/doc/rdoc/classes/Pho.html +4 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +114 -114
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +12 -12
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +29 -29
- data/doc/rdoc/classes/Pho/Etags.html +36 -36
- data/doc/rdoc/classes/Pho/Facet/Results.html +19 -19
- data/doc/rdoc/classes/Pho/Facet/Term.html +6 -6
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +102 -102
- data/doc/rdoc/classes/Pho/FieldWeighting.html +12 -12
- data/doc/rdoc/classes/Pho/FileManagement.html +16 -0
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +168 -108
- data/doc/rdoc/classes/Pho/FileManagement/BNodeRewritingHandler.html +226 -0
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +48 -35
- data/doc/rdoc/classes/Pho/FileManagement/FileSplitter.html +291 -0
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +22 -22
- data/doc/rdoc/classes/Pho/FileManagement/StatementHandler.html +152 -0
- data/doc/rdoc/classes/Pho/FileManagement/Util.html +212 -0
- data/doc/rdoc/classes/Pho/Job.html +64 -64
- data/doc/rdoc/classes/Pho/Jobs.html +60 -60
- data/doc/rdoc/classes/Pho/OAI/Record.html +6 -6
- data/doc/rdoc/classes/Pho/OAI/Records.html +24 -24
- data/doc/rdoc/classes/Pho/OAI/Statistics.html +12 -12
- data/doc/rdoc/classes/Pho/QueryProfile.html +66 -66
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +36 -36
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +12 -12
- data/doc/rdoc/classes/Pho/Snapshot.html +35 -35
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +74 -74
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +78 -78
- data/doc/rdoc/classes/Pho/Status.html +26 -26
- data/doc/rdoc/classes/Pho/Store.html +215 -215
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +12 -12
- data/doc/rdoc/classes/Pho/Update/Changeset.html +63 -63
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +6 -6
- data/doc/rdoc/classes/Pho/Update/Changesets.html +12 -12
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +18 -18
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +24 -24
- data/doc/rdoc/classes/Pho/Update/Statement.html +24 -24
- data/doc/rdoc/classes/String.html +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +13 -1
- data/doc/rdoc/files/lib/pho/file_management_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/upload_rb.html +101 -0
- data/doc/rdoc/files/lib/pho_rb.html +4 -2
- data/doc/rdoc/fr_class_index.html +4 -0
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +228 -218
- data/lib/pho.rb +4 -1
- data/lib/pho/file_management.rb +30 -1
- data/lib/pho/file_manager.rb +7 -0
- data/lib/pho/rdf_collection.rb +4 -4
- data/lib/pho/upload.rb +156 -0
- data/tests/tc_bnodehandler.rb +42 -0
- data/tests/tc_filesplitter.rb +51 -0
- data/tests/ts_pho.rb +3 -1
- metadata +56 -8
@@ -82,11 +82,11 @@
|
|
82
82
|
|
83
83
|
<div id="description">
|
84
84
|
<p>
|
85
|
-
Provides a simple mechanism for managing a directory of RDF
|
86
|
-
|
85
|
+
Provides a simple mechanism for managing a directory of RDF documents and
|
86
|
+
uploading them to platform store.
|
87
87
|
</p>
|
88
88
|
<p>
|
89
|
-
|
89
|
+
Currently supports RDF, Turtle and NTriples
|
90
90
|
</p>
|
91
91
|
|
92
92
|
</div>
|
@@ -98,9 +98,9 @@ Allows a collection to be mirrored into the platform
|
|
98
98
|
<h3 class="section-bar">Methods</h3>
|
99
99
|
|
100
100
|
<div class="name-list">
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
101
|
+
<a href="#M000006">list</a>
|
102
|
+
<a href="#M000005">new</a>
|
103
|
+
<a href="#M000007">store_file</a>
|
104
104
|
</div>
|
105
105
|
</div>
|
106
106
|
|
@@ -150,19 +150,19 @@ Allows a collection to be mirrored into the platform
|
|
150
150
|
<div id="methods">
|
151
151
|
<h3 class="section-bar">Public Class methods</h3>
|
152
152
|
|
153
|
-
<div id="method-
|
154
|
-
<a name="
|
153
|
+
<div id="method-M000005" class="method-detail">
|
154
|
+
<a name="M000005"></a>
|
155
155
|
|
156
156
|
<div class="method-heading">
|
157
|
-
<a href="#
|
157
|
+
<a href="#M000005" class="method-signature">
|
158
158
|
<span class="method-name">new</span><span class="method-args">(store, dir, rdf_suffixes=ALL_RDF, ok_suffix=OK, fail_suffix=FAIL)</span>
|
159
159
|
</a>
|
160
160
|
</div>
|
161
161
|
|
162
162
|
<div class="method-description">
|
163
163
|
<p><a class="source-toggle" href="#"
|
164
|
-
onclick="toggleCode('
|
165
|
-
<div class="method-source-code" id="
|
164
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
165
|
+
<div class="method-source-code" id="M000005-source">
|
166
166
|
<pre>
|
167
167
|
<span class="ruby-comment cmt"># File lib/pho/rdf_collection.rb, line 17</span>
|
168
168
|
<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">rdf_suffixes</span>=<span class="ruby-constant">ALL_RDF</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>)
|
@@ -176,11 +176,11 @@ Allows a collection to be mirrored into the platform
|
|
176
176
|
|
177
177
|
<h3 class="section-bar">Public Instance methods</h3>
|
178
178
|
|
179
|
-
<div id="method-
|
180
|
-
<a name="
|
179
|
+
<div id="method-M000006" class="method-detail">
|
180
|
+
<a name="M000006"></a>
|
181
181
|
|
182
182
|
<div class="method-heading">
|
183
|
-
<a href="#
|
183
|
+
<a href="#M000006" class="method-signature">
|
184
184
|
<span class="method-name">list</span><span class="method-args">(recursive=false)</span>
|
185
185
|
</a>
|
186
186
|
</div>
|
@@ -190,8 +190,8 @@ Allows a collection to be mirrored into the platform
|
|
190
190
|
List files being managed
|
191
191
|
</p>
|
192
192
|
<p><a class="source-toggle" href="#"
|
193
|
-
onclick="toggleCode('
|
194
|
-
<div class="method-source-code" id="
|
193
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
194
|
+
<div class="method-source-code" id="M000006-source">
|
195
195
|
<pre>
|
196
196
|
<span class="ruby-comment cmt"># File lib/pho/rdf_collection.rb, line 23</span>
|
197
197
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>(<span class="ruby-identifier">recursive</span>=<span class="ruby-keyword kw">false</span>)
|
@@ -209,19 +209,19 @@ List files being managed
|
|
209
209
|
|
210
210
|
<h3 class="section-bar">Protected Instance methods</h3>
|
211
211
|
|
212
|
-
<div id="method-
|
213
|
-
<a name="
|
212
|
+
<div id="method-M000007" class="method-detail">
|
213
|
+
<a name="M000007"></a>
|
214
214
|
|
215
215
|
<div class="method-heading">
|
216
|
-
<a href="#
|
216
|
+
<a href="#M000007" class="method-signature">
|
217
217
|
<span class="method-name">store_file</span><span class="method-args">(file, filename)</span>
|
218
218
|
</a>
|
219
219
|
</div>
|
220
220
|
|
221
221
|
<div class="method-description">
|
222
222
|
<p><a class="source-toggle" href="#"
|
223
|
-
onclick="toggleCode('
|
224
|
-
<div class="method-source-code" id="
|
223
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
224
|
+
<div class="method-source-code" id="M000007-source">
|
225
225
|
<pre>
|
226
226
|
<span class="ruby-comment cmt"># File lib/pho/rdf_collection.rb, line 34</span>
|
227
227
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">filename</span>)
|
@@ -233,7 +233,7 @@ List files being managed
|
|
233
233
|
<span class="ruby-keyword kw">else</span>
|
234
234
|
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">store_file</span>(<span class="ruby-identifier">file</span>)
|
235
235
|
<span class="ruby-keyword kw">end</span>
|
236
|
-
|
236
|
+
<span class="ruby-identifier">create_tracking_dir</span>(<span class="ruby-identifier">filename</span>)
|
237
237
|
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator"><</span> <span class="ruby-value">300</span> )
|
238
238
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">get_ok_file_for</span>(<span class="ruby-identifier">filename</span>), <span class="ruby-value str">"w"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
239
239
|
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">print</span>( <span class="ruby-value str">"OK"</span> )
|
@@ -0,0 +1,152 @@
|
|
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::StatementHandler</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::StatementHandler</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/upload_rb.html">
|
59
|
+
lib/pho/upload.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
|
+
Default statement handler, does nothing
|
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="#M000004">handle</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if method_list -->
|
114
|
+
<div id="methods">
|
115
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
116
|
+
|
117
|
+
<div id="method-M000004" class="method-detail">
|
118
|
+
<a name="M000004"></a>
|
119
|
+
|
120
|
+
<div class="method-heading">
|
121
|
+
<a href="#M000004" class="method-signature">
|
122
|
+
<span class="method-name">handle</span><span class="method-args">(statement)</span>
|
123
|
+
</a>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div class="method-description">
|
127
|
+
<p><a class="source-toggle" href="#"
|
128
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000004-source">
|
130
|
+
<pre>
|
131
|
+
<span class="ruby-comment cmt"># File lib/pho/upload.rb, line 7</span>
|
132
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">statement</span>)
|
133
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">statement</span>
|
134
|
+
<span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
<div id="validator-badges">
|
148
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
</body>
|
152
|
+
</html>
|
@@ -0,0 +1,212 @@
|
|
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::Util</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::Util</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/upload_rb.html">
|
59
|
+
lib/pho/upload.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
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000003">prepare_and_store_upload</a>
|
90
|
+
<a href="#M000002">prepare_platform_upload</a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
<div id="methods">
|
110
|
+
<h3 class="section-bar">Public Class methods</h3>
|
111
|
+
|
112
|
+
<div id="method-M000003" class="method-detail">
|
113
|
+
<a name="M000003"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="#M000003" class="method-signature">
|
117
|
+
<span class="method-name">prepare_and_store_upload</span><span class="method-args">(store, src_dir, collection_dir, triples=FileSplitter::DEFAULT_CHUNK_SIZE)</span>
|
118
|
+
</a>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p>
|
123
|
+
Prepares a batch of files for uploading into the platform, then posts that
|
124
|
+
collection to the designated store
|
125
|
+
</p>
|
126
|
+
<p>
|
127
|
+
Returns an <a href="RDFManager.html">RDFManager</a> instance that can be
|
128
|
+
inspected to check for successes
|
129
|
+
</p>
|
130
|
+
<p><a class="source-toggle" href="#"
|
131
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
132
|
+
<div class="method-source-code" id="M000003-source">
|
133
|
+
<pre>
|
134
|
+
<span class="ruby-comment cmt"># File lib/pho/upload.rb, line 145</span>
|
135
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">prepare_and_store_upload</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">src_dir</span>, <span class="ruby-identifier">collection_dir</span>,
|
136
|
+
<span class="ruby-identifier">triples</span>=<span class="ruby-constant">FileSplitter</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_CHUNK_SIZE</span>)
|
137
|
+
|
138
|
+
<span class="ruby-identifier">prepare_platform_upload</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">src_dir</span>, <span class="ruby-identifier">collection_dir</span>)
|
139
|
+
<span class="ruby-identifier">collection</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">FileManagement</span><span class="ruby-operator">::</span><span class="ruby-constant">RDFManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">collection_dir</span>)
|
140
|
+
<span class="ruby-identifier">collection</span>.<span class="ruby-identifier">store</span>()
|
141
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">collection</span>
|
142
|
+
<span class="ruby-keyword kw">end</span>
|
143
|
+
</pre>
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div id="method-M000002" class="method-detail">
|
149
|
+
<a name="M000002"></a>
|
150
|
+
|
151
|
+
<div class="method-heading">
|
152
|
+
<a href="#M000002" class="method-signature">
|
153
|
+
<span class="method-name">prepare_platform_upload</span><span class="method-args">(store, src_dir, collection_dir, triples=FileSplitter::DEFAULT_CHUNK_SIZE)</span>
|
154
|
+
</a>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
<p>
|
159
|
+
Take a directory of files, copy them to temporary directory, splitting
|
160
|
+
where necessary, in preparation for uploading to a platform store.
|
161
|
+
</p>
|
162
|
+
<p>
|
163
|
+
Source directory is scanned for ntriple, turtle and RDF/XML files. All of
|
164
|
+
these are automatically chunked into 10,000 triple chunks and re-serialized
|
165
|
+
as ntriples
|
166
|
+
</p>
|
167
|
+
<p>
|
168
|
+
BNodes are automatically re-written to full uris.
|
169
|
+
</p>
|
170
|
+
<pre>
|
171
|
+
store:: Pho::Store into which data will be posted. Used to normalizing bnodes
|
172
|
+
src_dir:: directory containing source data.
|
173
|
+
</pre>
|
174
|
+
<p><a class="source-toggle" href="#"
|
175
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
176
|
+
<div class="method-source-code" id="M000002-source">
|
177
|
+
<pre>
|
178
|
+
<span class="ruby-comment cmt"># File lib/pho/upload.rb, line 124</span>
|
179
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">prepare_platform_upload</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">src_dir</span>, <span class="ruby-identifier">collection_dir</span>,
|
180
|
+
<span class="ruby-identifier">triples</span>=<span class="ruby-constant">FileSplitter</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_CHUNK_SIZE</span>)
|
181
|
+
|
182
|
+
<span class="ruby-identifier">handler</span> = <span class="ruby-constant">BNodeRewritingHandler</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">store</span>.<span class="ruby-identifier">build_uri</span>(<span class="ruby-value str">"/items"</span>) )
|
183
|
+
<span class="ruby-identifier">splitter</span> = <span class="ruby-constant">FileSplitter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">collection_dir</span>, <span class="ruby-identifier">triples</span>, <span class="ruby-identifier">handler</span> )
|
184
|
+
|
185
|
+
<span class="ruby-identifier">formats</span> = [ [<span class="ruby-value str">"*.rdf"</span>, <span class="ruby-identifier">:rdfxml</span>], [<span class="ruby-value str">"*.nt"</span>, <span class="ruby-identifier">:ntriples</span>], [<span class="ruby-value str">"*.ttl"</span>, <span class="ruby-identifier">:turtle</span>] ]
|
186
|
+
<span class="ruby-identifier">formats</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
|
187
|
+
|
188
|
+
<span class="ruby-identifier">files</span> = <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-identifier">src_dir</span>, <span class="ruby-identifier">format</span>[<span class="ruby-value">0</span>] ) )
|
189
|
+
<span class="ruby-identifier">splitter</span>.<span class="ruby-identifier">split_files</span>(<span class="ruby-identifier">files</span>, <span class="ruby-identifier">format</span>[<span class="ruby-value">1</span>] )
|
190
|
+
|
191
|
+
<span class="ruby-keyword kw">end</span>
|
192
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
193
|
+
|
194
|
+
<span class="ruby-keyword kw">end</span>
|
195
|
+
</pre>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
|
207
|
+
<div id="validator-badges">
|
208
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</body>
|
212
|
+
</html>
|