Skip to content

Commit

Permalink
Regresstion tests clean up and new excepetion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjonesbr committed Mar 4, 2024
1 parent 2edb6cb commit 38a959b
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 14 deletions.
5 changes: 5 additions & 0 deletions expected/blazegraph-wikidata.out
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,8 @@ LIMIT 15
----+------
(0 rows)

DROP SERVER wikidata CASCADE;
NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to foreign table atms_munich
drop cascades to foreign table places_below_sea_level
drop cascades to foreign table european_countries
28 changes: 22 additions & 6 deletions expected/exceptions.out
Original file line number Diff line number Diff line change
Expand Up @@ -131,22 +131,25 @@ EXPLAIN SELECT * FROM t1;
Foreign Scan on t1 (cost=10000.00..20000.00 rows=1000 width=32)
(1 row)

CREATE TABLE public.t1_local(id serial, c1_null text, c2_null text);
/*
empty target_table
*/
SELECT
rdf_fdw_clone_table(
foreign_table => 't1'::regclass::oid,
target_table => ''
target_table => ''::regclass::oid
);
ERROR: no target table provided
ERROR: invalid name syntax
LINE 7: target_table => ''::regclass::oid
^
/*
negative fetch_size
*/
SELECT
rdf_fdw_clone_table(
foreign_table => 't1'::regclass::oid,
target_table => 't',
target_table => 't1_local'::regclass::oid,
fetch_size => -1
);
ERROR: invalid fetch_size: -1
Expand All @@ -157,7 +160,7 @@ HINT: the page size corresponds to the number of records that are retrieved aft
SELECT
rdf_fdw_clone_table(
foreign_table => 't1'::regclass::oid,
target_table => 't',
target_table => 't1_local'::regclass::oid,
begin_offset => -1
);
ERROR: invalid begin_offset: -1
Expand All @@ -167,10 +170,21 @@ ERROR: invalid begin_offset: -1
SELECT
rdf_fdw_clone_table(
foreign_table => 't1'::regclass::oid,
target_table => 't',
target_table => 't1_local'::regclass::oid,
ordering_column => 'foo'
);
ERROR: invalid ordering_column 'foo'
ERROR: invalid target table
HINT: at least one column of 't1_local' must match with the FOREIGN TABLE 't1'
/*
target table does not match any column of t1
*/
SELECT
rdf_fdw_clone_table(
foreign_table => 't1'::regclass::oid,
target_table => 't1_local'::regclass::oid
);
ERROR: invalid target table
HINT: at least one column of 't1_local' must match with the FOREIGN TABLE 't1'
/* invalid SPARQL - missing closing curly braces (\n)*/
CREATE FOREIGN TABLE t2 (s text OPTIONS (variable '?s')
) SERVER testserver2 OPTIONS (sparql '
Expand Down Expand Up @@ -279,3 +293,5 @@ CREATE FOREIGN TABLE t15 (
) SERVER testserver2 OPTIONS (sparql 'SELECT ?s {?s ?p ?o}', fetch_size '-1');
ERROR: invalid fetch_size: '-1'
HINT: expected values are positive integers
DROP FOREIGN TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1_local;
4 changes: 4 additions & 0 deletions expected/graphdb-getty.out
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,7 @@ INFO: SPARQL query sent to 'http://vocab.getty.edu/sparql.xml':
Vaucher, Gabriel Constant | Swiss artist, 1768-1814 | 1768
(10 rows)

DROP SERVER getty CASCADE;
NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to foreign table getty_places
drop cascades to foreign table getty_non_italians
215 changes: 215 additions & 0 deletions expected/table-clone.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
CREATE SERVER dbpedia
FOREIGN DATA WRAPPER rdf_fdw
OPTIONS (endpoint 'https://dbpedia.org/sparql');
CREATE FOREIGN TABLE public.dbpedia_cities (
uri text OPTIONS (variable '?city', nodetype 'iri'),
city_name text OPTIONS (variable '?name', nodetype 'literal', literaltype 'xsd:string')
)
SERVER dbpedia OPTIONS (
log_sparql 'true',
sparql '
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>
SELECT ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?name
OFFSET 73 LIMIT 1042
');
SELECT
rdf_fdw_clone_table(
foreign_table => 'public.dbpedia_cities'::regclass::oid,
target_table => 't_dbpedia1',
page_size => 2,
max_records => 9,
create_table => true,
verbose => true
);
INFO: Target TABLE "t_dbpedia1" created based on FOREIGN TABLE "dbpedia_cities":

CREATE TABLE t_dbpedia1 AS SELECT * FROM dbpedia_cities WITH NO DATA;

INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?city
OFFSET 0 LIMIT 2

INFO: page (0 - 2) stored: 2 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?city
OFFSET 2 LIMIT 2

INFO: page (2 - 4) stored: 2 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?city
OFFSET 4 LIMIT 2

INFO: page (4 - 6) stored: 2 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?city
OFFSET 6 LIMIT 2

INFO: page (6 - 8) stored: 2 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?city
OFFSET 8 LIMIT 1

INFO: page (8 - 10) stored: 1 records successfully inserted
INFO: Total inserted records: 9
rdf_fdw_clone_table
---------------------

(1 row)

SELECT * FROM t_local1;
ERROR: relation "t_local1" does not exist
LINE 1: SELECT * FROM t_local1;
^
SELECT
rdf_fdw_clone_table(
foreign_table => 'public.dbpedia_cities'::regclass::oid,
ordering_column => 'city_name',
target_table => 't_dbpedia2',
page_size => 6,
create_table => true,
verbose => true
);
INFO: Target TABLE "t_dbpedia2" created based on FOREIGN TABLE "dbpedia_cities":

CREATE TABLE t_dbpedia2 AS SELECT * FROM dbpedia_cities WITH NO DATA;

INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?name
OFFSET 0 LIMIT 6

INFO: page (0 - 6) stored: 6 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?name
OFFSET 6 LIMIT 6

INFO: page (6 - 12) stored: 6 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?name
OFFSET 12 LIMIT 6

INFO: page (12 - 18) stored: 2 records successfully inserted
INFO: SPARQL query sent to 'https://dbpedia.org/sparql':

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?city ?name
{
?city a dbo:City ;
foaf:name ?name ;
dbo:federalState dbr:North_Rhine-Westphalia
}
ORDER BY ?name
OFFSET 18 LIMIT 6

INFO: Total inserted records: 14
rdf_fdw_clone_table
---------------------

(1 row)

SELECT * FROM t_local2;
ERROR: relation "t_local2" does not exist
LINE 1: SELECT * FROM t_local2;
^
DROP SERVER dbpedia CASCADE;
NOTICE: drop cascades to foreign table dbpedia_cities
DROP TABLE IF EXISTS t_dbpedia1;
DROP TABLE IF EXISTS t_dbpedia2;
20 changes: 20 additions & 0 deletions expected/virtuoso-dbpedia.out
Original file line number Diff line number Diff line change
Expand Up @@ -1826,3 +1826,23 @@ LIMIT 10
Japón
(1 row)

DROP SERVER dbpedia CASCADE;
NOTICE: drop cascades to 18 other objects
DETAIL: drop cascades to foreign table film
drop cascades to foreign table politicians
drop cascades to foreign table party_members
drop cascades to foreign table chanceler_candidates
drop cascades to foreign table german_public_universities
drop cascades to foreign table person1
drop cascades to foreign table person2
drop cascades to foreign table person3
drop cascades to foreign table politicians_germany
drop cascades to foreign table dbpedia_limit
drop cascades to foreign table dbpedia_orderby
drop cascades to foreign table dbpedia_distinct
drop cascades to foreign table dbpedia_groupby
drop cascades to foreign table musical_artists
drop cascades to foreign table generic_rdf_table
drop cascades to foreign table generic_rdf_table2
drop cascades to foreign table generic_rdf_table3
drop cascades to foreign table generic_rdf_table4
4 changes: 3 additions & 1 deletion sql/blazegraph-wikidata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,6 @@ SELECT uri, nativename
ORDER BY uri
LIMIT 15
)
SELECT * FROM local EXCEPT SELECT * FROM j;
SELECT * FROM local EXCEPT SELECT * FROM j;

DROP SERVER wikidata CASCADE;
Loading

0 comments on commit 38a959b

Please sign in to comment.