Skip to content

Commit

Permalink
Merge branch 'new-prolod' of github.com:HPI-Information-Systems/ProLO…
Browse files Browse the repository at this point in the history
…D into new-prolod
  • Loading branch information
xchrdw committed Jun 19, 2015
2 parents ef5e517 + 71d298e commit 5772f7a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.io.File
import java.sql._
import java.util

import com.ibm.db2.jcc.am.{SqlException, SqlIntegrityConstraintViolationException, SqlSyntaxErrorException}
import com.ibm.db2.jcc.am.{SqlDataException, SqlException, SqlIntegrityConstraintViolationException, SqlSyntaxErrorException}
import com.typesafe.slick.driver.db2.DB2Driver.api._
import prolod.common.models._
import slick.jdbc.{GetResult, StaticQuery => Q}
Expand Down Expand Up @@ -463,6 +463,7 @@ class DatabaseConnection(config : Configuration) {
} catch {
case e : SqlIntegrityConstraintViolationException => println(e.getMessage + System.lineSeparator() + query)
case e : SqlSyntaxErrorException => println(e.getMessage + System.lineSeparator() + query)
case e : SqlDataException => println(e.getMessage + System.lineSeparator() + query)
}
None
}
Expand All @@ -486,8 +487,12 @@ class DatabaseConnection(config : Configuration) {
var result : Int = -1
val statement = connection.createStatement()
val resultSet = statement.executeQuery("SELECT id FROM " + name + ".subjecttable WHERE subject='" + s + "'")
resultSet.next()
result = resultSet.getInt("id")
try {
resultSet.next()
result = resultSet.getInt("id")
} catch {
case e : SqlException => println(e.getMessage)
}
statement.close
result
}
Expand Down
100 changes: 56 additions & 44 deletions prolod-play/public/js/directives/graphThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,31 @@ define(['angular', 'd3', './directives'], function (angular, d3) {

// set svg update handler after initial ticks improves performance a lot!
forceNodes.on("tick", function () {
link.attr("x1", function (d) {return d.source.x;})
.attr("y1", function (d) {return d.source.y;})
.attr("x2", function (d) {return d.target.x;})
.attr("y2", function (d) {return d.target.y;});

var inf = 1000000;
var minX = inf, maxX = -inf, minY=inf, maxY=-inf;
node.attr("cx", function (d) {
maxX = Math.max(maxX, d.x);
minX = Math.min(minX, d.x);
return d.x;
}).attr("cy", function (d) {
maxY = Math.max(maxY, d.y);
minY = Math.min(minY, d.y);
return d.y;
});

var padding = 10;
minX -= padding; maxX += padding;
minY -= padding; maxY += padding;
minX = Math.min(minX, 0); minY = Math.min(minY, 0);
maxX = Math.max(maxX, width); maxY = Math.max(maxY, height);
var w = maxX - minX; var h = maxY - minY;
svg.attr("viewBox", "" + minX + " " + minY + " " + w + " " + h);

});
link.attr("x1", function (d) {return d.source.x;})
.attr("y1", function (d) {return d.source.y;})
.attr("x2", function (d) {return d.target.x;})
.attr("y2", function (d) {return d.target.y;});

var inf = 1000000;
var minX = inf, maxX = -inf, minY=inf, maxY=-inf;
node.attr("cx", function (d) {
maxX = Math.max(maxX, d.x);
minX = Math.min(minX, d.x);
return d.x;
}).attr("cy", function (d) {
maxY = Math.max(maxY, d.y);
minY = Math.min(minY, d.y);
return d.y;
});

var padding = 10;
minX -= padding; maxX += padding;
minY -= padding; maxY += padding;
minX = Math.min(minX, 0); minY = Math.min(minY, 0);
maxX = Math.max(maxX, width); maxY = Math.max(maxY, height);
var w = maxX - minX; var h = maxY - minY;
svg.attr("viewBox", "" + minX + " " + minY + " " + w + " " + h);
});

force.tick(); // one last tick that updates the nodes

Expand All @@ -105,19 +104,32 @@ define(['angular', 'd3', './directives'], function (angular, d3) {
if (showArrows) {
svg.append("defs").selectAll("marker")
.data(["target"])
.enter().append("marker")
.enter().append("svg:marker")
.attr("id", function (d) { return d; })
.attr("viewBox", "0 -5 10 10")
.attr("refX", 15)
.attr("refY", -1.5)
.attr("markerWidth", 6)
.attr("markerHeight", 6)
.attr("orient", "auto")
.style("fill", "#bbb")
.append("svg:path")
.attr("d", "M0,-5L10,0L0,5");
//.attr("id", "arrowHead");

svg.append("defs").selectAll("marker")
.data(["target_red"])
.enter().append("svg:marker")
.attr("id", function (d) { return d; })
.attr("viewBox", "0 -5 10 10")
.attr("refX", 14)
.attr("refY", 0)
.attr("markerWidth", 10)
.attr("markerHeight", 10)
.attr("refX", 15)
.attr("refY", -1.5)
.attr("markerWidth", 6)
.attr("markerHeight", 6)
.attr("orient", "auto")
.append("path")
.attr("d", "M0,-5L10,0L0,5 L10,0 L0, -5")
.style("stroke", "#BBBBBB")
.style("stroke-width",1.1)
.style("opacity", "1");
.style("fill", "red")
.append("svg:path")
.attr("d", "M0,-5L10,0L0,5");

node.append("svg:title")
.text(
Expand All @@ -138,21 +150,21 @@ define(['angular', 'd3', './directives'], function (angular, d3) {
node.on("click", $scope.clickHandler);
}

/*function mouseover() {
link.on("mouseover", mouseover);
link.on("mouseout", mouseout);

function mouseover() {
var link = d3.select(this);
link.style('stroke-width', 2);
link.style("stroke", "black");
var path = svg.append("svg:g").selectAll("path")
.data(force.links())
.enter().append("svg:path")
link.style("stroke", "red");
link.style("marker-end", "url(#target_red)");
}

function mouseout() {
var link = d3.select(this);
link.style('stroke-width', 1);
link.style("stroke", "#bbb");
link.style("marker-end", "url(#target)");
}
*/

}

function buildGraph(scopeGraph) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class ImportDataset(name : String, namespace: String, ontologyNamespace : String
val excludeNamespaces: List[String] = if (excludeNS.isEmpty) Nil else List(excludeNS.get)

db.createTables(name)
importTriples()

new GraphLodImport(db, name, namespace, ontologyNamespace, excludeNamespaces, datasetFiles)

importTriples()

def importTriples() = {
for (dataset <- datasetFiles) {
var nxp: NxParser = null
Expand Down

0 comments on commit 5772f7a

Please sign in to comment.