activerdf_rdflite 1.3 → 1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/CHANGELOG +4 -0
  2. data/lib/activerdf_rdflite/rdflite.rb +34 -19
  3. data/test/test_data.nt +18 -18
  4. data/test/test_fetching.rb +1 -1
  5. data/test/test_rdflite.rb +13 -1
  6. metadata +56 -98
  7. data/doc/rdoc/classes/FetchingAdapter.html +0 -150
  8. data/doc/rdoc/classes/FetchingAdapter.src/M000015.html +0 -36
  9. data/doc/rdoc/classes/RDFLite.html +0 -390
  10. data/doc/rdoc/classes/RDFLite.src/M000001.html +0 -55
  11. data/doc/rdoc/classes/RDFLite.src/M000002.html +0 -18
  12. data/doc/rdoc/classes/RDFLite.src/M000003.html +0 -20
  13. data/doc/rdoc/classes/RDFLite.src/M000004.html +0 -18
  14. data/doc/rdoc/classes/RDFLite.src/M000005.html +0 -45
  15. data/doc/rdoc/classes/RDFLite.src/M000006.html +0 -32
  16. data/doc/rdoc/classes/RDFLite.src/M000007.html +0 -20
  17. data/doc/rdoc/classes/RDFLite.src/M000008.html +0 -24
  18. data/doc/rdoc/classes/RDFLite.src/M000009.html +0 -36
  19. data/doc/rdoc/classes/RDFLite.src/M000010.html +0 -33
  20. data/doc/rdoc/classes/RDFLite.src/M000011.html +0 -19
  21. data/doc/rdoc/classes/RDFLite.src/M000012.html +0 -27
  22. data/doc/rdoc/classes/SuggestingAdapter.html +0 -190
  23. data/doc/rdoc/classes/SuggestingAdapter.src/M000013.html +0 -23
  24. data/doc/rdoc/classes/SuggestingAdapter.src/M000014.html +0 -46
  25. data/doc/rdoc/created.rid +0 -1
  26. data/doc/rdoc/files/LICENSE.html +0 -756
  27. data/doc/rdoc/files/README.html +0 -127
  28. data/doc/rdoc/files/lib/activerdf_rdflite/fetching_rb.html +0 -115
  29. data/doc/rdoc/files/lib/activerdf_rdflite/init_rb.html +0 -116
  30. data/doc/rdoc/files/lib/activerdf_rdflite/rdflite_rb.html +0 -127
  31. data/doc/rdoc/files/lib/activerdf_rdflite/suggesting_rb.html +0 -115
  32. data/doc/rdoc/fr_class_index.html +0 -30
  33. data/doc/rdoc/fr_file_index.html +0 -32
  34. data/doc/rdoc/fr_method_index.html +0 -42
  35. data/doc/rdoc/index.html +0 -24
  36. data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,18 +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>
