pho 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +17 -0
- data/Rakefile +10 -2
- data/bin/talis_store +37 -92
- data/doc/rdoc/classes/Pho.html +11 -0
- data/doc/rdoc/classes/Pho/CommandLine.html +508 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +15 -15
- data/doc/rdoc/classes/Pho/Enrichment.html +1 -1
- data/doc/rdoc/classes/Pho/Enrichment/{ResourceEnricher.html → StoreEnricher.html} +158 -58
- 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 +94 -94
- data/doc/rdoc/classes/Pho/FieldWeighting.html +14 -14
- data/doc/rdoc/classes/Pho/FileManagement/AbstractFileManager.html +126 -91
- data/doc/rdoc/classes/Pho/FileManagement/FileManager.html +68 -62
- data/doc/rdoc/classes/Pho/FileManagement/RDFManager.html +22 -57
- data/doc/rdoc/classes/Pho/Job.html +68 -67
- data/doc/rdoc/classes/Pho/Jobs.html +62 -62
- data/doc/rdoc/classes/Pho/QueryProfile.html +64 -64
- data/doc/rdoc/classes/Pho/RDF.html +120 -0
- data/doc/rdoc/classes/Pho/RDF/Parser.html +277 -0
- data/doc/rdoc/classes/Pho/ResourceHash.html +1 -1
- data/doc/rdoc/classes/Pho/ResourceHash/Converter.html +48 -46
- data/doc/rdoc/classes/Pho/ResourceHash/SetAlgebra.html +15 -14
- data/doc/rdoc/classes/Pho/Snapshot.html +36 -36
- data/doc/rdoc/classes/Pho/Sparql.html +50 -0
- data/doc/rdoc/classes/Pho/Sparql/SparqlClient.html +147 -68
- data/doc/rdoc/classes/Pho/Sparql/SparqlHelper.html +195 -114
- data/doc/rdoc/classes/Pho/Status.html +26 -26
- data/doc/rdoc/classes/Pho/Store.html +271 -264
- data/doc/rdoc/classes/Pho/StoreSparqlClient.html +183 -0
- data/doc/rdoc/classes/Pho/Update.html +1 -0
- data/doc/rdoc/classes/Pho/Update/Changeset.html +69 -68
- data/doc/rdoc/classes/Pho/Update/ChangesetBuilder.html +24 -24
- data/doc/rdoc/classes/Pho/Update/Changesets.html +15 -14
- 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 +28 -27
- data/doc/rdoc/classes/String.html +1 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +53 -1
- data/doc/rdoc/files/lib/pho/changeset_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/command_line_rb.html +101 -0
- data/doc/rdoc/files/lib/pho/converter_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/enrichment_rb.html +1 -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/rdf_rb.html +108 -0
- data/doc/rdoc/files/lib/pho/sparql_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/store_rb.html +8 -1
- data/doc/rdoc/files/lib/pho_rb.html +4 -2
- data/doc/rdoc/fr_class_index.html +6 -1
- data/doc/rdoc/fr_file_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +192 -172
- data/examples/calais/bio.txt +7 -0
- data/examples/calais/dump.rb +17 -0
- data/examples/calais/enlighten.rb +23 -0
- data/examples/calais/output.rdf +25 -0
- data/examples/sinatra/viewer.rb +20 -0
- data/lib/pho.rb +4 -1
- data/lib/pho/changeset.rb +17 -1
- data/lib/pho/command_line.rb +166 -0
- data/lib/pho/converter.rb +8 -3
- data/lib/pho/enrichment.rb +93 -28
- data/lib/pho/file_management.rb +32 -19
- data/lib/pho/file_manager.rb +22 -26
- data/lib/pho/rdf.rb +74 -0
- data/lib/pho/rdf_collection.rb +2 -17
- data/lib/pho/sparql.rb +150 -38
- data/lib/pho/store.rb +28 -2
- data/tests/tc_contentbox.rb +41 -0
- data/tests/tc_enrichment.rb +41 -4
- data/tests/tc_file_manager.rb +97 -7
- data/tests/tc_rdf_collection.rb +25 -13
- data/tests/tc_rdf_parser.rb +37 -0
- data/tests/tc_sparql.rb +72 -2
- data/tests/tc_sparql_helper.rb +16 -0
- data/tests/ts_pho.rb +2 -1
- metadata +20 -3
@@ -0,0 +1,120 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Pho::RDF</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Pho::RDF</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/pho/rdf_rb.html">
|
59
|
+
lib/pho/rdf.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
Module containing general <a href="RDF.html">RDF</a> utilities and classes
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
Dependent on the redland ruby bindings
|
81
|
+
</p>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
<div id="class-list">
|
97
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
98
|
+
|
99
|
+
Class <a href="RDF/Parser.html" class="link">Pho::RDF::Parser</a><br />
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
<div id="validator-badges">
|
116
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</body>
|
120
|
+
</html>
|
@@ -0,0 +1,277 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Pho::RDF::Parser</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Pho::RDF::Parser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/pho/rdf_rb.html">
|
59
|
+
lib/pho/rdf.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
General <a href="../RDF.html">RDF</a> parsing utilities.
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
Currently a convenience wrapper around the Redland Ruby bindings
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000084">parse_ntriples</a>
|
99
|
+
<a href="#M000085">parse_ntriples_from_string</a>
|
100
|
+
<a href="#M000086">store_ntriples</a>
|
101
|
+
<a href="#M000087">store_ntriples_from_string</a>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if includes -->
|
109
|
+
|
110
|
+
<div id="section">
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!-- if method_list -->
|
120
|
+
<div id="methods">
|
121
|
+
<h3 class="section-bar">Public Class methods</h3>
|
122
|
+
|
123
|
+
<div id="method-M000084" class="method-detail">
|
124
|
+
<a name="M000084"></a>
|
125
|
+
|
126
|
+
<div class="method-heading">
|
127
|
+
<a href="#M000084" class="method-signature">
|
128
|
+
<span class="method-name">parse_ntriples</span><span class="method-args">(file, base_uri=nil)</span>
|
129
|
+
</a>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="method-description">
|
133
|
+
<p>
|
134
|
+
Parse a file containing ntriples into <a href="../RDF.html">RDF</a>/XML.
|
135
|
+
Returns a string
|
136
|
+
</p>
|
137
|
+
<pre>
|
138
|
+
file:: File object
|
139
|
+
base_uri:: optional base uri to be used when parsing. If not set, then uris are resolved
|
140
|
+
relative to the File
|
141
|
+
</pre>
|
142
|
+
<p><a class="source-toggle" href="#"
|
143
|
+
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
|
144
|
+
<div class="method-source-code" id="M000084-source">
|
145
|
+
<pre>
|
146
|
+
<span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 24</span>
|
147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword kw">nil</span>)
|
148
|
+
<span class="ruby-identifier">model</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span>()
|
149
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"ntriples"</span>, <span class="ruby-value str">""</span>)
|
150
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-node">"file:#{file.path}"</span>
|
151
|
+
<span class="ruby-identifier">base_uri</span> = <span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">base_uri</span>
|
152
|
+
<span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse_into_model</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">base_uri</span>)
|
153
|
+
<span class="ruby-identifier">serializer</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Serializer</span>.<span class="ruby-identifier">new</span>( <span class="ruby-value str">"rdfxml"</span>, <span class="ruby-value str">"application/rdf+xml"</span> )
|
154
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">serializer</span>.<span class="ruby-identifier">model_to_string</span>(<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>), <span class="ruby-identifier">model</span>)
|
155
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
|
156
|
+
<span class="ruby-keyword kw">end</span>
|
157
|
+
</pre>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div id="method-M000085" class="method-detail">
|
163
|
+
<a name="M000085"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="#M000085" class="method-signature">
|
167
|
+
<span class="method-name">parse_ntriples_from_string</span><span class="method-args">(string, base_uri)</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
<p>
|
173
|
+
Parse a string containing ntriples into <a href="../RDF.html">RDF</a>/XML.
|
174
|
+
Returns a string
|
175
|
+
</p>
|
176
|
+
<pre>
|
177
|
+
string:: the string containing the data
|
178
|
+
base_uri:: base uri for parsing the data
|
179
|
+
</pre>
|
180
|
+
<p><a class="source-toggle" href="#"
|
181
|
+
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
|
182
|
+
<div class="method-source-code" id="M000085-source">
|
183
|
+
<pre>
|
184
|
+
<span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 39</span>
|
185
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">base_uri</span>)
|
186
|
+
<span class="ruby-identifier">model</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span>()
|
187
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"ntriples"</span>, <span class="ruby-value str">""</span>)
|
188
|
+
<span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse_string_into_model</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">string</span>, <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>))
|
189
|
+
<span class="ruby-identifier">serializer</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Serializer</span>.<span class="ruby-identifier">new</span>( <span class="ruby-value str">"rdfxml"</span>, <span class="ruby-value str">"application/rdf+xml"</span> )
|
190
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">serializer</span>.<span class="ruby-identifier">model_to_string</span>(<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>), <span class="ruby-identifier">model</span>)
|
191
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
|
192
|
+
<span class="ruby-keyword kw">end</span>
|
193
|
+
</pre>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="method-M000086" class="method-detail">
|
199
|
+
<a name="M000086"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="#M000086" class="method-signature">
|
203
|
+
<span class="method-name">store_ntriples</span><span class="method-args">(file, store, base_uri=nil, graph_name=nil)</span>
|
204
|
+
</a>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p>
|
209
|
+
Convenience method to parse an ntriples file and store it a Platform store
|
210
|
+
</p>
|
211
|
+
<pre>
|
212
|
+
file:: the file to parse
|
213
|
+
store:: the store to receive the data
|
214
|
+
base_uri:: base uri against which the data is parsed
|
215
|
+
graph_name:: uri of graph in store
|
216
|
+
</pre>
|
217
|
+
<p><a class="source-toggle" href="#"
|
218
|
+
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
|
219
|
+
<div class="method-source-code" id="M000086-source">
|
220
|
+
<pre>
|
221
|
+
<span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 54</span>
|
222
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">store_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
|
223
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">base_uri</span>)
|
224
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>)
|
225
|
+
<span class="ruby-keyword kw">end</span>
|
226
|
+
</pre>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div id="method-M000087" class="method-detail">
|
232
|
+
<a name="M000087"></a>
|
233
|
+
|
234
|
+
<div class="method-heading">
|
235
|
+
<a href="#M000087" class="method-signature">
|
236
|
+
<span class="method-name">store_ntriples_from_string</span><span class="method-args">(string, store, base_uri, graph_name=nil)</span>
|
237
|
+
</a>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="method-description">
|
241
|
+
<p>
|
242
|
+
Convenience method to parse an ntriples string and store it a Platform
|
243
|
+
store
|
244
|
+
</p>
|
245
|
+
<pre>
|
246
|
+
string:: the data to parse
|
247
|
+
store:: the store to receive the data
|
248
|
+
base_uri:: base uri against which the data is parsed
|
249
|
+
graph_name:: uri of graph in store
|
250
|
+
</pre>
|
251
|
+
<p><a class="source-toggle" href="#"
|
252
|
+
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
|
253
|
+
<div class="method-source-code" id="M000087-source">
|
254
|
+
<pre>
|
255
|
+
<span class="ruby-comment cmt"># File lib/pho/rdf.rb, line 65</span>
|
256
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">store_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">store</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-identifier">graph_name</span>=<span class="ruby-keyword kw">nil</span>)
|
257
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">parse_ntriples_from_string</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">base_uri</span>)
|
258
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">store_data</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">graph_name</span>)
|
259
|
+
<span class="ruby-keyword kw">end</span>
|
260
|
+
</pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
</div>
|
270
|
+
|
271
|
+
|
272
|
+
<div id="validator-badges">
|
273
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
</body>
|
277
|
+
</html>
|
@@ -92,12 +92,12 @@ Class for converting to and from resource hashes
|
|
92
92
|
<h3 class="section-bar">Methods</h3>
|
93
93
|
|
94
94
|
<div class="name-list">
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
95
|
+
<a href="#M000080">parse</a>
|
96
|
+
<a href="#M000076">parse_json</a>
|
97
|
+
<a href="#M000078">parse_ntriples</a>
|
98
|
+
<a href="#M000077">parse_rdfxml</a>
|
99
|
+
<a href="#M000079">parse_turtle</a>
|
100
|
+
<a href="#M000081">serialize_json</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
103
|
|
@@ -119,11 +119,11 @@ Class for converting to and from resource hashes
|
|
119
119
|
<div id="methods">
|
120
120
|
<h3 class="section-bar">Public Class methods</h3>
|
121
121
|
|
122
|
-
<div id="method-
|
123
|
-
<a name="
|
122
|
+
<div id="method-M000080" class="method-detail">
|
123
|
+
<a name="M000080"></a>
|
124
124
|
|
125
125
|
<div class="method-heading">
|
126
|
-
<a href="#
|
126
|
+
<a href="#M000080" class="method-signature">
|
127
127
|
<span class="method-name">parse</span><span class="method-args">(data, base_uri, format="rdfxml")</span>
|
128
128
|
</a>
|
129
129
|
</div>
|
@@ -139,10 +139,10 @@ href="../ResourceHash.html">ResourceHash</a>
|
|
139
139
|
base_uri:: base uri of the data
|
140
140
|
</pre>
|
141
141
|
<p><a class="source-toggle" href="#"
|
142
|
-
onclick="toggleCode('
|
143
|
-
<div class="method-source-code" id="
|
142
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
143
|
+
<div class="method-source-code" id="M000080-source">
|
144
144
|
<pre>
|
145
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
145
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 53</span>
|
146
146
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-identifier">format</span>=<span class="ruby-value str">"rdfxml"</span>)
|
147
147
|
<span class="ruby-identifier">model</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span>()
|
148
148
|
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">format</span>
|
@@ -162,28 +162,29 @@ href="../ResourceHash.html">ResourceHash</a>
|
|
162
162
|
</div>
|
163
163
|
</div>
|
164
164
|
|
165
|
-
<div id="method-
|
166
|
-
<a name="
|
165
|
+
<div id="method-M000076" class="method-detail">
|
166
|
+
<a name="M000076"></a>
|
167
167
|
|
168
168
|
<div class="method-heading">
|
169
|
-
<a href="#
|
169
|
+
<a href="#M000076" class="method-signature">
|
170
170
|
<span class="method-name">parse_json</span><span class="method-args">(json)</span>
|
171
171
|
</a>
|
172
172
|
</div>
|
173
173
|
|
174
174
|
<div class="method-description">
|
175
175
|
<p>
|
176
|
-
Parse JSON structured according to the
|
177
|
-
|
176
|
+
Parse JSON structured according to the <a
|
177
|
+
href="../RDF.html">RDF</a>-in-JSON specification into a Ruby resource hash.
|
178
|
+
Simply invokes the JSON parser.
|
178
179
|
</p>
|
179
180
|
<pre>
|
180
181
|
json:: valid RDF-in-JSON
|
181
182
|
</pre>
|
182
183
|
<p><a class="source-toggle" href="#"
|
183
|
-
onclick="toggleCode('
|
184
|
-
<div class="method-source-code" id="
|
184
|
+
onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
|
185
|
+
<div class="method-source-code" id="M000076-source">
|
185
186
|
<pre>
|
186
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
187
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 23</span>
|
187
188
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_json</span>(<span class="ruby-identifier">json</span>)
|
188
189
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">json</span>)
|
189
190
|
<span class="ruby-keyword kw">end</span>
|
@@ -192,11 +193,11 @@ Ruby resource hash. Simply invokes the JSON parser.
|
|
192
193
|
</div>
|
193
194
|
</div>
|
194
195
|
|
195
|
-
<div id="method-
|
196
|
-
<a name="
|
196
|
+
<div id="method-M000078" class="method-detail">
|
197
|
+
<a name="M000078"></a>
|
197
198
|
|
198
199
|
<div class="method-heading">
|
199
|
-
<a href="#
|
200
|
+
<a href="#M000078" class="method-signature">
|
200
201
|
<span class="method-name">parse_ntriples</span><span class="method-args">(ntriples, base_uri)</span>
|
201
202
|
</a>
|
202
203
|
</div>
|
@@ -209,10 +210,10 @@ Parse a string containing N-Triples into a resource hash
|
|
209
210
|
ntriples:: a String containing N-Triples
|
210
211
|
</pre>
|
211
212
|
<p><a class="source-toggle" href="#"
|
212
|
-
onclick="toggleCode('
|
213
|
-
<div class="method-source-code" id="
|
213
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
214
|
+
<div class="method-source-code" id="M000078-source">
|
214
215
|
<pre>
|
215
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
216
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 37</span>
|
216
217
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_ntriples</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">base_uri</span>)
|
217
218
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">"ntriples"</span>)
|
218
219
|
<span class="ruby-keyword kw">end</span>
|
@@ -221,27 +222,28 @@ Parse a string containing N-Triples into a resource hash
|
|
221
222
|
</div>
|
222
223
|
</div>
|
223
224
|
|
224
|
-
<div id="method-
|
225
|
-
<a name="
|
225
|
+
<div id="method-M000077" class="method-detail">
|
226
|
+
<a name="M000077"></a>
|
226
227
|
|
227
228
|
<div class="method-heading">
|
228
|
-
<a href="#
|
229
|
+
<a href="#M000077" class="method-signature">
|
229
230
|
<span class="method-name">parse_rdfxml</span><span class="method-args">(rdfxml, base_uri)</span>
|
230
231
|
</a>
|
231
232
|
</div>
|
232
233
|
|
233
234
|
<div class="method-description">
|
234
235
|
<p>
|
235
|
-
Parse a string containing RDF
|
236
|
+
Parse a string containing <a href="../RDF.html">RDF</a>/XML into a resource
|
237
|
+
hash
|
236
238
|
</p>
|
237
239
|
<pre>
|
238
240
|
rdfxml: a String containing RDF/XML
|
239
241
|
</pre>
|
240
242
|
<p><a class="source-toggle" href="#"
|
241
|
-
onclick="toggleCode('
|
242
|
-
<div class="method-source-code" id="
|
243
|
+
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
|
244
|
+
<div class="method-source-code" id="M000077-source">
|
243
245
|
<pre>
|
244
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
246
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 30</span>
|
245
247
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_rdfxml</span>(<span class="ruby-identifier">rdfxml</span>, <span class="ruby-identifier">base_uri</span>)
|
246
248
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">rdfxml</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">"rdfxml"</span>)
|
247
249
|
<span class="ruby-keyword kw">end</span>
|
@@ -250,11 +252,11 @@ Parse a string containing RDF/XML into a resource hash
|
|
250
252
|
</div>
|
251
253
|
</div>
|
252
254
|
|
253
|
-
<div id="method-
|
254
|
-
<a name="
|
255
|
+
<div id="method-M000079" class="method-detail">
|
256
|
+
<a name="M000079"></a>
|
255
257
|
|
256
258
|
<div class="method-heading">
|
257
|
-
<a href="#
|
259
|
+
<a href="#M000079" class="method-signature">
|
258
260
|
<span class="method-name">parse_turtle</span><span class="method-args">(turtle, base_uri)</span>
|
259
261
|
</a>
|
260
262
|
</div>
|
@@ -267,10 +269,10 @@ Parse a string containing Turtle into a resource hash
|
|
267
269
|
ntriples:: a String containing Turtle
|
268
270
|
</pre>
|
269
271
|
<p><a class="source-toggle" href="#"
|
270
|
-
onclick="toggleCode('
|
271
|
-
<div class="method-source-code" id="
|
272
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
273
|
+
<div class="method-source-code" id="M000079-source">
|
272
274
|
<pre>
|
273
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
275
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 44</span>
|
274
276
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse_turtle</span>(<span class="ruby-identifier">turtle</span>, <span class="ruby-identifier">base_uri</span>)
|
275
277
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">turtle</span>, <span class="ruby-identifier">base_uri</span>, <span class="ruby-value str">"turtle"</span>)
|
276
278
|
<span class="ruby-keyword kw">end</span>
|
@@ -279,27 +281,27 @@ Parse a string containing Turtle into a resource hash
|
|
279
281
|
</div>
|
280
282
|
</div>
|
281
283
|
|
282
|
-
<div id="method-
|
283
|
-
<a name="
|
284
|
+
<div id="method-M000081" class="method-detail">
|
285
|
+
<a name="M000081"></a>
|
284
286
|
|
285
287
|
<div class="method-heading">
|
286
|
-
<a href="#
|
288
|
+
<a href="#M000081" class="method-signature">
|
287
289
|
<span class="method-name">serialize_json</span><span class="method-args">(hash)</span>
|
288
290
|
</a>
|
289
291
|
</div>
|
290
292
|
|
291
293
|
<div class="method-description">
|
292
294
|
<p>
|
293
|
-
Serialize a resource hash as RDF
|
295
|
+
Serialize a resource hash as <a href="../RDF.html">RDF</a>-in-JSON
|
294
296
|
</p>
|
295
297
|
<pre>
|
296
298
|
hash:: the resource hash to serialize
|
297
299
|
</pre>
|
298
300
|
<p><a class="source-toggle" href="#"
|
299
|
-
onclick="toggleCode('
|
300
|
-
<div class="method-source-code" id="
|
301
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
302
|
+
<div class="method-source-code" id="M000081-source">
|
301
303
|
<pre>
|
302
|
-
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line
|
304
|
+
<span class="ruby-comment cmt"># File lib/pho/converter.rb, line 71</span>
|
303
305
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Converter</span>.<span class="ruby-identifier">serialize_json</span>(<span class="ruby-identifier">hash</span>)
|
304
306
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">hash</span>)
|
305
307
|
<span class="ruby-keyword kw">end</span>
|