rdf-virtuoso 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rdf/virtuoso/query.rb +11 -1
- data/lib/rdf/virtuoso/version.rb +1 -1
- data/spec/prefixes_spec.rb +1 -1
- data/spec/query_spec.rb +7 -2
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
data/lib/rdf/virtuoso/query.rb
CHANGED
@@ -250,6 +250,14 @@ module RDF::Virtuoso
|
|
250
250
|
self
|
251
251
|
end
|
252
252
|
|
253
|
+
# @param string
|
254
|
+
# @return [Query]
|
255
|
+
# @see http://www.w3.org/TR/rdf-sparql-query/#specDataset
|
256
|
+
def define(string)
|
257
|
+
options[:define] = string
|
258
|
+
self
|
259
|
+
end
|
260
|
+
|
253
261
|
# @param RDF::URI uri
|
254
262
|
# @return [Query]
|
255
263
|
# @see http://www.w3.org/TR/rdf-sparql-query/#specDataset
|
@@ -460,7 +468,9 @@ module RDF::Virtuoso
|
|
460
468
|
#
|
461
469
|
# @return [String]
|
462
470
|
def to_s
|
463
|
-
buffer = [
|
471
|
+
buffer = []
|
472
|
+
buffer << "DEFINE #{options[:define]}" if options[:define]
|
473
|
+
buffer << [form.to_s.gsub('_', ' ').upcase]
|
464
474
|
case form
|
465
475
|
when :select, :describe
|
466
476
|
buffer << 'DISTINCT' if options[:distinct]
|
data/lib/rdf/virtuoso/version.rb
CHANGED
data/spec/prefixes_spec.rb
CHANGED
data/spec/query_spec.rb
CHANGED
@@ -44,7 +44,6 @@ describe RDF::Virtuoso::Query do
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
47
|
context "when building update queries" do
|
49
48
|
before :each do
|
50
49
|
@graph = "http://example.org/"
|
@@ -317,7 +316,13 @@ describe RDF::Virtuoso::Query do
|
|
317
316
|
@query.select.where([:s, RDF::DC.abstract, :o]).filters(filters).to_s.should ==
|
318
317
|
"SELECT * WHERE { ?s <#{RDF::DC.abstract}> ?o . FILTER(lang(?text) != \"nb\") FILTER(regex(?uri, \"^https\")) }"
|
319
318
|
end
|
320
|
-
|
319
|
+
|
320
|
+
it "should support DEFINE headers in queries" do
|
321
|
+
define = 'sql:select-option "ORDER"'
|
322
|
+
@query.select.where([:s, RDF::DC.abstract, :o]).define(define).to_s.should ==
|
323
|
+
"DEFINE #{define} SELECT * WHERE { ?s <#{RDF::DC.abstract}> ?o . }"
|
324
|
+
end
|
325
|
+
|
321
326
|
end
|
322
327
|
|
323
328
|
context "when building DESCRIBE queries" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-virtuoso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|