7
- <head>
8
- <title>size (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 76</span>
14
- 76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
15
- 77: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-value str">'select count(*) from triple'</span>)[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>
16
- 78: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,20 +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>
7
- <head>
8
- <title>dump (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 81</span>
14
- 81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dump</span>
15
- 82: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-value str">'select s,p,o,c from triple'</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
16
- 83: [<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">c</span>].<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
17
- 84: <span class="ruby-keyword kw">end</span>
18
- 85: <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,18 +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>
7
- <head>
8
- <title>clear (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 88</span>
14
- 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
15
- 89: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-value str">'delete from triple'</span>)
16
- 90: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,45 +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>
7
- <head>
8
- <title>delete (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 96</span>
14
- 96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">p</span>, <span class="ruby-identifier">o</span>, <span class="ruby-identifier">c</span>=<span class="ruby-keyword kw">nil</span>)
15
- 97: <span class="ruby-comment cmt"># convert non-nil input to internal format</span>
16
- 98: <span class="ruby-identifier">quad</span> = [<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">c</span>].<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">internalise</span>(<span class="ruby-identifier">r</span>) }
17
- 99:
18
- 100: <span class="ruby-comment cmt"># construct where clause for deletion (for all non-nil input)</span>
19
- 101: <span class="ruby-identifier">where_clauses</span> = []
20
- 102: <span class="ruby-identifier">conditions</span> = []
21
- 103: <span class="ruby-identifier">quad</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
22
- 104: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">nil?</span>
23
- 105: <span class="ruby-identifier">conditions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">r</span>
24
- 106: <span class="ruby-identifier">where_clauses</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{SPOC[i]} = ?&quot;</span>
25
- 107: <span class="ruby-keyword kw">end</span>
26
- 108: <span class="ruby-keyword kw">end</span>
27
- 109:
28
- 110: <span class="ruby-comment cmt"># construct delete string</span>
29
- 111: <span class="ruby-identifier">ds</span> = <span class="ruby-value str">'delete from triple'</span>
30
- 112: <span class="ruby-identifier">ds</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; where #{where_clauses.join(' and ')}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">where_clauses</span>.<span class="ruby-identifier">empty?</span>
31
- 113:
32
- 114: <span class="ruby-comment cmt"># execute delete string with possible deletion conditions (for each </span>
33
- 115: <span class="ruby-comment cmt"># non-empty where clause)</span>
34
- 116: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">&quot;deleting #{[s,p,o,c].join(' ')}&quot;</span>)
35
- 117: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">ds</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">conditions</span>)
36
- 118:
37
- 119: <span class="ruby-comment cmt"># delete literal from ferret index</span>
38
- 120: <span class="ruby-ivar">@ferret</span>.<span class="ruby-identifier">search_each</span>(<span class="ruby-node">&quot;subject:\&quot;#{s}\&quot;, object:\&quot;#{o}\&quot;&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">idx</span>, <span class="ruby-identifier">score</span><span class="ruby-operator">|</span>
39
- 121: <span class="ruby-ivar">@ferret</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">idx</span>)
40
- 122: <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keyword_search?</span>
41
- 123:
42
- 124: <span class="ruby-ivar">@db</span>
43
- 125: <span class="ruby-keyword kw">end</span></pre>
44
- </body>
45
- </html>
@@ -1,32 +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>
7
- <head>
8
- <title>add (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 129</span>
14
- 129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">c</span>=<span class="ruby-keyword kw">nil</span>)
15
- 130: <span class="ruby-comment cmt"># check illegal input</span>
16
- 131: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRdfError</span>, <span class="ruby-node">&quot;adding non-resource #{s} while adding (#{s},#{p},#{o},#{c})&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:uri</span>)
17
- 132: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRdfError</span>, <span class="ruby-node">&quot;adding non-resource #{p} while adding (#{s},#{p},#{o},#{c})&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:uri</span>)
18
- 133:
19
- 134: <span class="ruby-identifier">triple</span> = [<span class="ruby-identifier">s</span>, <span class="ruby-identifier">p</span>, <span class="ruby-identifier">o</span>].<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">serialise</span>(<span class="ruby-identifier">r</span>) }
20
- 135: <span class="ruby-identifier">add_ntriples</span>(<span class="ruby-identifier">triple</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; .\n&quot;</span>, <span class="ruby-identifier">serialise</span>(<span class="ruby-identifier">c</span>) )
21
- 136:
22
- 137: <span class="ruby-comment cmt">## get internal representation (array)</span>
23
- 138: <span class="ruby-comment cmt">#quad = [s,p,o,c].collect {|r| internalise(r) }</span>
24
- 139:
25
- 140: <span class="ruby-comment cmt">## insert the triple into the datastore</span>
26
- 141: <span class="ruby-comment cmt">#@db.execute('insert into triple values (?,?,?,?)', *quad)</span>
27
- 142:
28
- 143: <span class="ruby-comment cmt">## if keyword-search available, insert the object into keyword search</span>
29
- 144: <span class="ruby-comment cmt">#@ferret &lt;&lt; {:subject =&gt; s, :object =&gt; o} if keyword_search?</span>
30
- 145: <span class="ruby-keyword kw">end</span></pre>
31
- </body>
32
- </html>
@@ -1,20 +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>
7
- <head>
8
- <title>flush (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 148</span>
14
- 148: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush</span>
15
- 149: <span class="ruby-comment cmt"># since we always write changes into sqlite3 immediately, we don't do </span>
16
- 150: <span class="ruby-comment cmt"># anything here</span>
17
- 151: <span class="ruby-keyword kw">true</span>
18
- 152: <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,24 +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>
7
- <head>
8
- <title>load (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 155</span>
14
- 155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>)
15
- 156: <span class="ruby-identifier">ntriples</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">file</span>)
16
- 157: <span class="ruby-identifier">$activerdflog</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">&quot;read #{ntriples.size} triples from file #{file}&quot;</span>
17
- 158:
18
- 159: <span class="ruby-comment cmt"># use filename as context</span>
19
- 160: <span class="ruby-identifier">context</span> = <span class="ruby-identifier">internalise</span>(<span class="ruby-constant">RDFS</span><span class="ruby-operator">::</span><span class="ruby-constant">Resource</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;file:#{file}&quot;</span>))
20
- 161:
21
- 162: <span class="ruby-identifier">add_ntriples</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">context</span>)
22
- 163: <span class="ruby-keyword kw">end</span></pre>
23
- </body>
24
- </html>
@@ -1,36 +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>
7
- <head>
8
- <title>add_ntriples (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 166</span>
14
- 166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_ntriples</span>(<span class="ruby-identifier">ntriples</span>, <span class="ruby-identifier">context</span>)
15
- 167:
16
- 168: <span class="ruby-comment cmt"># add each triple to db</span>
17
- 169: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">transaction</span>
18
- 170: <span class="ruby-identifier">insert</span> = <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">prepare</span>(<span class="ruby-value str">'insert into triple values (?,?,?,?);'</span>)
19
- 171:
20
- 172: <span class="ruby-identifier">ntriples</span> = <span class="ruby-constant">NTriplesParser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">ntriples</span>)
21
- 173: <span class="ruby-identifier">ntriples</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span><span class="ruby-operator">|</span>
22
- 174: <span class="ruby-comment cmt"># convert triples into internal db format</span>
23
- 175: <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">object</span> = [<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>].<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">internalise</span>(<span class="ruby-identifier">r</span>) }
24
- 176:
25
- 177: <span class="ruby-comment cmt"># insert triple into database</span>
26
- 178: <span class="ruby-identifier">insert</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">context</span>)
27
- 179:
28
- 180: <span class="ruby-comment cmt"># if keyword-search available, insert the object into keyword search</span>
29
- 181: <span class="ruby-ivar">@ferret</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:subject</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">:object</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">object</span>} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keyword_search?</span>
30
- 182: <span class="ruby-keyword kw">end</span>
31
- 183:
32
- 184: <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">commit</span>
33
- 185: <span class="ruby-ivar">@db</span>
34
- 186: <span class="ruby-keyword kw">end</span></pre>
35
- </body>
36
- </html>
@@ -1,33 +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>
7
- <head>
8
- <title>query (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 189</span>
14
- 189: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>)
15
- 190: <span class="ruby-comment cmt"># construct query clauses</span>
16
- 191: <span class="ruby-identifier">sql</span>, <span class="ruby-identifier">conditions</span> = <span class="ruby-identifier">translate</span>(<span class="ruby-identifier">query</span>)
17
- 192:
18
- 193: <span class="ruby-comment cmt"># executing query, passing all where-clause values as parameters (so that </span>
19
- 194: <span class="ruby-comment cmt"># sqlite will encode quotes correctly)</span>
20
- 195: <span class="ruby-identifier">results</span> = <span class="ruby-ivar">@db</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">conditions</span>)
21
- 196:
22
- 197: <span class="ruby-comment cmt"># if ASK query, we check whether we received a positive result count</span>
23
- 198: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">query</span>.<span class="ruby-identifier">ask?</span>
24
- 199: <span class="ruby-keyword kw">return</span> [[<span class="ruby-identifier">results</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>]]
25
- 200: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">query</span>.<span class="ruby-identifier">count?</span>
26
- 201: <span class="ruby-keyword kw">return</span> [[<span class="ruby-identifier">results</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>]]
27
- 202: <span class="ruby-keyword kw">else</span>
28
- 203: <span class="ruby-comment cmt"># otherwise we convert results to ActiveRDF nodes and return them</span>
29
- 204: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">wrap</span>(<span class="ruby-identifier">query</span>, <span class="ruby-identifier">results</span>)
30
- 205: <span class="ruby-keyword kw">end</span>
31
- 206: <span class="ruby-keyword kw">end</span></pre>
32
- </body>
33
- </html>
@@ -1,19 +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>
7
- <head>
8
- <title>translate (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 209</span>
14
- 209: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate</span>(<span class="ruby-identifier">query</span>)
15
- 210: <span class="ruby-identifier">where</span>, <span class="ruby-identifier">conditions</span> = <span class="ruby-identifier">construct_where</span>(<span class="ruby-identifier">query</span>)
16
- 211: [<span class="ruby-identifier">construct_select</span>(<span class="ruby-identifier">query</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">construct_join</span>(<span class="ruby-identifier">query</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">where</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">construct_sort</span>(<span class="ruby-identifier">query</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">construct_limit</span>(<span class="ruby-identifier">query</span>), <span class="ruby-identifier">conditions</span>]
17
- 212: <span class="ruby-keyword kw">end</span></pre>
18
- </body>
19
- </html>
@@ -1,27 +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>
7
- <head>
8
- <title>subproperties (RDFLite)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre> <span class="ruby-comment cmt"># File lib/activerdf_rdflite/rdflite.rb, line 414</span>
14
- 414: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subproperties</span>(<span class="ruby-identifier">resource</span>)
15
- 415: <span class="ruby-identifier">subproperty</span> = <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">:rdfs</span>,<span class="ruby-identifier">:subPropertyOf</span>)
16
- 416: <span class="ruby-identifier">children_query</span> = <span class="ruby-constant">Query</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">distinct</span>(<span class="ruby-identifier">:sub</span>).<span class="ruby-identifier">where</span>(<span class="ruby-identifier">:sub</span>, <span class="ruby-identifier">subproperty</span>, <span class="ruby-identifier">resource</span>)
17
- 417: <span class="ruby-identifier">children_query</span>.<span class="ruby-identifier">reasoning</span> = <span class="ruby-keyword kw">false</span>
18
- 418: <span class="ruby-identifier">children</span> = <span class="ruby-identifier">children_query</span>.<span class="ruby-identifier">execute</span>
19
- 419:
20
- 420: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">children</span>.<span class="ruby-identifier">empty?</span>
21
- 421: [<span class="ruby-identifier">resource</span>]
22
- 422: <span class="ruby-keyword kw">else</span>
23
- 423: [<span class="ruby-identifier">resource</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">children</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">subproperties</span>(<span class="ruby-identifier">c</span>)}.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span>
24
- 424: <span class="ruby-keyword kw">end</span>
25
- 425: <span class="ruby-keyword kw">end</span></pre>
26
- </body>
27
- </html>
@@ -1,190 +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: SuggestingAdapter</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">SuggestingAdapter</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/activerdf_rdflite/suggesting_rb.html">
59
- lib/activerdf_rdflite/suggesting.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
- <a href="FetchingAdapter.html">
69
- FetchingAdapter
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- The <a href="SuggestingAdapter.html">SuggestingAdapter</a> is an extension
86
- to rdflite that can recommand additional predicates for a given resource,
87
- based on usage statistics in the whole dataset. E.g. given a dataset with
88
- FOAF data, one can ask a suggestion for a person and get a recommendation
89
- for this person to also use foaf:birthday. You can use this adapter in any
90
- collaborative editing setting: it leads the community to converge on
91
- terminology (everybody will use the same foaf:birthday to define
92
- somebody&#8217;s birthday).
93
- </p>
94
-
95
- </div>
96
-
97
-
98
- </div>
99
-
100
- <div id="method-list">
101
- <h3 class="section-bar">Methods</h3>
102
-
103
- <div class="name-list">
104
- <a href="#M000013">new</a>&nbsp;&nbsp;
105
- <a href="#M000014">suggest</a>&nbsp;&nbsp;
106
- </div>
107
- </div>
108
-
109
- </div>
110
-
111
-
112
- <!-- if includes -->
113
-
114
- <div id="section">
115
-
116
-
117
-
118
- <div id="aliases-list">
119
- <h3 class="section-bar">External Aliases</h3>
120
-
121
- <div class="name-list">
122
- <table summary="aliases">
123
- <tr class="top-aligned-row context-row">
124
- <td class="context-item-name">initialize</td>
125
- <td>-></td>
126
- <td class="context-item-value">_old_initialize</td>
127
- </tr>
128
- </table>
129
- </div>
130
- </div>
131
-
132
-
133
-
134
-
135
-
136
- <!-- if method_list -->
137
- <div id="methods">
138
- <h3 class="section-bar">Public Class methods</h3>
139
-
140
- <div id="method-M000013" class="method-detail">
141
- <a name="M000013"></a>
142
-
143
- <div class="method-heading">
144
- <a href="SuggestingAdapter.src/M000013.html" target="Code" class="method-signature"
145
- onclick="popupCode('SuggestingAdapter.src/M000013.html');return false;">
146
- <span class="method-name">new</span><span class="method-args">(params)</span>
147
- </a>
148
- </div>
149
-
150
- <div class="method-description">
151
- <p>
152
- initialises the adapter, see <a href="RDFLite.html">RDFLite</a> for
153
- description of possible parameters.
154
- </p>
155
- </div>
156
- </div>
157
-
158
- <h3 class="section-bar">Public Instance methods</h3>
159
-
160
- <div id="method-M000014" class="method-detail">
161
- <a name="M000014"></a>
162
-
163
- <div class="method-heading">
164
- <a href="SuggestingAdapter.src/M000014.html" target="Code" class="method-signature"
165
- onclick="popupCode('SuggestingAdapter.src/M000014.html');return false;">
166
- <span class="method-name">suggest</span><span class="method-args">(resource)</span>
167
- </a>
168
- </div>
169
-
170
- <div class="method-description">
171
- <p>
172
- suggests additional predicates that might be applicable for the given
173
- resource
174
- </p>
175
- </div>
176
- </div>
177
-
178
-
179
- </div>
180
-
181
-
182
- </div>
183
-
184
-
185
- <div id="validator-badges">
186
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
187
- </div>
188
-
189
- </body>
190
- </html>