--- a/README.txt Wed Nov 03 14:17:38 2010 -0400
+++ b/README.txt Wed Nov 03 15:21:59 2010 -0400
@@ -13,8 +13,26 @@
|-- sparql2sql → SPARQL to SQL rewriting, targetting the Direct Mapping of a Relational Database
|-- sparql2sqlendpoint → a SPARQL endpoint to access the Direct Mapping of a Relational Database
+== how to generate a standalone JAR ==
+
+You can easily generate a standalone JAR file embedding all you need: the Direct Mapping, a SPARQL endpoint, Jetty, MySQL driver, PostgreSQL driver, etc. You only need Java 1.6 and SBT.
+
+$ sbt "project sparql2sqlendpointjar" proguard
+
+You can then directly execute the JAR:
+
+$ java -jar sparql2sqlendpointjar/target/scala_2.8.0/sparql2sqlendpointjar_2.8.0-1.0.minara
+
+TODO
+* propose a JAR ready to be downloaded
+* propose a way to override the default DB values
+
== how to geek with FeDeRate? ==
-* you only need Java >= 1.6
+* you only need Java 1.6
* download and install sbt http://code.google.com/p/simple-build-tool/
* sbt update test
+
+TODO
+* explain how to develop with Jetty and automatic reload
+* explain how to modify the default values
--- a/project/plugins/project/build.properties Wed Nov 03 14:17:38 2010 -0400
+++ b/project/plugins/project/build.properties Wed Nov 03 15:21:59 2010 -0400
@@ -1,3 +1,3 @@
#Project properties
-#Wed Nov 03 10:16:34 EDT 2010
+#Wed Nov 03 14:04:40 EDT 2010
plugin.uptodate=true
--- a/sparql2sqlendpoint/src/main/resources/ddl.sql Wed Nov 03 14:17:38 2010 -0400
+++ b/sparql2sqlendpoint/src/main/resources/ddl.sql Wed Nov 03 15:21:59 2010 -0400
@@ -1,3 +1,28 @@
-CREATE TABLE Employee (empid INT, PRIMARY KEY (empid), lastName STRING, birthday DATE, manager INT, FOREIGN KEY (manager) REFERENCES Employee(empid));
-CREATE TABLE Tasks (taskid INT, PRIMARY KEY (taskid), name STRING, lead INT, FOREIGN KEY (lead) REFERENCES Employee(empid));
-CREATE TABLE TaskAssignments (id INT PRIMARY KEY, PRIMARY KEY (id), task INT, FOREIGN KEY (task) REFERENCES Tasks(taskid), employee INT, FOREIGN KEY (employee) REFERENCES Employee(empid));
+CREATE TABLE Addresses (ID INT PRIMARY KEY, city VARCHAR(50), state VARCHAR(50));
+INSERT INTO Addresses (ID, city, state) VALUES (18, 'Cambridge', 'MA');
+CREATE TABLE Department (ID INT PRIMARY KEY, name VARCHAR(50), city VARCHAR(50), 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 VARCHAR(50), addr INT,
+ FOREIGN KEY (addr) REFERENCES Addresses(ID),
+ deptName VARCHAR(50), deptCity VARCHAR(50),
+ 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 VARCHAR(50), UNIQUE (lead, name),
+ deptName VARCHAR(50), deptCity VARCHAR(50),
+ 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 VARCHAR(50), PRIMARY KEY (worker, project),
+ deptName VARCHAR(50), deptCity VARCHAR(50),
+ 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');
\ No newline at end of file
--- a/sparql2sqlendpoint/src/main/resources/default-config.json Wed Nov 03 14:17:38 2010 -0400
+++ b/sparql2sqlendpoint/src/main/resources/default-config.json Wed Nov 03 15:21:59 2010 -0400
@@ -14,7 +14,7 @@
PREFIX proj: <http://foo.example/DB/Projects#>
SELECT ?lead
WHERE {
- ?assignment asgn:worker <http://foo.example/DB/People/ID.7#_> .
+ ?assignment asgn:worker <http://foo.example/DB/People/ID.7#record> .
?assignment asgn:project_deptName_deptCity ?project .
?project proj:lead ?lead .
}
@@ -23,27 +23,34 @@
// the ddl used for the direct mapping (default one)
"default": {
"ddl": "
-CREATE TABLE Addresses (ID INT PRIMARY KEY, city VARCHAR(20), state CHAR(2));
-CREATE TABLE Department (ID INT PRIMARY KEY, name VARCHAR(20), city VARCHAR(20), manager INT,
+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));
-CREATE TABLE People (ID INT PRIMARY KEY, fname VARCHAR(20), addr INT,
+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 VARCHAR(20), deptCity VARCHAR(20),
+ 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 VARCHAR(20), UNIQUE (lead, name),
- deptName VARCHAR(20), deptCity VARCHAR(20),
+ 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 VARCHAR(20), PRIMARY KEY (worker, project),
- deptName VARCHAR(20), deptCity VARCHAR(20),
+ 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');
"
}
}
--- a/sparql2sqlendpoint/src/main/scala/Servlet.scala Wed Nov 03 14:17:38 2010 -0400
+++ b/sparql2sqlendpoint/src/main/scala/Servlet.scala Wed Nov 03 15:21:59 2010 -0400
@@ -181,11 +181,13 @@
def processIndex(request:HttpServletRequest, response:HttpServletResponse) {
+ val title = "SPARQL endpoint for the Direct Mapping"
+
val index =
<html xmlns="http://www.w3.org/1999/xhtml">
- <head><title>RDB2RDF Sparql endpoint</title></head>
+ <head><title>{ title }</title></head>
<body>
- <h1>RDB2RDF Sparql endpoint</h1>
+ <h1>Request the <a href="http://www.w3.org/2001/sw/rdb2rdf/directGraph/">Direct Mapping</a> using SPARQL!</h1>
<form action="sparql">
<p>
StemURI: <input cols="80" name="stemuri" id="stemuri" value={ defaultStemURI } /><br />
@@ -195,7 +197,7 @@
</form>
<hr />
<address>
- <a href="http://www.w3.org/People/Eric/">Eric Prud'hommeaux</a>, <a href="http://www.w3.org/People/Bertails/">Alexandre Bertails</a>, Jun 2010
+ <a href="http://www.w3.org/People/Eric/">Eric Prud'hommeaux</a>, <a href="http://www.w3.org/People/Bertails/">Alexandre Bertails</a>, Nov 2010
</address>
</body>
</html>