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.
@@ -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 = [form.to_s.gsub('_', ' ').upcase]
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]
@@ -1,5 +1,5 @@
1
1
  module RDF
2
2
  module Virtuoso
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
1
2
  require_relative '../lib/rdf/virtuoso/prefixes'
2
- require 'rdf'
3
3
 
4
4
  describe RDF::Virtuoso::Prefixes do
5
5
  subject { RDF::Virtuoso::Prefixes.new(foo: 'bar', baz: 'quux') }
@@ -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
@@ -1,7 +1,7 @@
1
1
  require 'rdf/spec'
2
2
  require 'rdf'
3
3
  require 'rdf/virtuoso'
4
- require 'active_rdf'
4
+ #require 'active_rdf'
5
5
  require 'vcr'
6
6
 
7
7
  VCR.configure do |c|
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.0
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-10-24 00:00:00.000000000 Z
13
+ date: 2012-12-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec