+ sharedtestdata/directmappingspec test files
authorEric Prud'hommeaux <eric@w3.org>
Fri, 26 Nov 2010 19:12:36 -0500
changeset 281 60fef14de348
parent 280 2bdc1560bf57
child 282 19086fe774d2
+ sharedtestdata/directmappingspec test files
sharedtestdata/directmappingspec/emp_addr.sql
sharedtestdata/directmappingspec/emp_addr.ttl
sharedtestdata/directmappingspec/hier_tabl.sql
sharedtestdata/directmappingspec/hier_tabl.ttl
sharedtestdata/directmappingspec/hier_tabl_proto.sql
sharedtestdata/directmappingspec/hier_tabl_proto.ttl
sharedtestdata/directmappingspec/multi_key.sql
sharedtestdata/directmappingspec/multi_key.ttl
sharedtestdata/directmappingspec/ref_no_pk.sql
sharedtestdata/directmappingspec/ref_no_pk.ttl
sharedtestdata/src/main/scala/DirectMappingSpec.scala
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/emp_addr.sql	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,5 @@
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
+INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
+CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT, FOREIGN KEY (addr) REFERENCES Addresses(ID));
+INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
+INSERT INTO People (ID, fname, addr) VALUES (8, "Sue", NULL);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/emp_addr.ttl	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,9 @@
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
+<People/ID.7#_> <People#ID> 7 .
+<People/ID.7#_> <People#fname> "Bob"^^<http://www.w3.org/2001/XMLSchema#string> .
+<People/ID.7#_> <People#addr> <Addresses/ID.18#_> .
+<People/ID.8#_> <People#ID> 8 .
+<People/ID.8#_> <People#fname> "Sue"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#ID> 18 .
+<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/hier_tabl.sql	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,13 @@
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
+INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
+CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
+                     FOREIGN KEY (addr) REFERENCES Addresses(ID));
+INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
+CREATE TABLE Offices (ID INT PRIMARY KEY,
+                      building INT, ofcNumber STRING,
+                      FOREIGN KEY (ID) REFERENCES Addresses(ID));
+INSERT INTO Offices (ID, building, ofcNumber) VALUES (18, 32, "G528");
+CREATE TABLE ExecutiveOffices (ID INT PRIMARY KEY,
+                               desk STRING,
+                               FOREIGN KEY (ID) REFERENCES Offices(ID));
+INSERT INTO ExecutiveOffices (ID, desk) VALUES (18, "oak");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/hier_tabl.ttl	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,15 @@
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
+<Addresses/ID.18#_> <ExecutiveOffices#ID> 18 .
+<Addresses/ID.18#_> <ExecutiveOffices#desk> "oak"^^xsd:string . 
+
+<Addresses/ID.18#_> <Offices#ID> 18 .
+<Addresses/ID.18#_> <Offices#building> 32 .
+<Addresses/ID.18#_> <Offices#ofcNumber> "G528"^^xsd:string . 
+
+<People/ID.7#_> <People#ID> 7 .
+<People/ID.7#_> <People#fname> "Bob"^^xsd:string .
+<People/ID.7#_> <People#addr> <Addresses/ID.18#_> .
+
+<Addresses/ID.18#_> <Addresses#ID> 18 .
+<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/hier_tabl_proto.sql	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,9 @@
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
+INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
+CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
+                     FOREIGN KEY (addr) REFERENCES Addresses(ID));
+INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
+CREATE TABLE Offices (ID INT PRIMARY KEY,
+                      building INT, ofcNumber STRING,
+                      FOREIGN KEY (ID) REFERENCES Addresses(ID));
+INSERT INTO Offices (ID, building, ofcNumber) VALUES (18, 32, "G528");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/hier_tabl_proto.ttl	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,12 @@
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
+<Addresses/ID.18#_> <Offices#ID> 18 .
+<Addresses/ID.18#_> <Offices#building> 32 .
+<Addresses/ID.18#_> <Offices#ofcNumber> "G528"^^xsd:string . 
+
+<People/ID.7#_> <People#ID> 7 .
+<People/ID.7#_> <People#fname> "Bob"^^xsd:string .
+<People/ID.7#_> <People#addr> <Addresses/ID.18#_> .
+
+<Addresses/ID.18#_> <Addresses#ID> 18 .
+<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/multi_key.sql	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,10 @@
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
+INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
+CREATE TABLE Department (ID INT PRIMARY KEY, name STRING, city STRING,
+                         manager INT, FOREIGN KEY (manager) REFERENCES People(ID), UNIQUE (name, city));
+INSERT INTO Department (ID, name, city, manager) VALUES (23, "accounting", "Cambridge", 8);
+CREATE TABLE People (ID INT PRIMARY KEY, fname STRING,
+                     addr INT, FOREIGN KEY (addr) REFERENCES Addresses(ID),
+                     deptName STRING, deptCity STRING, FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
+INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (7, "Bob", 18, "accounting", "Cambridge");
+INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (8, "Sue", NULL, NULL, NULL);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/multi_key.ttl	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,19 @@
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
+<People/ID.7#_> <People#deptName> "accounting"^^xsd:string .
+<People/ID.7#_> <People#deptCity> "Cambridge"^^xsd:string .
+<People/ID.7#_> <People#deptName_deptCity> <Department/ID.23#_> .
+
+<Department/ID.23#_> <Department#ID> 23 .
+<Department/ID.23#_> <Department#name> "accounting"^^xsd:string .
+<Department/ID.23#_> <Department#city> "Cambridge"^^xsd:string .
+<Department/ID.23#_> <Department#manager> <People/ID.8#_> .
+
+<People/ID.7#_> <People#ID> 7 .
+<People/ID.7#_> <People#fname> "Bob"^^xsd:string .
+<People/ID.7#_> <People#addr> <Addresses/ID.18#_> .
+<People/ID.8#_> <People#ID> 8 .
+<People/ID.8#_> <People#fname> "Sue"^^xsd:string . 
+
+<Addresses/ID.18#_> <Addresses#ID> 18 .
+<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/ref_no_pk.sql	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,28 @@
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
+INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
+CREATE TABLE Department (ID INT PRIMARY KEY, name STRING, city STRING, manager INT,
+                         FOREIGN KEY (manager) REFERENCES People(ID),
+                         UNIQUE (name, city));
+INSERT INTO Department (ID, name, city, manager) VALUES (23, "accounting", "Cambridge", 8);
+CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
+                     FOREIGN KEY (addr) REFERENCES Addresses(ID),
+                     deptName STRING, deptCity STRING,
+                     FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
+INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (7, "Bob", 18, "accounting", "Cambridge");
+INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (8, "Sue", NULL, NULL, NULL);
+CREATE TABLE Projects (lead INT,
+                       FOREIGN KEY (lead) REFERENCES People(ID),
+                       name STRING, UNIQUE (lead, name), 
+                       deptName STRING, deptCity STRING,
+                       UNIQUE (name, deptName, deptCity),
+                       FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
+INSERT INTO Projects (lead, name, deptName, deptCity) VALUES (8, "pencil survey", "accounting", "Cambridge");
+INSERT INTO Projects (lead, name, deptName, deptCity) VALUES (8, "eraser survey", "accounting", "Cambridge");
+CREATE TABLE TaskAssignments (worker INT,
+                              FOREIGN KEY (worker) REFERENCES People(ID),
+                              project STRING, PRIMARY KEY (worker, project), 
+                              deptName STRING, deptCity STRING,
+                              FOREIGN KEY (worker) REFERENCES People(ID),
+                              FOREIGN KEY (project, deptName, deptCity) REFERENCES Projects(name, deptName, deptCity),
+                              FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
+INSERT INTO TaskAssignments (worker, project, deptName, deptCity) VALUES (7, "pencil survey", "accounting", "Cambridge");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sharedtestdata/directmappingspec/ref_no_pk.ttl	Fri Nov 26 19:12:36 2010 -0500
@@ -0,0 +1,38 @@
[email protected] xsd: <http://www.w3.org/2001/XMLSchema#> .
+_:a <Projects#lead> <People/ID.8#_> .
+_:a <Projects#name> "pencil survey"^^xsd:string .
+_:a <Projects#deptName> "accounting"^^xsd:string .
+_:a <Projects#deptCity> "Cambridge"^^xsd:string .
+_:a <Projects#deptName_deptCity> <Department/ID.23#_> .
+
+_:b <Projects#lead> <People/ID.8#_> .
+_:b <Projects#name> "eraser survey"^^xsd:string .
+_:b <Projects#deptName> "accounting"^^xsd:string .
+_:b <Projects#deptCity> "Cambridge"^^xsd:string .
+_:b <Projects#deptName_deptCity> <Department/ID.23#_> .
+
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#worker> <People/ID.7#_> .
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#project> "pencil survey"^^xsd:string .
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#deptName> "accounting"^^xsd:string .
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#deptCity> "Cambridge"^^xsd:string .
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#deptName_deptCity> <Department/ID.23#_> .
+<TaskAssignments/worker.7_project.pencil+survey#_> <TaskAssignments#project_deptName_deptCity> _:a .
+
+<People/ID.7#_> <People#deptName> "accounting"^^xsd:string .
+<People/ID.7#_> <People#deptCity> "Cambridge"^^xsd:string .
+<People/ID.7#_> <People#deptName_deptCity> <Department/ID.23#_> .
+
+<Department/ID.23#_> <Department#ID> 23 .
+<Department/ID.23#_> <Department#name> "accounting"^^xsd:string .
+<Department/ID.23#_> <Department#city> "Cambridge"^^xsd:string .
+<Department/ID.23#_> <Department#manager> <People/ID.8#_> .
+
+<People/ID.7#_> <People#ID> 7 .
+<People/ID.7#_> <People#fname> "Bob"^^xsd:string .
+<People/ID.7#_> <People#addr> <Addresses/ID.18#_> .
+<People/ID.8#_> <People#ID> 8 .
+<People/ID.8#_> <People#fname> "Sue"^^xsd:string .
+
+<Addresses/ID.18#_> <Addresses#ID> 18 .
+<Addresses/ID.18#_> <Addresses#city> "Cambridge"^^xsd:string .
+<Addresses/ID.18#_> <Addresses#state> "MA"^^xsd:string .
--- a/sharedtestdata/src/main/scala/DirectMappingSpec.scala	Fri Nov 26 18:38:33 2010 -0500
+++ b/sharedtestdata/src/main/scala/DirectMappingSpec.scala	Fri Nov 26 19:12:36 2010 -0500
@@ -10,7 +10,8 @@
   val SqlParser = sql.SqlParser()
 
   val TurtleParser = Turtle()
-  
+
+  // "../../../directmappingspec/emp_addr.sql"
   val db_emp_adder = SqlParser.toDB("""
 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
@@ -19,6 +20,7 @@
 INSERT INTO People (ID, fname, addr) VALUES (8, "Sue", NULL);
 """)
 
+  // "../../../directmappingspec/emp_addr.ttl"
   val directgraph_emp_adder = TurtleParser.toGraph("""
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 <People/ID.7#_> <People#ID> 7 .
@@ -32,6 +34,7 @@
 """)
 
 
+  // "../../../directmappingspec/multi_key.sql"
   val db_multi_key = SqlParser.parseAll(SqlParser.ddl, """
 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
@@ -45,6 +48,7 @@
 INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (8, "Sue", NULL, NULL, NULL);
 """).get
 
+  // "../../../directmappingspec/multi_key.ttl"
   val directgraph_multi_key = TurtleParser.toGraph("""
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 <People/ID.7#_> <People#deptName> "accounting"^^xsd:string .
@@ -68,6 +72,7 @@
 """)
 
 
+  // "../../../directmappingspec/ref_no_pk.sql"
   val db_ref_no_pk = SqlParser.parseAll(SqlParser.ddl, """
 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
@@ -99,6 +104,7 @@
 INSERT INTO TaskAssignments (worker, project, deptName, deptCity) VALUES (7, "pencil survey", "accounting", "Cambridge");
 """).get
 
+  // "../../../directmappingspec/ref_no_pk.ttl"
   val directgraph_ref_no_pk = TurtleParser.toGraph("""
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 _:a <Projects#lead> <People/ID.8#_> .
@@ -141,6 +147,7 @@
 """)
 
 
+  // "../../../directmappingspec/hier_tabl_proto.sql"
   val db_hier_tabl_proto = SqlParser.parseAll(SqlParser.ddl, """
 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
@@ -153,6 +160,7 @@
 INSERT INTO Offices (ID, building, ofcNumber) VALUES (18, 32, "G528");
 """).get
 
+  // "../../../directmappingspec/hier_tabl_proto.ttl"
   val directgraph_hier_tabl_proto = TurtleParser.toGraph("""
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 <Addresses/ID.18#_> <Offices#ID> 18 .
@@ -169,6 +177,7 @@
 """)
 
 
+  // "../../../directmappingspec/hier_tabl.sql"
   val db_hier_tabl = SqlParser.parseAll(SqlParser.ddl, """
 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
@@ -185,6 +194,7 @@
 INSERT INTO ExecutiveOffices (ID, desk) VALUES (18, "oak");
 """).get
 					
+  // "../../../directmappingspec/hier_tabl.ttl"
   val directgraph_hier_tabl = TurtleParser.toGraph("""
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 <Addresses/ID.18#_> <ExecutiveOffices#ID> 18 .