--- a/project/build/RDB2RDF.scala Tue Mar 15 11:03:58 2011 -0400
+++ b/project/build/RDB2RDF.scala Tue Mar 15 11:58:27 2011 -0400
@@ -31,7 +31,7 @@
lazy val rdfxmlTest = project("rdfxml-test", "rdfxml-test", new RDFXMLTest(_), rdfxml)
lazy val jena = project("jena", "jena", new Jena(_), rdf)
lazy val jenaTest = project("jena-test", "jena-test", new JenaTest(_), jena, rdfmodelTest, directmappingTest, turtleTest, rdfxmlTest)
- lazy val rdf2rdf = project("rdf2rdf", "rdf2rdf", new RDF2RDF(_), jena)
+ lazy val rdf2rdf = project("rdf2rdf", "rdf2rdf", new RDF2RDF(_), jena, directmapping)
lazy val sharedtestdata = project("sharedtestdata", "sharedtestdata", new SharedTestData(_), rdb, rdf, sql, turtle)
lazy val directmapping = project("directmapping", "directmapping", new DirectMapping(_), rdb, rdf, sql, sharedtestdata)
lazy val directmappingWebapp = project("directmapping-webapp", "directmapping-webapp", new DirectMappingWebapp(_), directmapping, jena)
--- a/rdf2rdf/src/test/scala/RDF2RDFTest.scala Tue Mar 15 11:03:58 2011 -0400
+++ b/rdf2rdf/src/test/scala/RDF2RDFTest.scala Tue Mar 15 11:58:27 2011 -0400
@@ -2,8 +2,10 @@
import org.scalatest.FunSuite
import org.scalatest.matchers.ShouldMatchers
+import org.w3.rdf.jena._
+import org.w3.directmapping._
-class RDF2RDFTest extends FunSuite with ShouldMatchers with RDF2RDFModule {
+trait Util extends JenaModel {
// TODO move that elsewhere
def getGraph(s:String, base:String = null):Graph = {
@@ -13,6 +15,10 @@
return new Graph(model.getGraph)
}
+}
+
+class RDF2RDFTest extends FunSuite with ShouldMatchers with RDF2RDFModule with Util {
+
test("http://ivan-herman.name/2010/11/19/my-first-mapping-from-direct-mapping/") {
val graph = getGraph("""
@@ -73,3 +79,41 @@
}
}
+
+import org.w3.rdb.RDB._
+import org.w3.sql
+import org.w3.rdf.turtle.TurtleModule
+
+class RDB2RDF2RDFTest extends FunSuite with ShouldMatchers with RDF2RDFModule with DirectMappingModule with Util with TurtleModule {
+
+ import DirectMapping._
+
+ val SqlParser = sql.SqlParser()
+
+ val turtleParser = new TurtleParser { }
+
+ test("http://lists.w3.org/Archives/Public/public-rdb2rdf-wg/2010Nov/0003.html") {
+
+ val db = SqlParser.toDB("""
+CREATE TABLE Person (ID INT PRIMARY KEY, fname STRING);
+CREATE TABLE Address (ID INT PRIMARY KEY, city STRING);
+CREATE TABLE PersonAddress (personID INT PRIMARY KEY,
+ addressID INT PRIMARY KEY,
+ FOREIGN KEY (personID) REFERENCES Person(ID),
+ FOREIGN KEY (addressID) REFERENCES Address(ID));
+INSERT INTO Person (ID, fname) VALUES (7, "Bob");
+INSERT INTO Person (ID, fname) VALUES (8, "Sue");
+INSERT INTO Address (ID, city) VALUES (18, "Cambridge");
+INSERT INTO Address (ID, city) VALUES (19, "Austin");
+INSERT INTO PersonAddress (personID, addressID) VALUES (7, 18);
+INSERT INTO PersonAddress (personID, addressID) VALUES (7, 19);
+INSERT INTO PersonAddress (personID, addressID) VALUES (8, 19);
+""")
+
+ val graph = databaseSemantics(db)
+
+ println(graph)
+
+ }
+
+}