Skip to content

Commit

Permalink
Closes #10 - colouring based on selected clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
anjeve committed Jun 19, 2015
1 parent 5772f7a commit ebf9294
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions prolod-server/app/controllers/prolod/server/GraphLod.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,27 @@ object GraphLod extends Controller {
}

def getGraphPatternStatistics(datasetId: String, groups: List[String], pattern: Int) = Action {
println("groups:" + groups)
var config = new Configuration()
var db = new DatabaseConnection(config)
val patternList: List[Pattern] = db.getColoredPatterns(datasetId, pattern)
val data: GraphLodResult = GraphLodResult(datasetId)
data.patterns = patternList

val patternList: List[Pattern] = db.getColoredPatterns(datasetId, pattern)
if (groups.size > 0) {
var newPatternList: List[Pattern] = Nil
for (pattern : Pattern <- patternList) {
var newNodes: List[Node] = Nil
for (node : Node <- pattern.nodes) {
var newNode : Node = node
if (!groups.contains(node.group.getOrElse(""))) {
newNode = new Node(node.id, node.uri, None)
}
newNodes ::= newNode
}
newPatternList ::=new Pattern(pattern.id, pattern.name, pattern.occurences, newNodes, pattern.links)
}
data.patterns = newPatternList
} else {
data.patterns = patternList
}
val json = Json.obj("statistics" -> data)
Ok(json)
}
Expand Down

0 comments on commit ebf9294

Please sign in to comment.