pho 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/Rakefile +1 -1
- data/lib/pho/snapshot.rb +6 -1
- data/lib/pho/sparql.rb +4 -1
- data/tests/tc_snapshots.rb +14 -1
- data/tests/tc_sparql_helper.rb +23 -0
- metadata +60 -160
- data/doc/rdoc/classes/Pho/Analyzers.html +0 -310
- data/doc/rdoc/classes/Pho/CommandLine.html +0 -770
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +0 -241
- data/doc/rdoc/classes/Pho/Enrichment/StoreEnricher.html +0 -410
- data/doc/rdoc/classes/Pho/Enrichment.html +0 -119
- data/doc/rdoc/classes/Pho/Etags.html +0 -310
- data/doc/rdoc/classes/Pho/Facet/Results.html +0 -299
- data/doc/rdoc/classes/Pho/Facet/Term.html +0 -177
- data/doc/rdoc/classes/Pho/Facet.html +0 -119
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +0 -668
- data/doc/rdoc/classes/Pho/FieldWeighting.html +0 -230
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +0 -478
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +0 -264
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +0 -259
- data/doc/rdoc/classes/Pho/FileManagement.html +0 -121
- data/doc/rdoc/classes/Pho/Job.html +0 -627
- data/doc/rdoc/classes/Pho/JobUpdate.html +0 -141
- data/doc/rdoc/classes/Pho/Jobs.html +0 -538
- data/doc/rdoc/classes/Pho/Namespaces.html +0 -164
- data/doc/rdoc/classes/Pho/OAI/Record.html +0 -165
- data/doc/rdoc/classes/Pho/OAI/Records.html +0 -331
- data/doc/rdoc/classes/Pho/OAI.html +0 -118
- data/doc/rdoc/classes/Pho/QueryProfile.html +0 -497
- data/doc/rdoc/classes/Pho/RDF/Parser.html +0 -279
- data/doc/rdoc/classes/Pho/RDF.html +0 -120
- data/doc/rdoc/classes/Pho/RDFCollection.html +0 -119
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +0 -325
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +0 -241
- data/doc/rdoc/classes/Pho/ResourceHash.html +0 -123
- data/doc/rdoc/classes/Pho/Snapshot.html +0 -397
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +0 -594
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +0 -692
- data/doc/rdoc/classes/Pho/Sparql.html +0 -187
- data/doc/rdoc/classes/Pho/Status.html +0 -296
- data/doc/rdoc/classes/Pho/Store.html +0 -1560
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +0 -183
- data/doc/rdoc/classes/Pho/Update/Changeset.html +0 -521
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +0 -330
- data/doc/rdoc/classes/Pho/Update/ChangesetHelper.html +0 -159
- data/doc/rdoc/classes/Pho/Update/Changesets.html +0 -205
- data/doc/rdoc/classes/Pho/Update/LiteralStatement.html +0 -257
- data/doc/rdoc/classes/Pho/Update/ResourceStatement.html +0 -237
- data/doc/rdoc/classes/Pho/Update/Statement.html +0 -303
- data/doc/rdoc/classes/Pho/Update.html +0 -128
- data/doc/rdoc/classes/Pho.html +0 -283
- data/doc/rdoc/classes/String.html +0 -146
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -351
- data/doc/rdoc/files/README.html +0 -191
- data/doc/rdoc/files/lib/pho/changeset_builder_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/changeset_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/command_line_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/converter_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/etags_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/facet_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_management_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/file_manager_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/job_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/oai_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/query_profile_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_collection_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/rdf_rb.html +0 -108
- data/doc/rdoc/files/lib/pho/resource_hash_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +0 -109
- data/doc/rdoc/files/lib/pho/sparql_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/status_rb.html +0 -101
- data/doc/rdoc/files/lib/pho/store_rb.html +0 -108
- data/doc/rdoc/files/lib/pho_rb.html +0 -133
- data/doc/rdoc/fr_class_index.html +0 -72
- data/doc/rdoc/fr_file_index.html +0 -49
- data/doc/rdoc/fr_method_index.html +0 -237
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,325 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Pho::ResourceHash::Converter</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::ResourceHash::Converter</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/pho/converter_rb.html">
|
59
|
-
lib/pho/converter.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
|
-
Class for converting to and from resource hashes
|
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="#M000086">parse</a>
|
96
|
-
<a href="#M000082">parse_json</a>
|
97
|
-
<a href="#M000084">parse_ntriples</a>
|
98
|
-
<a href="#M000083">parse_rdfxml</a>
|
99
|
-
<a href="#M000085">parse_turtle</a>
|
100
|
-
<a href="#M000087">serialize_json</a>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
<!-- if includes -->
|
108
|
-
|
109
|
-
<div id="section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if method_list -->
|
119
|
-
<div id="methods">
|
120
|
-
<h3 class="section-bar">Public Class methods</h3>
|
121
|
-
|
122
|
-
<div id="method-M000086" class="method-detail">
|
123
|
-
<a name="M000086"></a>
|
124
|
-
|
125
|
-
<div class="method-heading">
|
126
|
-
<a href="#M000086" class="method-signature">
|
127
|
-
<span class="method-name">parse</span><span class="method-args">(data, base_uri, format="rdfxml")</span>
|
128
|
-
</a>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
<div class="method-description">
|
132
|
-
<p>
|
133
|
-
Convert specified format into a <a
|
134
|
-
href="../ResourceHash.html">ResourceHash</a>
|
135
|
-
</p>
|
136
|
-
<pre>
|
137
|
-
format:: one of rdfxml, ntriples, turtle
|
138
|
-
data:: String containing the data to be parsed
|
139
|
-
base_uri:: base uri of the data
|
140
|
-
</pre>
|
141
|
-
<p><a class="source-toggle" href="#"
|
142
|
-
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
|
143
|
-
<div class="method-source-code" id="M000086-source">
|
144
|
-
<pre>
|
145
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 53</span>
|
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">"rdfxml"</span>)
|
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
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">format</span>
|
149
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"rdfxml"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">mime</span>=<span class="ruby-value str">"application/rdf+xml"</span>
|
150
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"json"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">mime</span>=<span class="ruby-value str">"application/json"</span>
|
151
|
-
<span class="ruby-keyword kw">else</span> <span class="ruby-identifier">mime</span>=<span class="ruby-value str">""</span>
|
152
|
-
<span class="ruby-keyword kw">end</span>
|
153
|
-
|
154
|
-
<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-identifier">format</span>, <span class="ruby-identifier">mime</span>)
|
155
|
-
<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">data</span>, <span class="ruby-identifier">base_uri</span>)
|
156
|
-
<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">"json"</span>, <span class="ruby-value str">"application/json"</span> )
|
157
|
-
<span class="ruby-identifier">json</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>)
|
158
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_json</span>( <span class="ruby-identifier">json</span> )
|
159
|
-
<span class="ruby-keyword kw">end</span>
|
160
|
-
</pre>
|
161
|
-
</div>
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
<div id="method-M000082" class="method-detail">
|
166
|
-
<a name="M000082"></a>
|
167
|
-
|
168
|
-
<div class="method-heading">
|
169
|
-
<a href="#M000082" class="method-signature">
|
170
|
-
<span class="method-name">parse_json</span><span class="method-args">(json)</span>
|
171
|
-
</a>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div class="method-description">
|
175
|
-
<p>
|
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.
|
179
|
-
</p>
|
180
|
-
<pre>
|
181
|
-
json:: valid RDF-in-JSON
|
182
|
-
</pre>
|
183
|
-
<p><a class="source-toggle" href="#"
|
184
|
-
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
185
|
-
<div class="method-source-code" id="M000082-source">
|
186
|
-
<pre>
|
187
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 23</span>
|
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>)
|
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>)
|
190
|
-
<span class="ruby-keyword kw">end</span>
|
191
|
-
</pre>
|
192
|
-
</div>
|
193
|
-
</div>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
<div id="method-M000084" class="method-detail">
|
197
|
-
<a name="M000084"></a>
|
198
|
-
|
199
|
-
<div class="method-heading">
|
200
|
-
<a href="#M000084" class="method-signature">
|
201
|
-
<span class="method-name">parse_ntriples</span><span class="method-args">(ntriples, base_uri)</span>
|
202
|
-
</a>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
<div class="method-description">
|
206
|
-
<p>
|
207
|
-
Parse a string containing N-Triples into a resource hash
|
208
|
-
</p>
|
209
|
-
<pre>
|
210
|
-
ntriples:: a String containing N-Triples
|
211
|
-
</pre>
|
212
|
-
<p><a class="source-toggle" href="#"
|
213
|
-
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
|
214
|
-
<div class="method-source-code" id="M000084-source">
|
215
|
-
<pre>
|
216
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 37</span>
|
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>)
|
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">"ntriples"</span>)
|
219
|
-
<span class="ruby-keyword kw">end</span>
|
220
|
-
</pre>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
</div>
|
224
|
-
|
225
|
-
<div id="method-M000083" class="method-detail">
|
226
|
-
<a name="M000083"></a>
|
227
|
-
|
228
|
-
<div class="method-heading">
|
229
|
-
<a href="#M000083" class="method-signature">
|
230
|
-
<span class="method-name">parse_rdfxml</span><span class="method-args">(rdfxml, base_uri)</span>
|
231
|
-
</a>
|
232
|
-
</div>
|
233
|
-
|
234
|
-
<div class="method-description">
|
235
|
-
<p>
|
236
|
-
Parse a string containing <a href="../RDF.html">RDF</a>/XML into a resource
|
237
|
-
hash
|
238
|
-
</p>
|
239
|
-
<pre>
|
240
|
-
rdfxml: a String containing RDF/XML
|
241
|
-
</pre>
|
242
|
-
<p><a class="source-toggle" href="#"
|
243
|
-
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
|
244
|
-
<div class="method-source-code" id="M000083-source">
|
245
|
-
<pre>
|
246
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 30</span>
|
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>)
|
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">"rdfxml"</span>)
|
249
|
-
<span class="ruby-keyword kw">end</span>
|
250
|
-
</pre>
|
251
|
-
</div>
|
252
|
-
</div>
|
253
|
-
</div>
|
254
|
-
|
255
|
-
<div id="method-M000085" class="method-detail">
|
256
|
-
<a name="M000085"></a>
|
257
|
-
|
258
|
-
<div class="method-heading">
|
259
|
-
<a href="#M000085" class="method-signature">
|
260
|
-
<span class="method-name">parse_turtle</span><span class="method-args">(turtle, base_uri)</span>
|
261
|
-
</a>
|
262
|
-
</div>
|
263
|
-
|
264
|
-
<div class="method-description">
|
265
|
-
<p>
|
266
|
-
Parse a string containing Turtle into a resource hash
|
267
|
-
</p>
|
268
|
-
<pre>
|
269
|
-
ntriples:: a String containing Turtle
|
270
|
-
</pre>
|
271
|
-
<p><a class="source-toggle" href="#"
|
272
|
-
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
|
273
|
-
<div class="method-source-code" id="M000085-source">
|
274
|
-
<pre>
|
275
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 44</span>
|
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>)
|
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">"turtle"</span>)
|
278
|
-
<span class="ruby-keyword kw">end</span>
|
279
|
-
</pre>
|
280
|
-
</div>
|
281
|
-
</div>
|
282
|
-
</div>
|
283
|
-
|
284
|
-
<div id="method-M000087" class="method-detail">
|
285
|
-
<a name="M000087"></a>
|
286
|
-
|
287
|
-
<div class="method-heading">
|
288
|
-
<a href="#M000087" class="method-signature">
|
289
|
-
<span class="method-name">serialize_json</span><span class="method-args">(hash)</span>
|
290
|
-
</a>
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div class="method-description">
|
294
|
-
<p>
|
295
|
-
Serialize a resource hash as <a href="../RDF.html">RDF</a>-in-JSON
|
296
|
-
</p>
|
297
|
-
<pre>
|
298
|
-
hash:: the resource hash to serialize
|
299
|
-
</pre>
|
300
|
-
<p><a class="source-toggle" href="#"
|
301
|
-
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
|
302
|
-
<div class="method-source-code" id="M000087-source">
|
303
|
-
<pre>
|
304
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 71</span>
|
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>)
|
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>)
|
307
|
-
<span class="ruby-keyword kw">end</span>
|
308
|
-
</pre>
|
309
|
-
</div>
|
310
|
-
</div>
|
311
|
-
</div>
|
312
|
-
|
313
|
-
|
314
|
-
</div>
|
315
|
-
|
316
|
-
|
317
|
-
</div>
|
318
|
-
|
319
|
-
|
320
|
-
<div id="validator-badges">
|
321
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
322
|
-
</div>
|
323
|
-
|
324
|
-
</body>
|
325
|
-
</html>
|
@@ -1,241 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Pho::ResourceHash::SetAlgebra</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::ResourceHash::SetAlgebra</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/pho/resource_hash_rb.html">
|
59
|
-
lib/pho/resource_hash.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
|
-
Class providing set algebra methods over triple hashes
|
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="#M000088">minus</a>
|
96
|
-
<a href="#M000089">object_in_array?</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-M000088" class="method-detail">
|
119
|
-
<a name="M000088"></a>
|
120
|
-
|
121
|
-
<div class="method-heading">
|
122
|
-
<a href="#M000088" class="method-signature">
|
123
|
-
<span class="method-name">minus</span><span class="method-args">(first, second)</span>
|
124
|
-
</a>
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div class="method-description">
|
128
|
-
<p>
|
129
|
-
Accepts two triple hashes, expressed as <a
|
130
|
-
href="../RDF.html">RDF</a>-in-JSON and returns a new Ruby data structure
|
131
|
-
that constitutes the different between the two graphs
|
132
|
-
</p>
|
133
|
-
<p>
|
134
|
-
i.e. the return value will be a hash containing the triples that are in the
|
135
|
-
first graph but which are not present in the second.
|
136
|
-
</p>
|
137
|
-
<pre>
|
138
|
-
first:: the first graph
|
139
|
-
second:: the second graph.
|
140
|
-
</pre>
|
141
|
-
<p><a class="source-toggle" href="#"
|
142
|
-
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
|
143
|
-
<div class="method-source-code" id="M000088-source">
|
144
|
-
<pre>
|
145
|
-
<span class="ruby-comment cmt"># File lib/pho/resource_hash.rb, line 20</span>
|
146
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">minus</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">second</span>)
|
147
|
-
|
148
|
-
<span class="ruby-identifier">difference</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
149
|
-
<span class="ruby-identifier">first</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>
|
150
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">uri</span>)
|
151
|
-
<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">value</span><span class="ruby-operator">|</span>
|
152
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span>[<span class="ruby-identifier">uri</span>].<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">predicate</span>)
|
153
|
-
<span class="ruby-comment cmt">#second hash has same uri and predicate, so check value arrays </span>
|
154
|
-
<span class="ruby-identifier">second_value</span> = <span class="ruby-identifier">second</span>[<span class="ruby-identifier">uri</span>][<span class="ruby-identifier">predicate</span>]
|
155
|
-
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
156
|
-
|
157
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">object_in_array?</span>(<span class="ruby-identifier">second_value</span>, <span class="ruby-identifier">val</span>)
|
158
|
-
|
159
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
160
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>][<span class="ruby-identifier">predicate</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
161
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>][<span class="ruby-identifier">predicate</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">val</span>
|
162
|
-
<span class="ruby-keyword kw">end</span>
|
163
|
-
<span class="ruby-keyword kw">end</span>
|
164
|
-
|
165
|
-
<span class="ruby-keyword kw">else</span>
|
166
|
-
<span class="ruby-comment cmt">#uri is in second, but not this property and value</span>
|
167
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
168
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>][<span class="ruby-identifier">predicate</span>] = <span class="ruby-identifier">value</span>
|
169
|
-
<span class="ruby-keyword kw">end</span>
|
170
|
-
<span class="ruby-keyword kw">end</span>
|
171
|
-
<span class="ruby-keyword kw">else</span>
|
172
|
-
<span class="ruby-comment cmt">#uri not in second, so pass all straight-through</span>
|
173
|
-
<span class="ruby-identifier">difference</span>[<span class="ruby-identifier">uri</span>] = <span class="ruby-identifier">properties</span>
|
174
|
-
<span class="ruby-keyword kw">end</span>
|
175
|
-
|
176
|
-
<span class="ruby-keyword kw">end</span>
|
177
|
-
|
178
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">difference</span>
|
179
|
-
|
180
|
-
<span class="ruby-keyword kw">end</span>
|
181
|
-
</pre>
|
182
|
-
</div>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div id="method-M000089" class="method-detail">
|
187
|
-
<a name="M000089"></a>
|
188
|
-
|
189
|
-
<div class="method-heading">
|
190
|
-
<a href="#M000089" class="method-signature">
|
191
|
-
<span class="method-name">object_in_array?</span><span class="method-args">(array, val)</span>
|
192
|
-
</a>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
<div class="method-description">
|
196
|
-
<p>
|
197
|
-
Is there an object in the specified array, that matches the provided
|
198
|
-
description
|
199
|
-
</p>
|
200
|
-
<p><a class="source-toggle" href="#"
|
201
|
-
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
|
202
|
-
<div class="method-source-code" id="M000089-source">
|
203
|
-
<pre>
|
204
|
-
<span class="ruby-comment cmt"># File lib/pho/resource_hash.rb, line 57</span>
|
205
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">SetAlgebra</span>.<span class="ruby-identifier">object_in_array?</span>(<span class="ruby-identifier">array</span>, <span class="ruby-identifier">val</span>)
|
206
|
-
<span class="ruby-identifier">array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span>
|
207
|
-
|
208
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">val</span>[<span class="ruby-value str">"type"</span>]
|
209
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value str">"value"</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">val</span>[<span class="ruby-value str">"value"</span>]
|
210
|
-
|
211
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value str">"type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"literal"</span>
|
212
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value str">"datatype"</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">val</span>[<span class="ruby-value str">"datatype"</span>] <span class="ruby-operator">&&</span>
|
213
|
-
<span class="ruby-identifier">entry</span>[<span class="ruby-value str">"lang"</span>] = <span class="ruby-identifier">val</span>[<span class="ruby-value str">"lang"</span>]
|
214
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
215
|
-
<span class="ruby-keyword kw">end</span>
|
216
|
-
<span class="ruby-keyword kw">end</span>
|
217
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
218
|
-
<span class="ruby-keyword kw">end</span>
|
219
|
-
|
220
|
-
<span class="ruby-keyword kw">end</span>
|
221
|
-
<span class="ruby-keyword kw">end</span>
|
222
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
223
|
-
<span class="ruby-keyword kw">end</span>
|
224
|
-
</pre>
|
225
|
-
</div>
|
226
|
-
</div>
|
227
|
-
</div>
|
228
|
-
|
229
|
-
|
230
|
-
</div>
|
231
|
-
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
|
236
|
-
<div id="validator-badges">
|
237
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
238
|
-
</div>
|
239
|
-
|
240
|
-
</body>
|
241
|
-
</html>
|