owlim-ruby 0.9.9.1 → 0.9.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -1
- data/bin/owlim +30 -2
- data/gemspec.rb +1 -1
- data/lib/owlim.rb +10 -2
- metadata +12 -3
data/README.rdoc
CHANGED
@@ -87,7 +87,11 @@ Search for literal objects by a keyword.
|
|
87
87
|
|
88
88
|
owlim find repository "keyword" [format]
|
89
89
|
|
90
|
-
|
90
|
+
Peek the triples in the store.
|
91
|
+
|
92
|
+
owlim head repository [limit [offset [format]]]
|
93
|
+
|
94
|
+
Results will be printed in a tabular text format by default.
|
91
95
|
|
92
96
|
==== Available alternative formats
|
93
97
|
|
@@ -120,6 +124,12 @@ Result will be printed in a tabular text format by default.
|
|
120
124
|
owlim find hoge "fuga" json
|
121
125
|
owlim find hoge "fuga" xml
|
122
126
|
|
127
|
+
owlim head hoge
|
128
|
+
owlim head hoge 10
|
129
|
+
owlim head hoge 10 50
|
130
|
+
owlim head hoge 10 50 json
|
131
|
+
owlim head hoge 10 50 xml
|
132
|
+
|
123
133
|
== Usage as a library
|
124
134
|
|
125
135
|
Enable this library.
|
@@ -188,6 +198,12 @@ finds all relevant triples sharing the same subject.
|
|
188
198
|
|
189
199
|
owlim.find(repository, keyword) {|x| print x}
|
190
200
|
|
201
|
+
Peak the triples in the store. By default, OWLIM adds 62 triples to
|
202
|
+
the empty repository when created, so offset + 61 is used internally.
|
203
|
+
|
204
|
+
opts = {:limit => 50, :offset => 100, :format => "json"}
|
205
|
+
owlim.head(repository, opts) {|x| print x}
|
206
|
+
|
191
207
|
Show formatted SPARQL prefixes.
|
192
208
|
|
193
209
|
puts owlim.prefix
|
data/bin/owlim
CHANGED
@@ -66,6 +66,9 @@ Query commands:
|
|
66
66
|
# Search for literal objects matching a keyword and return relevant triples
|
67
67
|
> owlim find repository "keyword" [format]
|
68
68
|
|
69
|
+
# Peek the triples in the store
|
70
|
+
> owlim head repository [limit [offset [format]]]
|
71
|
+
|
69
72
|
Environmental variable:
|
70
73
|
|
71
74
|
Specify your OWLIM server by the environmental variable 'SESAME_URL'.
|
@@ -108,6 +111,12 @@ Examples:
|
|
108
111
|
> owlim find hoge "fuga" json
|
109
112
|
> owlim find hoge "fuga" xml
|
110
113
|
|
114
|
+
> owlim head hoge
|
115
|
+
> owlim head hoge 10
|
116
|
+
> owlim head hoge 10 50
|
117
|
+
> owlim head hoge 10 50 json
|
118
|
+
> owlim head hoge 10 50 xml
|
119
|
+
|
111
120
|
USAGE
|
112
121
|
end
|
113
122
|
|
@@ -123,8 +132,6 @@ when "host"
|
|
123
132
|
puts serv.host
|
124
133
|
when "list"
|
125
134
|
puts serv.list
|
126
|
-
when "prefix"
|
127
|
-
puts serv.prefix
|
128
135
|
when "size"
|
129
136
|
if repository
|
130
137
|
puts serv.size(repository)
|
@@ -187,6 +194,8 @@ when "drop"
|
|
187
194
|
$stderr.puts "ERROR: missing a repository name to drop."
|
188
195
|
$stderr.puts "> owlim drop repository"
|
189
196
|
end
|
197
|
+
when "prefix"
|
198
|
+
puts serv.prefix
|
190
199
|
when "query"
|
191
200
|
if repository
|
192
201
|
if arguments.size > 1
|
@@ -223,6 +232,25 @@ when "find"
|
|
223
232
|
$stderr.puts "ERROR: missing a repository name to search."
|
224
233
|
$stderr.puts "> owlim find repository keyword"
|
225
234
|
end
|
235
|
+
when "head"
|
236
|
+
if repository
|
237
|
+
if arguments.size > 2
|
238
|
+
limit, offset, format, = *arguments
|
239
|
+
elsif arguments.size > 1
|
240
|
+
limit, offset, = *arguments
|
241
|
+
elsif arguments.size > 0
|
242
|
+
limit, = *arguments
|
243
|
+
end
|
244
|
+
opts = {
|
245
|
+
:limit => limit,
|
246
|
+
:offset => offset,
|
247
|
+
:format => format,
|
248
|
+
}
|
249
|
+
serv.head(repository, opts) {|x| print x}
|
250
|
+
else
|
251
|
+
$stderr.puts "ERROR: missing a repository name to search."
|
252
|
+
$stderr.puts "> owlim head repository [limit [offset [format]]"
|
253
|
+
end
|
226
254
|
when "help"
|
227
255
|
help
|
228
256
|
usage
|
data/gemspec.rb
CHANGED
data/lib/owlim.rb
CHANGED
@@ -136,8 +136,9 @@ class OWLIM
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def prefix
|
139
|
-
ary =
|
140
|
-
|
139
|
+
ary = []
|
140
|
+
@prefix_hash.sort.each { |key, value|
|
141
|
+
ary << "PREFIX #{key}: <#{value}>"
|
141
142
|
}
|
142
143
|
return ary.join("\n")
|
143
144
|
end
|
@@ -182,6 +183,13 @@ class OWLIM
|
|
182
183
|
query(repository, sparql, opts, &block)
|
183
184
|
end
|
184
185
|
|
186
|
+
def head(repository, opts={}, &block)
|
187
|
+
limit = opts[:limit] || 20
|
188
|
+
offset = (opts[:offset] || 1).to_i + 61
|
189
|
+
sparql = "select ?s ?p ?o where { ?s ?p ?o . } offset #{offset} limit #{limit}"
|
190
|
+
query(repository, sparql, opts, &block)
|
191
|
+
end
|
192
|
+
|
185
193
|
private
|
186
194
|
|
187
195
|
def prefix_default
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: owlim-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 39
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
9
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.9.
|
10
|
+
- 2
|
11
|
+
version: 0.9.9.2
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Toshiaki Katayama
|
@@ -23,9 +24,11 @@ dependencies:
|
|
23
24
|
name: uuid
|
24
25
|
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
26
28
|
requirements:
|
27
29
|
- - ">="
|
28
30
|
- !ruby/object:Gem::Version
|
31
|
+
hash: 3
|
29
32
|
segments:
|
30
33
|
- 0
|
31
34
|
version: "0"
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: json
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
41
46
|
segments:
|
42
47
|
- 0
|
43
48
|
version: "0"
|
@@ -68,23 +73,27 @@ rdoc_options: []
|
|
68
73
|
require_paths:
|
69
74
|
- lib
|
70
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
71
77
|
requirements:
|
72
78
|
- - ">="
|
73
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
74
81
|
segments:
|
75
82
|
- 0
|
76
83
|
version: "0"
|
77
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
78
86
|
requirements:
|
79
87
|
- - ">="
|
80
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
81
90
|
segments:
|
82
91
|
- 0
|
83
92
|
version: "0"
|
84
93
|
requirements: []
|
85
94
|
|
86
95
|
rubyforge_project: owlim-ruby
|
87
|
-
rubygems_version: 1.3.
|
96
|
+
rubygems_version: 1.3.7
|
88
97
|
signing_key:
|
89
98
|
specification_version: 3
|
90
99
|
summary: OWLIM client library for Ruby
|