From ad57d36a114af87a2eb7cdb868dfcbc62292fd52 Mon Sep 17 00:00:00 2001
From: feger <marc.feger@hhu.de>
Date: Mon, 30 Mar 2020 12:18:15 +0200
Subject: [PATCH] Update to use Arguments

---
 src/index.html                     |  2 +-
 src/js/discussionElements.js       |  1 +
 src/js/graph/graphCreator.js       | 20 +++++++++++++++++++-
 src/js/visualizer/visualization.js | 12 +++++++++++-
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/src/index.html b/src/index.html
index b499b84..13dc3a5 100644
--- a/src/index.html
+++ b/src/index.html
@@ -2,7 +2,7 @@
 <meta charset="utf-8">
 <style>
     svg {
-        background: black;
+        background: #000000;
     }
 </style>
 <body>
diff --git a/src/js/discussionElements.js b/src/js/discussionElements.js
index a431033..bdfad8f 100644
--- a/src/js/discussionElements.js
+++ b/src/js/discussionElements.js
@@ -4,6 +4,7 @@ export const elements = {
     ARGUMENT: "Argument",
     SUPPORT: "Support",
     ATTACK: "Attack",
+    REASON: "REASONS",
     REGARDING: "REGARDING",
     CONCLUDES: "CONCLUDES",
     PREMISEOF: "PREMISE_OF"
diff --git a/src/js/graph/graphCreator.js b/src/js/graph/graphCreator.js
index cc63365..cd331d3 100644
--- a/src/js/graph/graphCreator.js
+++ b/src/js/graph/graphCreator.js
@@ -38,7 +38,8 @@ export class GraphCreator {
                                 "id": relation.identity.toInt(),
                                 "source": relation.start.toInt(),
                                 "target": relation.end.toInt(),
-                                "type": relation.type
+                                "type": relation.type,
+                                "bond": relation.properties.bond
                             };
                             graph.addEdge(newEdge);
                         }
@@ -48,4 +49,21 @@ export class GraphCreator {
         });
         return graph;
     }
+
+    async replaceArgumentsByEdges(graph) {
+        console.log(graph.edges);
+        console.log(graph.nodes);
+        const argumentNodes = graph.nodes.filter(function (element) {
+            return element.labels.includes(elements.ARGUMENT);
+        });
+        const argumentNodeIds = argumentNodes.map(function (element) {
+            return element.id;
+        })
+
+        const adjecentEdges = [];
+        graph.edges.forEach(function (element) {
+
+        });
+        console.log(argumentNodeIds);
+    }
 }
\ No newline at end of file
diff --git a/src/js/visualizer/visualization.js b/src/js/visualizer/visualization.js
index 45cce5d..5f58246 100644
--- a/src/js/visualizer/visualization.js
+++ b/src/js/visualizer/visualization.js
@@ -9,6 +9,7 @@ import {getIssueTooltipOf, getStatementTooltipOf, getArgumentTooltipOf, getEdgeT
 export class Network {
     async showNetwork(query) {
         const graph = await new GraphCreator().fill(new Graph(), query);
+        await new GraphCreator().replaceArgumentsByEdges(graph);
 
         var tooltip = d3.select("body")
             .append("div")
@@ -39,12 +40,21 @@ export class Network {
         link
             .attr('class', 'link')
             .attr('stroke', function (l) {
+                console.log(l);
                 if (l.type.includes(elements.REGARDING)) {
                     return "#A9A9A9";
                 } else if (l.type.includes(elements.CONCLUDES)) {
                     return "#ce34ff";
                 } else if (l.type.includes(elements.PREMISEOF)) {
                     return "#7b6fcc";
+                }else if (l.type.includes(elements.REASON)){
+                    console.log(l.bond);
+                    if (l.bond.includes(elements.ATTACK)){
+                        return '#ff0000'
+                    }
+                    else if (l.bond.includes(elements.SUPPORT)){
+                        return '#00ff00'
+                    }
                 }
             })
             .on('mouseover.tooltip', function (d) {
@@ -93,7 +103,7 @@ export class Network {
                     .duration(300)
                     .style("opacity", .8);
                 let info = "";
-                if (d.labels.includes("Issue")) {
+                if (d.labels.includes(elements.ISSUE)) {
                     info = getIssueTooltipOf(d);
                 } else if (d.labels.includes(elements.STATEMENT)) {
                     info = getStatementTooltipOf(d);
-- 
GitLab