| 164 | | .data(json.nodes) |
| 165 | | .enter().append("circle") |
| 166 | | .attr("class", "node") |
| 167 | | .attr("r", (NODEHEIGHT / 2)) |
| 168 | | .attr("cx", function(d) { return d.x;} ) |
| 169 | | .attr("cy", function(d) { return d.y; }) |
| 170 | | .style("stroke", function(d) { return '#fafafa'; }) |
| 171 | | .style("stroke-width", function(d) { return '1.5px'; }) |
| 172 | | .style("fill", function(d) { return color(d.group); }) |
| 173 | | .style("cursor", function(d) { return 'pointer'; }); |
| 174 | | //.call(drag); |
| 175 | | |
| 176 | | // 繝弱�繝峨ユ繧ュ繧ケ繝医�菴懈� |
| | 162 | .data(json.nodes) |
| | 163 | .enter().append("circle") |
| | 164 | .attr("class", "node") |
| | 165 | .attr("r", (NODEHEIGHT / 2)) |
| | 166 | .attr("cx", function(d) { return d.x;} ) |
| | 167 | .attr("cy", function(d) { return d.y; }) |
| | 168 | .style("stroke", function(d) { return '#fafafa'; }) |
| | 169 | .style("stroke-width", function(d) { return '1.5px'; }) |
| | 170 | .style("fill", function(d) { return color(d.group); }) |
| | 171 | .style("cursor", function(d) { return 'pointer'; }); |
| | 172 | |
| | 173 | // nodes驟榊�繧呈ク。縺励ヮ繝シ繝峨ユ繧ュ繧ケ繝医�菴懈� |
| 178 | | .data(json.nodes) |
| 179 | | .enter().append("svg:text") |
| 180 | | .attr("class", "tnode") |
| 181 | | .attr("x", function(d) { return d.x; }) |
| 182 | | .attr("y", function(d) { return d.y; }) |
| 183 | | .text(function(d) { |
| 184 | | var nodetext = d.name |
| 185 | | var nodesplit1 = nodetext.split("/"); |
| 186 | | var nodesplit2 = nodesplit1[nodesplit1.length - 1]; |
| 187 | | var nodesplit3 = nodesplit2.split("#"); |
| 188 | | nodetext = nodesplit3[nodesplit3.length - 1]; |
| 189 | | return nodetext; |
| 190 | | }) |
| 191 | | .style("fill", function(d) { return '#000000'; }) |
| 192 | | //.style("stroke", function(d) { return '#000000'; }) |
| 193 | | //.style("stroke-width", function(d) { return '1.5px'; }) |
| 194 | | .style("text-anchor", function(d) { return 'middle'; }) |
| 195 | | .style("pointer-events", "none"); |
| 196 | | //.call(drag); |
| | 175 | .data(json.nodes) |
| | 176 | .enter().append("svg:text") |
| | 177 | .attr("class", "tnode") |
| | 178 | .attr("x", function(d) { return d.x; }) |
| | 179 | .attr("y", function(d) { return d.y; }) |
| | 180 | .text(function(d) { return d.name; }) |
| | 181 | .style("fill", function(d) { return '#000000'; }) |
| | 182 | .style("text-anchor", function(d) { return 'middle'; }) |
| | 183 | .style("pointer-events", "none"); |
| 200 | | .data(json.links) |
| 201 | | .enter().append("svg:text") |
| 202 | | .attr("class", "tlink") |
| 203 | | .attr("x", function(d) { return (json.nodes[d.source].x + json.nodes[d.target].x) / 2; }) |
| 204 | | .attr("y", function(d) { return (json.nodes[d.source].y + json.nodes[d.target].y) / 2; }) |
| 205 | | .style("fill", function(d) { return '#000000'; }) |
| 206 | | .style("text-anchor", function(d) { return 'middle'; }); |
| 207 | | |
| 208 | | // 繝弱�繝峨∈縺ョ繧ッ繝ェ繝�け縺ァ繝代せ謗「邏「縲√ヱ繧ケ荳ュ縺ョ繝ェ繝ウ繧ッ譁�ュ励r陦ィ遉コ |
| | 187 | .data(json.links) |
| | 188 | .enter().append("svg:text") |
| | 189 | .attr("class", "tlink") |
| | 190 | .attr("x", function(d) { return (json.nodes[d.source].x + json.nodes[d.target].x) / 2; }) |
| | 191 | .attr("y", function(d) { return (json.nodes[d.source].y + json.nodes[d.target].y) / 2; }) |
| | 192 | .style("fill", function(d) { return '#000000'; }) |
| | 193 | .style("text-anchor", function(d) { return 'middle'; }); |
| | 194 | |
| | 195 | // 繝弱�繝峨∈縺ョ繧ェ繝ウ繝槭え繧ケ縺ァ繝代せ謗「邏「縲√ヱ繧ケ荳ュ縺ョ繝ェ繝ウ繧ッ譁�ュ励r陦ィ遉コ |
| 213 | | if(!d.isDrag){ |
| 214 | | |
| 215 | | var path = []; |
| 216 | | var pathname = []; |
| 217 | | |
| 218 | | if(d.nodeid != 0){ |
| 219 | | path.push(d.nodeid); |
| 220 | | pathname.push(d.name); |
| 221 | | do{ |
| 222 | | for(var i = 0; i < link.data().length; i++){ |
| 223 | | if(path[(path.length-1)] == link.data()[i].target){ |
| 224 | | path.push(link.data()[i].source); |
| 225 | | pathname.push(link.data()[i].property); |
| 226 | | pathname.push(node.data()[link.data()[i].source].name); |
| 227 | | } |
| | 201 | // 陦ィ遉コ縺吶k繝代せ菫晏ュ倡畑驟榊� |
| | 202 | var path = []; |
| | 203 | // 繝��繝ォ繝√ャ繝励∈縺ョ蜷榊燕陦ィ遉コ逕ィ驟榊� |
| | 204 | var pathname = []; |
| | 205 | |
| | 206 | // 繝ォ繝シ繝医ヮ繝シ繝我サ・螟悶↑繧� |
| | 207 | if(d.nodeid != 0){ |
| | 208 | // 縺セ縺壹が繝ウ繝槭え繧ケ縺輔l縺溘ヮ繝シ繝峨�id縺ィ蜷榊燕繧偵◎繧後◇繧瑚ソス蜉 |
| | 209 | path.push(d.nodeid); |
| | 210 | pathname.push(d.name); |
| | 211 | |
| | 212 | // 繝代せ謗「邏「 |
| | 213 | do{ |
| | 214 | // 繝ェ繝ウ繧ッ縺ョ謨ー縺縺醍ケー繧願ソ斐@ |
| | 215 | for(var i = 0; i < link.data().length; i++){ |
| | 216 | // 迴セ蝨ィ縺ョ譛蠕悟ーセ縺ォ郢九′繧九Μ繝ウ繧ッ縺後≠繧後� |
| | 217 | if(path[(path.length-1)] == link.data()[i].target){ |
| | 218 | // 縺昴�繝ェ繝ウ繧ッ縺ョ繧ス繝シ繧ケ蛛エ繝弱�繝峨�id繧定ソス蜉 |
| | 219 | path.push(link.data()[i].source); |
| | 220 | // 縺昴�繝ェ繝ウ繧ッ縺ョ蜷榊燕縺ィ繧ス繝シ繧ケ蛛エ繝弱�繝峨�蜷榊燕繧定ソス蜉 |
| | 221 | pathname.push(link.data()[i].property); |
| | 222 | pathname.push(node.data()[link.data()[i].source].name); |
| 241 | | /* |
| 242 | | if(d.group > (MAXDEPTH - 2)){ |
| 243 | | document.getElementById("getsparqlbutton").style.display = "block"; |
| 244 | | }else{ |
| 245 | | document.getElementById("getsparqlbutton").style.display = "none"; |
| 246 | | } |
| 247 | | */ |
| 248 | | |
| 249 | | if(d.path == "notend"){ |
| 250 | | document.getElementById("showpath").style.display = "none"; |
| 251 | | }else{ |
| 252 | | |
| 253 | | pathobj = d.path; |
| 254 | | |
| 255 | | var xPosition = parseFloat(d3.select(this).attr("cx")) + parseFloat(d3.select(this).style("stroke-width")) + (NODEHEIGHT * 0.5); |
| 256 | | var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + (NODEHEIGHT * 0.5); |
| 257 | | |
| 258 | | if(xPosition < 0){ |
| 259 | | xPosition = 0; |
| 260 | | } |
| 261 | | if(yPosition < 0){ |
| 262 | | yPosition = 0; |
| 263 | | } |
| 264 | | |
| 265 | | document.getElementById("showpath").style.left = xPosition + "px" |
| 266 | | document.getElementById("showpath").style.top = yPosition + "px" |
| 267 | | document.getElementById("showpath").style.display = "block"; |
| 268 | | } |
| 269 | | |
| 270 | | }else{ |
| 271 | | document.getElementById("showpath").style.display = "none"; |
| 272 | | } |
| 273 | | |
| 274 | | var movey = d.y; |
| 275 | | |
| 276 | | node |
| | 248 | // 繧オ繝シ繝悶Ξ繝�ヨ縺ォ騾√j霑斐☆繝代せ繧ェ繝悶ず繧ァ繧ッ繝医r菫晏ュ� |
| | 249 | pathobj = d.path; |
| | 250 | |
| | 251 | // 繝��繝ォ繝√ャ繝苓。ィ遉コ譎ゅ�蠎ァ讓呻シ医が繝ウ繝槭え繧ケ縺輔l縺溘ヮ繝シ繝峨�讓ェ縺ォ繝懊ち繝ウ縺梧擂繧九h縺��鄂ョ�� |
| | 252 | var xPosition = parseFloat(d3.select(this).attr("cx")) + parseFloat(d3.select(this).style("stroke-width")) + (NODEHEIGHT * 0.5); |
| | 253 | var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + (NODEHEIGHT * 0.5); |
| | 254 | |
| | 255 | // 繝��繝ォ繝√ャ繝励′逕サ髱「螟悶↓蜃コ縺ェ縺�h縺�」懈ュ」 |
| | 256 | if(xPosition < 0){ |
| | 257 | xPosition = 0; |
| | 258 | } |
| | 259 | if(yPosition < 0){ |
| | 260 | yPosition = 0; |
| | 261 | } |
| | 262 | |
| | 263 | // 逕滓�縺励◆蠎ァ讓吶↓繝��繝ォ繝√ャ繝励r陦ィ遉コ |
| | 264 | document.getElementById("showpath").style.left = xPosition + "px" |
| | 265 | document.getElementById("showpath").style.top = yPosition + "px" |
| | 266 | document.getElementById("showpath").style.display = "block"; |
| | 267 | } |
| | 268 | // 繝ォ繝シ繝医ヮ繝シ繝峨□縺」縺溘↑繧� |
| | 269 | }else{ |
| | 270 | // 繝��繝ォ繝√ャ繝励r髱櫁。ィ遉コ |
| | 271 | document.getElementById("showpath").style.display = "none"; |
| | 272 | } |
| | 273 | |
| | 274 | // 繧ェ繝ウ繝槭え繧ケ縺輔l縺溘ヮ繝シ繝峨�鬮倥&縺ォ隕ェ繧貞粋繧上○繧� |
| | 275 | // 蜷医o縺帙k鬮倥&繧剃ソ晏ュ� |
| | 276 | var movey = d.y; |
| | 277 | |
| | 278 | // 蜷�ヮ繝シ繝峨↓蟇セ縺� |
| | 279 | node |
| | 280 | // 霈ェ驛ュ邱壹�濶イ繧定ィュ螳� |
| 633 | | ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| 634 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); |
| | 631 | ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| | 632 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'view' : 'no'}); |
| 642 | | ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| 643 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); |
| | 640 | ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| | 641 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'view' : 'no'}); |
| 648 | | ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| 649 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); |
| | 646 | ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend'}); |
| | 647 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'view' : 'no'}); |