--- a/directmapping-webapp/src/main/scala/Servlet.scala Wed Feb 02 16:18:13 2011 -0500
+++ b/directmapping-webapp/src/main/scala/Servlet.scala Wed Feb 02 18:55:59 2011 -0500
@@ -31,9 +31,10 @@
val encoding = "utf-8"
override def doPost(request:HttpServletRequest, response:HttpServletResponse) = {
+ val hierarchy = request.getParameter("hierarchy") == "on"
request.getParameter("sql") match {
case null | "" => processIndex(request, response)
- case sql => processSQL(request, response, sql)
+ case sql => processSQL(request, response, sql, hierarchy)
}
}
@@ -55,7 +56,8 @@
{ if (result isDefined) <pre name="result" id="result">{ result.get }</pre> }
<form method="POST" action="/">
<p>
- <textarea rows="15" cols="80" name="sql" id="sql">{ sql }</textarea>
+ <textarea rows="15" cols="80" name="sql" id="sql">{ sql }</textarea><br />
+ <input name="hierarchy" checked="checked" type="checkbox" />Detects hierarchy relation
<input type="submit" value="submit SQL" />
</p>
</form>
@@ -66,12 +68,12 @@
</body>
</html>
- def processSQL(request:HttpServletRequest, response:HttpServletResponse, sql:String) {
+ def processSQL(request:HttpServletRequest, response:HttpServletResponse, sql:String, hierarchy:Boolean) {
val result =
try {
val db = SQLParser.toDB(sql)
- DirectMapping.HierarchyDetection = true
+ DirectMapping.HierarchyDetection = hierarchy
val computedGraph:Graph = directDB(db)
jenaSerializer(computedGraph)
} catch {