Permalink
Browse files

modify bindings tests for full v/s natural join distinction

  • Loading branch information...
1 parent ba1f1a0 commit 4012e2d64d748880d428ea99cdcd897647536e00 james committed Apr 8, 2012
@@ -10,7 +10,7 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data01.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings01.rq");
@@ -10,7 +10,7 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data02.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings02.rq");
@@ -10,7 +10,7 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data03.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings03.rq");
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+ <head>
+ <variable name="s"/>
+ <variable name="o1"/>
+ <variable name="o2"/>
+ </head>
+ <results>
+ <!-- <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><literal>Alan</literal></binding>
+ <binding name="o2"><uri>http://example.org/b</uri></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><literal>Alan</literal></binding>
+ <binding name="o2"><literal>alan@example.org</literal></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><literal>Alan</literal></binding>
+ <binding name="o2"><literal>Alan</literal></binding>
+ </result> -->
+ </results>
+</sparql>
+
@@ -0,0 +1,32 @@
+# coding: utf-8
+#
+require 'spec_helper'
+
+# Auto-generated by build_w3c_tests.rb
+#
+# biningsd04 - BINDINGS
+#
+# This is a W3C test from the DAWG test suite:
+# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
+#
+describe "W3C test" do
+ context "bindings" do
+ before :all do
+ @data = IO.read(File.dirname(__FILE__) + "/data04.ttl");
+ @query = IO.read(File.dirname(__FILE__) + "/bindings04.rq");
+ end
+
+ example "bindings04 natural", :w3c_status => 'approved', :join => 'natural' do
+
+ graphs = {}
+ graphs[:default] = { :data => @data, :format => :ttl}
+
+
+ repository = 'bindings-bindings04'
+ expected = SPARQL::Client.parse_xml_bindings(IO.read(File.dirname(__FILE__) + "/bindings04-natural.srx")).map{|each| each.to_hash}
+
+ sparql_query(:graphs => graphs, :query => @query, # unordered comparison in rspec is =~
+ :repository => repository, :form => :select).should =~ expected
+ end
+ end
+end
@@ -10,13 +10,13 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data04.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings04.rq");
end
- example "bindings04", :w3c_status => 'approved' do
+ example "bindings04", :w3c_status => 'approved', :join => 'full' do
graphs = {}
graphs[:default] = { :data => @data, :format => :ttl}
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+ <head>
+ <variable name="s"/>
+ <variable name="o1"/>
+ <variable name="o2"/>
+ </head>
+ <results>
+ <!-- <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><uri>http://example.org/b</uri></binding>
+ <binding name="o2"><literal>Alan</literal></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><literal>alan@example.org</literal></binding>
+ <binding name="o2"><literal>Alan</literal></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><literal>Alan</literal></binding>
+ <binding name="o2"><literal>Alan</literal></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><uri>http://example.org/b</uri></binding>
+ <binding name="o2"><uri>http://example.org/b</uri></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><uri>http://example.org/b</uri></binding>
+ <binding name="o2"><literal>alan@example.org</literal></binding>
+ </result>
+ <result>
+ <binding name="s"><uri>http://example.org/a</uri></binding>
+ <binding name="o1"><uri>http://example.org/b</uri></binding>
+ <binding name="o2"><literal>Alan</literal></binding>
+ </result> -->
+ </results>
+</sparql>
+
@@ -0,0 +1,32 @@
+# coding: utf-8
+#
+require 'spec_helper'
+
+# Auto-generated by build_w3c_tests.rb
+#
+# biningsd05 - BINDINGS
+#
+# This is a W3C test from the DAWG test suite:
+# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
+#
+describe "W3C test" do
+ context "bindings" do
+ before :all do
+ @data = IO.read(File.dirname(__FILE__) + "/data05.ttl");
+ @query = IO.read(File.dirname(__FILE__) + "/bindings05.rq");
+ end
+
+ example "bindings05 natural", :w3c_status => 'approved', :join => 'natural' do
+
+ graphs = {}
+ graphs[:default] = { :data => @data, :format => :ttl}
+
+
+ repository = 'bindings-bindings05'
+ expected = SPARQL::Client.parse_xml_bindings(IO.read(File.dirname(__FILE__) + "/bindings05-natural.srx")).map{|each| each.to_hash}
+
+ sparql_query(:graphs => graphs, :query => @query, # unordered comparison in rspec is =~
+ :repository => repository, :form => :select).should =~ expected
+ end
+ end
+end
@@ -10,13 +10,13 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data05.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings05.rq");
end
- example "bindings05", :w3c_status => 'approved' do
+ example "bindings05", :w3c_status => 'approved', :join => 'full' do
graphs = {}
graphs[:default] = { :data => @data, :format => :ttl}
@@ -10,7 +10,7 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data06.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings06.rq");
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+ <head>
+ <variable name="s"/>
+ <variable name="o1"/>
+ <variable name="o2"/>
+ </head>
+ <results>
+ <result>
+ <binding name="s">
+ <uri>http://example.org/a</uri>
+ </binding>
+ <binding name="o1">
+ <uri>http://example.org/b</uri>
+ </binding>
+ <binding name="o2">
+ <uri>http://example.org/b</uri>
+ </binding>
+ </result>
+ <result>
+ <binding name="s">
+ <uri>http://example.org/a</uri>
+ </binding>
+ <binding name="o1">
+ <literal>alan@example.org</literal>
+ </binding>
+ <binding name="o2">
+ <uri>http://example.org/b</uri>
+ </binding>
+ </result>
+ <result>
+ <binding name="s">
+ <uri>http://example.org/a</uri>
+ </binding>
+ <binding name="o1">
+ <literal>Alan</literal>
+ </binding>
+ <binding name="o2">
+ <uri>http://example.org/b</uri>
+ </binding>
+ </result>
+ <!-- <result>
+ <binding name="s">
+ <uri>http://example.org/c</uri>
+ </binding>
+ <binding name="o1">
+ <literal>alice@example.org</literal>
+ </binding>
+ <binding name="o2">
+ <uri>http://example.org/b</uri>
+ </binding>
+ </result>
+ <result>
+ <binding name="s">
+ <uri>http://example.org/c</uri>
+ </binding>
+ <binding name="o1">
+ <literal>Alice</literal>
+ </binding>
+ <binding name="o2">
+ <uri>http://example.org/b</uri>
+ </binding>
+ </result> -->
+ </results>
+</sparql>
@@ -0,0 +1,32 @@
+# coding: utf-8
+#
+require 'spec_helper'
+
+# Auto-generated by build_w3c_tests.rb
+#
+# biningsd07 - BINDINGS
+#
+# This is a W3C test from the DAWG test suite:
+# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
+#
+describe "W3C test" do
+ context "bindings" do
+ before :all do
+ @data = IO.read(File.dirname(__FILE__) + "/data07.ttl");
+ @query = IO.read(File.dirname(__FILE__) + "/bindings07.rq");
+ end
+
+ example "bindings07 natural", :w3c_status => 'approved', :join => 'natural' do
+
+ graphs = {}
+ graphs[:default] = { :data => @data, :format => :ttl}
+
+
+ repository = 'bindings-bindings07'
+ expected = SPARQL::Client.parse_xml_bindings(IO.read(File.dirname(__FILE__) + "/bindings07-natural.srx")).map{|each| each.to_hash}
+
+ sparql_query(:graphs => graphs, :query => @query, # unordered comparison in rspec is =~
+ :repository => repository, :form => :select).should =~ expected
+ end
+ end
+end
@@ -10,13 +10,13 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data07.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings07.rq");
end
- example "bindings07", :w3c_status => 'approved' do
+ example "bindings07", :w3c_status => 'approved', :join => 'full' do
graphs = {}
graphs[:default] = { :data => @data, :format => :ttl}
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+ <head>
+ <variable name="book"/>
+ <variable name="title"/>
+ <variable name="price"/>
+ </head>
+ <results>
+ <!-- <result>
+ <binding name="book"><uri>http://example.org/book/book1</uri></binding>
+ <binding name="title"><literal>SPARQL Tutorial</literal></binding>
+ <binding name="price"><literal datatype="http://www.w3.org/2001/XMLSchema#integer">42</literal></binding>
+ </result>
+ <result>
+ <binding name="book"><uri>http://example.org/book/book2</uri></binding>
+ <binding name="title"><literal>The Semantic Web</literal></binding>
+ <binding name="price"><literal datatype="http://www.w3.org/2001/XMLSchema#integer">23</literal></binding>
+ </result> -->
+ </results>
+</sparql>
@@ -0,0 +1,32 @@
+# coding: utf-8
+#
+require 'spec_helper'
+
+# Auto-generated by build_w3c_tests.rb
+#
+# biningsd08 - BINDINGS
+#
+# This is a W3C test from the DAWG test suite:
+# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
+#
+describe "W3C test" do
+ context "bindings" do
+ before :all do
+ @data = IO.read(File.dirname(__FILE__) + "/data08.ttl");
+ @query = IO.read(File.dirname(__FILE__) + "/bindings08.rq");
+ end
+
+ example "bindings08", :w3c_status => 'approved', :join => 'natural' do
+
+ graphs = {}
+ graphs[:default] = { :data => @data, :format => :ttl}
+
+
+ repository = 'bindings-bindings08'
+ expected = SPARQL::Client.parse_xml_bindings(IO.read(File.dirname(__FILE__) + "/bindings08-natural.srx")).map{|each| each.to_hash}
+
+ sparql_query(:graphs => graphs, :query => @query, # unordered comparison in rspec is =~
+ :repository => repository, :form => :select).should =~ expected
+ end
+ end
+end
@@ -10,13 +10,13 @@
# http://www.w3.org/2009/sparql/docs/tests/data-sparql11/bindings/
#
describe "W3C test" do
- context "bind" do
+ context "bindings" do
before :all do
@data = IO.read(File.dirname(__FILE__) + "/data08.ttl");
@query = IO.read(File.dirname(__FILE__) + "/bindings08.rq");
end
- example "bindings08", :w3c_status => 'approved' do
+ example "bindings08", :w3c_status => 'approved', :join => 'full' do
graphs = {}
graphs[:default] = { :data => @data, :format => :ttl}

0 comments on commit 4012e2d

Please sign in to comment.