Skip to content
Snippets Groups Projects
Commit ad57d36a authored by Marc Feger's avatar Marc Feger
Browse files

Update to use Arguments

parent bc4a3ea6
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<style> <style>
svg { svg {
background: black; background: #000000;
} }
</style> </style>
<body> <body>
......
...@@ -4,6 +4,7 @@ export const elements = { ...@@ -4,6 +4,7 @@ export const elements = {
ARGUMENT: "Argument", ARGUMENT: "Argument",
SUPPORT: "Support", SUPPORT: "Support",
ATTACK: "Attack", ATTACK: "Attack",
REASON: "REASONS",
REGARDING: "REGARDING", REGARDING: "REGARDING",
CONCLUDES: "CONCLUDES", CONCLUDES: "CONCLUDES",
PREMISEOF: "PREMISE_OF" PREMISEOF: "PREMISE_OF"
......
...@@ -38,7 +38,8 @@ export class GraphCreator { ...@@ -38,7 +38,8 @@ export class GraphCreator {
"id": relation.identity.toInt(), "id": relation.identity.toInt(),
"source": relation.start.toInt(), "source": relation.start.toInt(),
"target": relation.end.toInt(), "target": relation.end.toInt(),
"type": relation.type "type": relation.type,
"bond": relation.properties.bond
}; };
graph.addEdge(newEdge); graph.addEdge(newEdge);
} }
...@@ -48,4 +49,21 @@ export class GraphCreator { ...@@ -48,4 +49,21 @@ export class GraphCreator {
}); });
return graph; 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
...@@ -9,6 +9,7 @@ import {getIssueTooltipOf, getStatementTooltipOf, getArgumentTooltipOf, getEdgeT ...@@ -9,6 +9,7 @@ import {getIssueTooltipOf, getStatementTooltipOf, getArgumentTooltipOf, getEdgeT
export class Network { export class Network {
async showNetwork(query) { async showNetwork(query) {
const graph = await new GraphCreator().fill(new Graph(), query); const graph = await new GraphCreator().fill(new Graph(), query);
await new GraphCreator().replaceArgumentsByEdges(graph);
var tooltip = d3.select("body") var tooltip = d3.select("body")
.append("div") .append("div")
...@@ -39,12 +40,21 @@ export class Network { ...@@ -39,12 +40,21 @@ export class Network {
link link
.attr('class', 'link') .attr('class', 'link')
.attr('stroke', function (l) { .attr('stroke', function (l) {
console.log(l);
if (l.type.includes(elements.REGARDING)) { if (l.type.includes(elements.REGARDING)) {
return "#A9A9A9"; return "#A9A9A9";
} else if (l.type.includes(elements.CONCLUDES)) { } else if (l.type.includes(elements.CONCLUDES)) {
return "#ce34ff"; return "#ce34ff";
} else if (l.type.includes(elements.PREMISEOF)) { } else if (l.type.includes(elements.PREMISEOF)) {
return "#7b6fcc"; 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) { .on('mouseover.tooltip', function (d) {
...@@ -93,7 +103,7 @@ export class Network { ...@@ -93,7 +103,7 @@ export class Network {
.duration(300) .duration(300)
.style("opacity", .8); .style("opacity", .8);
let info = ""; let info = "";
if (d.labels.includes("Issue")) { if (d.labels.includes(elements.ISSUE)) {
info = getIssueTooltipOf(d); info = getIssueTooltipOf(d);
} else if (d.labels.includes(elements.STATEMENT)) { } else if (d.labels.includes(elements.STATEMENT)) {
info = getStatementTooltipOf(d); info = getStatementTooltipOf(d);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment