pho 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +9 -1
- data/Rakefile +1 -1
- data/doc/index.html +3 -1
- data/doc/rdoc/classes/Pho/Analyzers.html +310 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +770 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +241 -0
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +410 -0
- data/doc/rdoc/classes/Pho/Enrichment.html +119 -0
- data/doc/rdoc/classes/Pho/Etags.html +310 -0
- data/doc/rdoc/classes/Pho/Facet/Results.html +299 -0
- data/doc/rdoc/classes/Pho/Facet/Term.html +177 -0
- data/doc/rdoc/classes/Pho/Facet.html +119 -0
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +695 -0
- data/doc/rdoc/classes/Pho/FieldWeighting.html +230 -0
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +478 -0
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +264 -0
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +259 -0
- data/doc/rdoc/classes/Pho/FileManagement.html +121 -0
- data/doc/rdoc/classes/Pho/Job.html +627 -0
- data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
- data/doc/rdoc/classes/Pho/Jobs.html +538 -0
- data/doc/rdoc/classes/Pho/Namespaces.html +164 -0
- data/doc/rdoc/classes/Pho/OAI/Record.html +165 -0
- data/doc/rdoc/classes/Pho/OAI/Records.html +331 -0
- data/doc/rdoc/classes/Pho/OAI.html +118 -0
- data/doc/rdoc/classes/Pho/QueryProfile.html +524 -0
- data/doc/rdoc/classes/Pho/RDF/Parser.html +279 -0
- data/doc/rdoc/classes/Pho/RDF.html +120 -0
- data/doc/rdoc/classes/Pho/RDFCollection.html +119 -0
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +325 -0
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +241 -0
- data/doc/rdoc/classes/Pho/ResourceHash.html +123 -0
- data/doc/rdoc/classes/Pho/Snapshot.html +402 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +594 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +696 -0
- data/doc/rdoc/classes/Pho/Sparql.html +187 -0
- data/doc/rdoc/classes/Pho/Status.html +296 -0
- data/doc/rdoc/classes/Pho/Store.html +1569 -0
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
- data/doc/rdoc/classes/Pho/Update/Changeset.html +521 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +330 -0
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +159 -0
- data/doc/rdoc/classes/Pho/Update/Changesets.html +205 -0
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +257 -0
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +237 -0
- data/doc/rdoc/classes/Pho/Update/Statement.html +303 -0
- data/doc/rdoc/classes/Pho/Update.html +128 -0
- data/doc/rdoc/classes/Pho.html +283 -0
- data/doc/rdoc/classes/String.html +146 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGES.html +373 -0
- data/doc/rdoc/files/README.html +204 -0
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/changeset_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/converter_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/etags_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/facet_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_management_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/job_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/oai_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/rdf_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +109 -0
- data/doc/rdoc/files/lib/pho/sparql_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/status_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/store_rb.html +108 -0
- data/doc/rdoc/files/lib/pho_rb.html +133 -0
- data/doc/rdoc/fr_class_index.html +72 -0
- data/doc/rdoc/fr_file_index.html +49 -0
- data/doc/rdoc/fr_method_index.html +239 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/pho/enrichment.rb +1 -0
- data/lib/pho/field_predicate_map.rb +5 -0
- data/lib/pho/query_profile.rb +5 -0
- data/lib/pho/store.rb +4 -1
- data/tests/tc_field_predicate_map.rb +7 -1
- data/tests/tc_query_profile.rb +6 -0
- data/tests/tc_store_util.rb +7 -0
- metadata +134 -21
@@ -0,0 +1,330 @@
|
|
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::Update::ChangesetBuilder</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::Update::ChangesetBuilder</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/changeset_builder_rb.html">
|
59
|
+
lib/pho/changeset_builder.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
|
+
Utility class providing methods for building <a
|
84
|
+
href="Changesets.html">Changesets</a> from triple hashes
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="method-list">
|
93
|
+
<h3 class="section-bar">Methods</h3>
|
94
|
+
|
95
|
+
<div class="name-list">
|
96
|
+
<a href="#M000024">build</a>
|
97
|
+
<a href="#M000023">build_batch</a>
|
98
|
+
<a href="#M000025">create_statements</a>
|
99
|
+
<a href="#M000026">create_statements_for_uri</a>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if includes -->
|
107
|
+
|
108
|
+
<div id="section">
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<!-- if method_list -->
|
118
|
+
<div id="methods">
|
119
|
+
<h3 class="section-bar">Public Class methods</h3>
|
120
|
+
|
121
|
+
<div id="method-M000024" class="method-detail">
|
122
|
+
<a name="M000024"></a>
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<a href="#M000024" class="method-signature">
|
126
|
+
<span class="method-name">build</span><span class="method-args">(subject_of_change, before, after, creator_name=nil, change_reason=nil)</span>
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="method-description">
|
131
|
+
<p>
|
132
|
+
Build a single changeset
|
133
|
+
</p>
|
134
|
+
<p>
|
135
|
+
This method is suitable for building changesets that describe changes made
|
136
|
+
to a single resource If the before/after hashes contain data for other
|
137
|
+
subjects, then an error will be thrown.
|
138
|
+
</p>
|
139
|
+
<p>
|
140
|
+
The method will return a single <a href="Changeset.html">Changeset</a>
|
141
|
+
object.
|
142
|
+
</p>
|
143
|
+
<pre>
|
144
|
+
subject_of_change:: uri of the resource being updated
|
145
|
+
before:: resource hash describing current state of the resource
|
146
|
+
after:: resource hash describing updated state of the resource
|
147
|
+
creator_name:: name of the creator of the changes
|
148
|
+
change_reason:: description of why the changes are being made
|
149
|
+
</pre>
|
150
|
+
<p><a class="source-toggle" href="#"
|
151
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
152
|
+
<div class="method-source-code" id="M000024-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/pho/changeset_builder.rb, line 65</span>
|
155
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">ChangesetBuilder</span>.<span class="ruby-identifier">build</span>(<span class="ruby-identifier">subject_of_change</span>, <span class="ruby-identifier">before</span>, <span class="ruby-identifier">after</span>, <span class="ruby-identifier">creator_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">change_reason</span>=<span class="ruby-keyword kw">nil</span>)
|
156
|
+
<span class="ruby-identifier">removals</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceHash</span><span class="ruby-operator">::</span><span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">before</span>, <span class="ruby-identifier">after</span>)
|
157
|
+
<span class="ruby-identifier">additions</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceHash</span><span class="ruby-operator">::</span><span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">after</span>, <span class="ruby-identifier">before</span>)
|
158
|
+
|
159
|
+
<span class="ruby-identifier">cs</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Update</span><span class="ruby-operator">::</span><span class="ruby-constant">Changeset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">subject_of_change</span>, <span class="ruby-identifier">creator_name</span>, <span class="ruby-identifier">change_reason</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cs</span><span class="ruby-operator">|</span>
|
160
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_removals</span>( <span class="ruby-identifier">create_statements</span>(<span class="ruby-identifier">removals</span>) )
|
161
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_additions</span>( <span class="ruby-identifier">create_statements</span>(<span class="ruby-identifier">additions</span>) )
|
162
|
+
<span class="ruby-keyword kw">end</span>
|
163
|
+
|
164
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cs</span>
|
165
|
+
|
166
|
+
<span class="ruby-keyword kw">end</span>
|
167
|
+
</pre>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div id="method-M000023" class="method-detail">
|
173
|
+
<a name="M000023"></a>
|
174
|
+
|
175
|
+
<div class="method-heading">
|
176
|
+
<a href="#M000023" class="method-signature">
|
177
|
+
<span class="method-name">build_batch</span><span class="method-args">(before, after, creator_name=nil, change_reason=nil)</span>
|
178
|
+
</a>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="method-description">
|
182
|
+
<p>
|
183
|
+
Build a batch changeset
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
This method is suitable for building an array of changesets that describe
|
187
|
+
changes made to a number of different resources.
|
188
|
+
</p>
|
189
|
+
<p>
|
190
|
+
Returns an array of <a href="Changeset.html">Changeset</a> objects
|
191
|
+
</p>
|
192
|
+
<pre>
|
193
|
+
before:: resource hash describing current state of the resource
|
194
|
+
after:: resource hash describing updated state of the resource
|
195
|
+
creator_name:: name of the creator of the changes
|
196
|
+
change_reason:: description of why the changes are being made
|
197
|
+
</pre>
|
198
|
+
<p><a class="source-toggle" href="#"
|
199
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
200
|
+
<div class="method-source-code" id="M000023-source">
|
201
|
+
<pre>
|
202
|
+
<span class="ruby-comment cmt"># File lib/pho/changeset_builder.rb, line 22</span>
|
203
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">ChangesetBuilder</span>.<span class="ruby-identifier">build_batch</span>(<span class="ruby-identifier">before</span>, <span class="ruby-identifier">after</span>, <span class="ruby-identifier">creator_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">change_reason</span>=<span class="ruby-keyword kw">nil</span>)
|
204
|
+
|
205
|
+
<span class="ruby-identifier">removals</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceHash</span><span class="ruby-operator">::</span><span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">before</span>, <span class="ruby-identifier">after</span>)
|
206
|
+
<span class="ruby-identifier">additions</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceHash</span><span class="ruby-operator">::</span><span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">after</span>, <span class="ruby-identifier">before</span>)
|
207
|
+
|
208
|
+
<span class="ruby-identifier">batch</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
209
|
+
|
210
|
+
<span class="ruby-identifier">removals</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span><span class="ruby-operator">|</span>
|
211
|
+
<span class="ruby-identifier">cs</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Update</span><span class="ruby-operator">::</span><span class="ruby-constant">Changeset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">creator_name</span>, <span class="ruby-identifier">change_reason</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cs</span><span class="ruby-operator">|</span>
|
212
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_removals</span>( <span class="ruby-identifier">create_statements_for_uri</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span>) )
|
213
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">additions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">uri</span>)
|
214
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_additions</span>( <span class="ruby-identifier">create_statements_for_uri</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">additions</span>[<span class="ruby-identifier">uri</span>] ) )
|
215
|
+
<span class="ruby-identifier">additions</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">uri</span>)
|
216
|
+
<span class="ruby-keyword kw">end</span>
|
217
|
+
<span class="ruby-keyword kw">end</span>
|
218
|
+
<span class="ruby-identifier">batch</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">cs</span>
|
219
|
+
<span class="ruby-keyword kw">end</span>
|
220
|
+
|
221
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">additions</span>.<span class="ruby-identifier">empty?</span>
|
222
|
+
<span class="ruby-identifier">additions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span><span class="ruby-operator">|</span>
|
223
|
+
<span class="ruby-identifier">cs</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Update</span><span class="ruby-operator">::</span><span class="ruby-constant">Changeset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">creator_name</span>, <span class="ruby-identifier">change_reason</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cs</span><span class="ruby-operator">|</span>
|
224
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_additions</span>( <span class="ruby-identifier">create_statements_for_uri</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span>) )
|
225
|
+
<span class="ruby-keyword kw">end</span>
|
226
|
+
<span class="ruby-identifier">batch</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">cs</span>
|
227
|
+
<span class="ruby-keyword kw">end</span>
|
228
|
+
<span class="ruby-keyword kw">end</span>
|
229
|
+
|
230
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">batch</span>
|
231
|
+
|
232
|
+
<span class="ruby-keyword kw">end</span>
|
233
|
+
</pre>
|
234
|
+
</div>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
<div id="method-M000025" class="method-detail">
|
239
|
+
<a name="M000025"></a>
|
240
|
+
|
241
|
+
<div class="method-heading">
|
242
|
+
<a href="#M000025" class="method-signature">
|
243
|
+
<span class="method-name">create_statements</span><span class="method-args">(triples)</span>
|
244
|
+
</a>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div class="method-description">
|
248
|
+
<p>
|
249
|
+
Takes a resource hash and serializes it as an array of <a
|
250
|
+
href="Statement.html">Pho::Update::Statement</a> objects
|
251
|
+
</p>
|
252
|
+
<pre>
|
253
|
+
triples:: a resource hash, conforming to RDF-in-JSON structure
|
254
|
+
</pre>
|
255
|
+
<p><a class="source-toggle" href="#"
|
256
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000025-source">
|
258
|
+
<pre>
|
259
|
+
<span class="ruby-comment cmt"># File lib/pho/changeset_builder.rb, line 81</span>
|
260
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">ChangesetBuilder</span>.<span class="ruby-identifier">create_statements</span>(<span class="ruby-identifier">triples</span>)
|
261
|
+
<span class="ruby-identifier">statements</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
262
|
+
<span class="ruby-identifier">triples</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span><span class="ruby-operator">|</span>
|
263
|
+
<span class="ruby-identifier">statements</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">create_statements_for_uri</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span>)
|
264
|
+
<span class="ruby-keyword kw">end</span>
|
265
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">statements</span>
|
266
|
+
<span class="ruby-keyword kw">end</span>
|
267
|
+
</pre>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div id="method-M000026" class="method-detail">
|
273
|
+
<a name="M000026"></a>
|
274
|
+
|
275
|
+
<div class="method-heading">
|
276
|
+
<a href="#M000026" class="method-signature">
|
277
|
+
<span class="method-name">create_statements_for_uri</span><span class="method-args">(uri, properties)</span>
|
278
|
+
</a>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
<div class="method-description">
|
282
|
+
<p>
|
283
|
+
Create statements for a specific uri, using predicate-object values in the
|
284
|
+
provided properties hash
|
285
|
+
</p>
|
286
|
+
<pre>
|
287
|
+
uri:: subject of change
|
288
|
+
properties:: hash of predicate-object values
|
289
|
+
</pre>
|
290
|
+
<p><a class="source-toggle" href="#"
|
291
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000026-source">
|
293
|
+
<pre>
|
294
|
+
<span class="ruby-comment cmt"># File lib/pho/changeset_builder.rb, line 94</span>
|
295
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">ChangesetBuilder</span>.<span class="ruby-identifier">create_statements_for_uri</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">properties</span>)
|
296
|
+
<span class="ruby-identifier">statements</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
297
|
+
<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">val_array</span><span class="ruby-operator">|</span>
|
298
|
+
<span class="ruby-identifier">val_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
299
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">nil</span>
|
300
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"literal"</span>
|
301
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Update</span><span class="ruby-operator">::</span><span class="ruby-constant">Statement</span>.<span class="ruby-identifier">create_literal</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">value</span>[<span class="ruby-value str">"value"</span>], <span class="ruby-identifier">value</span>[<span class="ruby-value str">"lang"</span>], <span class="ruby-identifier">value</span>[<span class="ruby-value str">"datatype"</span>])
|
302
|
+
<span class="ruby-keyword kw">else</span>
|
303
|
+
<span class="ruby-comment cmt">#TODO bnodes?</span>
|
304
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-constant">Pho</span><span class="ruby-operator">::</span><span class="ruby-constant">Update</span><span class="ruby-operator">::</span><span class="ruby-constant">Statement</span>.<span class="ruby-identifier">create_resource</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">value</span>[<span class="ruby-value str">"value"</span>])
|
305
|
+
<span class="ruby-keyword kw">end</span>
|
306
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
307
|
+
<span class="ruby-identifier">statements</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span>
|
308
|
+
<span class="ruby-keyword kw">end</span>
|
309
|
+
<span class="ruby-keyword kw">end</span>
|
310
|
+
<span class="ruby-keyword kw">end</span>
|
311
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">statements</span>
|
312
|
+
<span class="ruby-keyword kw">end</span>
|
313
|
+
</pre>
|
314
|
+
</div>
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
<div id="validator-badges">
|
326
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
</body>
|
330
|
+
</html>
|
@@ -0,0 +1,159 @@
|
|
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::Update::ChangesetHelper</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::Update::ChangesetHelper</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/changeset_rb.html">
|
59
|
+
lib/pho/changeset.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
|
+
Utility methods for making changes to graphs via <a
|
84
|
+
href="Changesets.html">Changesets</a>
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="method-list">
|
93
|
+
<h3 class="section-bar">Methods</h3>
|
94
|
+
|
95
|
+
<div class="name-list">
|
96
|
+
<a href="#M000019">update_literal</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
|
105
|
+
<div id="section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if method_list -->
|
115
|
+
<div id="methods">
|
116
|
+
<h3 class="section-bar">Public Class methods</h3>
|
117
|
+
|
118
|
+
<div id="method-M000019" class="method-detail">
|
119
|
+
<a name="M000019"></a>
|
120
|
+
|
121
|
+
<div class="method-heading">
|
122
|
+
<a href="#M000019" class="method-signature">
|
123
|
+
<span class="method-name">update_literal</span><span class="method-args">(store, subject, predicate, old_value, new_value, old_lang=nil, old_datatype=nil, new_lang=nil, new_datatype=nil, creator_name=nil, change_reason=nil, versioned=false)</span>
|
124
|
+
</a>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
<p><a class="source-toggle" href="#"
|
129
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
130
|
+
<div class="method-source-code" id="M000019-source">
|
131
|
+
<pre>
|
132
|
+
<span class="ruby-comment cmt"># File lib/pho/changeset.rb, line 328</span>
|
133
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">ChangesetHelper</span>.<span class="ruby-identifier">update_literal</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">old_value</span>, <span class="ruby-identifier">new_value</span>, <span class="ruby-identifier">old_lang</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">old_datatype</span>=<span class="ruby-keyword kw">nil</span>,
|
134
|
+
<span class="ruby-identifier">new_lang</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">new_datatype</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">creator_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">change_reason</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">versioned</span>=<span class="ruby-keyword kw">false</span>)
|
135
|
+
<span class="ruby-identifier">cs</span> = <span class="ruby-constant">Changeset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">creator_name</span>, <span class="ruby-identifier">change_reason</span>)
|
136
|
+
<span class="ruby-identifier">old</span> = <span class="ruby-constant">Statement</span>.<span class="ruby-identifier">create_literal</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">old_value</span>, <span class="ruby-identifier">old_lang</span>, <span class="ruby-identifier">old_datatype</span>)
|
137
|
+
<span class="ruby-identifier">new</span> = <span class="ruby-constant">Statement</span>.<span class="ruby-identifier">create_literal</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">new_value</span>, <span class="ruby-identifier">new_lang</span>, <span class="ruby-identifier">new_datatype</span>)
|
138
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_removal</span>(<span class="ruby-identifier">old</span>)
|
139
|
+
<span class="ruby-identifier">cs</span>.<span class="ruby-identifier">add_addition</span>(<span class="ruby-identifier">new</span>)
|
140
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cs</span>.<span class="ruby-identifier">submit</span>(<span class="ruby-identifier">store</span>, <span class="ruby-identifier">versioned</span>)
|
141
|
+
<span class="ruby-keyword kw">end</span>
|
142
|
+
</pre>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<div id="validator-badges">
|
155
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</body>
|
159
|
+
</html>
|