Index: BH13SPARQLBuilder/src/hozo/maptool/jsgui.html
===================================================================
--- BH13SPARQLBuilder/src/hozo/maptool/jsgui.html (revision 92)
+++ BH13SPARQLBuilder/src/hozo/maptool/jsgui.html (revision 92)
@@ -0,0 +1,785 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>SPARQL Builder GUI</title>
+
+<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
+<link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/main.css" />
+<link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/table.css" />
+<link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/popup.css" />
+<style>
+
+.link {
+  stroke: #999;
+  stroke-opacity: .6;
+}
+.tlink {
+  stroke: #999;
+  stroke-opacity: .6;
+}
+
+</style>
+
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
+<script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/jquery-1.10.2.min.js"></script>
+<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
+<!-- 縺薙�荳陦後ｒ蜈･繧後ｋ縺ｨ繧ｿ繝�メ縺ｧ縺ｮ繝峨Λ繝�げ縺悟庄閭ｽ縺ｫ縺ｪ繧�  -->
+<script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/jquery.ui.touch-punch.js" charset="UTF-8"></script>
+<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
+<!--<script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/template.js" charset="UTF-8"></script>-->
+<script>
+<!--
+
+
+// SETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURL
+// SETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURL
+
+// 隱ｭ縺ｿ霎ｼ縺ｿ譎ゅ↓螳溯｡後ゅお繝ｳ繝峨�繧､繝ｳ繝医�繝ｪ繧ｹ繝医ｒ騾壼ｸｸ縺ｮ驟榊�縺ｧ霑斐＆繧後ｋ縺薙→縺ｧ蛻昴ａ縺ｮ驕ｸ謚櫁い縺ｫ謖ｿ蜈･
+var getEndPointsURL = "ep.php";
+
+// 繧ｨ繝ｳ繝峨�繧､繝ｳ繝医′驕ｸ謚槭＆繧後◆繧峨◎縺ｮURL繧弾p縺ｨ縺�≧蜷榊燕縺ｧ騾∽ｿ｡縲√け繝ｩ繧ｹ繝ｪ繧ｹ繝医ｒ騾壼ｸｸ縺ｮ驟榊�縺ｧ霑斐＆繧後ｋ縺薙→縺ｧ繧ｯ繝ｩ繧ｹ縺ｮ驕ｸ謚櫁い縺ｫ謖ｿ蜈･
+var getClassListURL = "cl.php";
+
+// 繧ｯ繝ｩ繧ｹ莠後▽縺碁∈謚槭＆繧後◆繧峨◎縺ｮ繧ｯ繝ｩ繧ｹ蜷阪ｒstartclass縲‘ndclass縺ｨ縺�≧蜷榊燕縺ｧ縺昴ｌ縺槭ｌ騾∽ｿ｡縲√◎縺ｮ莠後▽繧堤ｵ舌�繝代せ縺ｮ繝ｪ繧ｹ繝医ｒJSON蠖｢蠑上�繝�く繧ｹ繝医〒霑斐＆繧後ｋ縺薙→縺ｧ縺昴ｌ繧偵げ繝ｩ繝輔↓謠冗判
+var getPathListURL = "node.php";
+
+// 繝代せ縺碁∈謚槭＆繧後◆繧泳sonpath縺ｨ縺�≧蜷榊燕縺ｧ繝代せ繧帝壼ｸｸ縺ｮ驟榊�縺ｧ騾∽ｿ｡縲ヾPARQL繧ｯ繧ｨ繝ｪ繧偵ユ繧ｭ繧ｹ繝医〒蜿励￠蜿悶ｊ繝�く繧ｹ繝医お繝ｪ繧｢縺ｫ謖ｿ蜈･
+var getSPARQLURL = "gs.php";
+
+// 縺ｧ縺阪≠縺後▲縺欖PARQL繧帝∽ｿ｡縺吶ｋURL�域悴螳溯｣�ｼ�
+
+// SETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURL
+// SETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURL
+
+
+
+// 謠冗判鬆伜沺縺ｮ繧ｵ繧､繧ｺ
+var WIDTH = window.innerWidth * 3 / 4;
+var HEIGHT = window.innerWidth * 3 / 4;
+var pathname = [];
+var MAXDEPTH = 0;
+var jsontext = "";
+
+// 髢九＞縺溘ｉview_map繝｡繧ｽ繝�ラ繧貞他縺ｶ
+$(window).load(function() {
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+	var rleft = (window.innerWidth * 3 / 4) + "px";
+	var rwidth = (window.innerWidth / 4) - 50 + "px";
+	document.getElementById("right").style.left = rleft;
+	document.getElementById("right").style.width = rwidth;
+	document.endpoint.inputendpoint.style.width = rwidth;
+	document.endpoint.selectendpoint.style.width = rwidth;
+	document.seclass.startclass.style.width = rwidth;
+	document.seclass.endclass.style.width = rwidth;
+	document.path.sparql.style.width = rwidth;
+
+	$.ajax({
+		type: "GET",
+		url : getEndPointsURL,
+		dataType: 'json',
+		success : function(data) {
+			setEndpoints(data);
+		},
+		error : function(XMLHttpRequest, textStatus, errorThrown) {
+			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+		}
+	});
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+	//setEndpoints(jsonep);
+	// view_map();
+});
+
+// 謠冗判蜃ｦ逅�
+function view_map(){
+
+	// 豺ｱ縺輔ｒ蜿門ｾ励∵�遉ｺ逧�↓謨ｰ蛟､蛹�
+	var dep = 0;//$('#map_depth').val();
+	//dep =  parseInt(dep, 10);
+
+//http://jsdo.it/_shimizu/hszt
+//http://www.h2.dion.ne.jp/~defghi/svgMemo/svgMemo_19.htm
+
+	// 豺ｱ縺輔ｒ蠑墓焚縺ｨ縺励※貂｡縺励◆make_testdata繝｡繧ｽ繝�ラ縺ｮ邨先棡繧貞叙蠕�
+	var json = make_testdata(dep);
+
+	// 蜃ｺ譚･荳翫′縺｣縺溽ｵ先棡繧呈ｸ｡縺励※繝槭ャ繝嶺ｸ翫�繝ｭ繧ｱ繝ｼ繧ｷ繝ｧ繝ｳ繧偵そ繝�ヨ
+	set_map_location(0, json['nodes'], json['links']);
+
+	var width = WIDTH,縲height = HEIGHT;
+
+	// 繧ｫ繝ｩ繝ｼ繧貞叙蠕暦ｼ�
+	var color = d3.scale.category20();
+
+	// svg縺悟ｭ伜惠縺吶ｋ縺ｪ繧峨�蜑企勁��
+	if (d3.select("#graph").select("svg")) {
+	        d3.select("#graph").select("svg").remove();
+	}
+
+	// 繧上°繧峨〓
+	var drag = d3.behavior.drag().on("drag", function(d,i) {
+	    d.x += d3.event.dx
+	    d.y += d3.event.dy
+
+	    d. isDrag = true;
+	    redraw();
+	});
+
+	var svg = d3.select("#graph").append("svg")
+	    .attr("width", width)
+	    .attr("height", height);
+
+	var mc = new Array();
+	for (var i=0; i<dep; i++){
+		mc.push((dep-i) * CIRCLE_SIZE);
+	}
+
+	var mapCircle = svg.selectAll(".mapCircle")
+	.data(mc)
+	.enter().append("circle")
+    .attr("class", "map")
+    .attr("r", function(d) { return d;})
+    .attr("cx", function(d) { return (WIDTH/2);} )
+    .attr("cy",  function(d) { return (HEIGHT/2); })
+	.style("stroke-dasharray", ("5, 5"))
+	.style("fill", function(d) { return '#eeeeee'; })
+	.style("stroke", function(d) { return '#000000'; })
+	.style("opacity", 0.3);
+
+	var link = svg.selectAll(".link")
+	.data(json.links)
+	.enter().append("line")
+	.attr("class", "link")
+	.style("cursor", function(d) { return 'pointer'; })
+	.style("stroke-width", function(d) { return Math.sqrt(d.value); });
+
+  	var arrowname = new Array();
+	if ($('#arrow_end').val() == 'true'){ // target譁ｹ蜷代↓arrow縺ゅｊ
+		arrowname.push('adr');
+		arrowname.push('adl');
+	}
+
+	if ($('#arrow_start').val() == 'true'){ // source譁ｹ蜷代↓arrow縺ゅｊ
+		arrowname.push('asr');
+		arrowname.push('asl');
+	}
+
+	var arrows = [];
+
+	for (var i=0; i<arrowname.length; i++){
+		arrows[arrowname[i]] = svg.selectAll("arrow.link")
+		.data(json.links)
+		.enter().append("line")
+		.attr("class", "link");
+	}
+
+	var tlink = svg.selectAll("text.link")
+	.data(json.links)
+	.enter().append("svg:text")
+	.attr("class", "tlink")
+	.attr("x", function(d) {
+		return (json.nodes[d.source].x + json.nodes[d.target].x) / 2;
+	})
+	.attr("y", function(d) { return (json.nodes[d.source].y + json.nodes[d.target].y) / 2; })
+	.text(function(d) { return d.property; }) // TODO 繝ｪ繝ｳ繧ｯ譁�ｭ�
+	.style("fill", function(d) { return '#ffffff'; })
+	.style("stroke", function(d) { return '#000000'; })
+	.style("text-anchor", function(d) { return 'middle'; });
+
+	var node = svg.selectAll(".node")
+	.data(json.nodes)
+	.enter().append("circle")
+	.attr("class", "node")
+	.attr("r", 20)
+	.attr("cx", function(d) { return d.x;} )
+	.attr("cy",  function(d) { return d.y; })
+	.style("stroke", function(d) { return '#ffffff'; })
+	.style("stroke-width", function(d) { return '1.5px'; })
+	.style("fill", function(d) { return color(d.group); })
+	.style("cursor", function(d) { return 'pointer'; })
+	.call(drag);
+
+	var tnode = svg.selectAll("text.node")
+	.data(json.nodes)
+	.enter().append("svg:text")
+	.attr("class", "tnode")
+	.attr("x", function(d) { return d.x; })
+	.attr("y", function(d) { return d.y; })
+	.text(function(d) { return d.name; })
+	.style("fill", function(d) { return '#000000'; })
+	.style("stroke", function(d) { return '#000000'; })
+	.style("stroke-width", function(d) { return '1.5px'; })
+	.style("text-anchor", function(d) { return 'middle'; })
+	.call(drag);
+
+	/*
+	node.append("title")
+	.text(function(d) { return d.name; });
+	*/
+
+	// 繝ｪ繝ｳ繧ｯ繧ｯ繝ｪ繝�け縺ｧ驕ｸ謚�
+	link.on("click", function(d){
+		d3.selectAll(".link").style("stroke-width", function(d) { return Math.sqrt(d.value); });
+		d3.select(this).style("stroke-width", function(d) { return 10; });
+	});
+
+	// 繝弱�繝峨け繝ｪ繝�け縺ｧ驕ｸ謚�
+	node.on("mouseover", function(d){
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+		var path = [];
+		pathname = [];
+		path.push(d.nodeid);
+		pathname.push(d.name);
+		do{
+			for(var i = 0; i < link.data().length; i++){
+				if(path[(path.length-1)] == link.data()[i].target){
+					path.push(link.data()[i].source);
+					pathname.push(link.data()[i].property);
+					pathname.push(node.data()[link.data()[i].source].name);
+					//alert(tnode.data()[link.data()[i].source].fill);//style("stroke", function(d) { return '#ff0000'; });
+				}
+			}
+		}while(path[(path.length-1)] != 0);
+		var resultText = "";
+		for (var i = 0;i < pathname.length; i++){
+			resultText = resultText + pathname[i] + "<br><br>";
+		}
+		document.getElementById("selectpath").innerHTML=(resultText);
+		document.getElementById("sendpath").style.display = "block";
+
+	    if (!d. isDrag){
+			d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; });
+			d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; });
+			d3.select(this).style("stroke-width", function(d) { return 2; });
+			d3.select(this).style("stroke", function(d) { return '#ff0000'; });
+	    }
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+	    d.isDrag = false;
+	});
+
+	// 逕ｻ髱｢繧ｯ繝ｪ繝�け縺ｧ繝ｪ繝ｳ繧ｯ驕ｸ謚櫁ｧ｣髯､
+	mapCircle.on("click", function(d){
+		d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; });
+		d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; });
+		d3.selectAll(".link").style("stroke-width", function(d) { return Math.sqrt(d.value); });
+	});
+
+	// 蝓ｺ譛ｬ繝吶け繝医Ν邂怜�
+	var vec = function(sx, sy, dx, dy){
+		var vx = (dx - sx);
+		var vy = (dy - sy);
+		var dist = Math.sqrt(Math.pow(vx, 2) + Math.pow(vy, 2));
+		var ret = [];
+		ret.x = vx / dist;
+		ret.y = vy / dist;
+
+		return ret;
+	};
+
+	var redraw = function (){
+		link
+		.attr("x1", function(d) {return node.data()[d.source].x;})
+		.attr("y1", function(d) {return node.data()[d.source].y;})
+		.attr("x2", function(d) {return node.data()[d.target].x;})
+		.attr("y2", function(d) {return node.data()[d.target].y;});
+
+		tlink
+		.attr("x", function(d) {return (node.data()[d.source].x + node.data()[d.target].x) / 2;})
+		.attr("y", function(d) {return (node.data()[d.source].y + node.data()[d.target].y) / 2;});
+
+		node
+		.attr("cx", function(d) {return d.x;})
+		.attr("cy", function(d) {return d.y;});
+
+		tnode
+		.attr("x", function(d) {return d.x;})
+		.attr("y", function(d) {return d.y;});
+
+		if (arrows['adr'] != undefined){
+			arrows['adr']
+		    .attr("x1", function(d) {return (node.data()[d.target].x - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 30);})
+	        .attr("y1", function(d) {return (node.data()[d.target].y - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 30);})
+	        .attr("x2", function(d) {return node.data()[d.target].x;})
+	        .attr("y2", function(d) {return node.data()[d.target].y;})
+	        .attr("transform", function(d) {
+	        	return 'rotate(25, '
+	        			+ (node.data()[d.target].x - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 20) + ', '
+	        			+ (node.data()[d.target].y - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 20) + ')';});
+		    }
+
+		if (arrows['adl'] != undefined){
+		    arrows['adl']
+		    .attr("x1", function(d) {return (node.data()[d.target].x - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 30);})
+	        .attr("y1", function(d) {return (node.data()[d.target].y - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 30);})
+	        .attr("x2", function(d) {return node.data()[d.target].x;})
+	        .attr("y2", function(d) {return node.data()[d.target].y;})
+	        .attr("transform", function(d) {
+	        	return 'rotate(-25, '
+				+ (node.data()[d.target].x - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 20) + ', '
+				+ (node.data()[d.target].y - vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 20) + ')';});
+		}
+
+		if (arrows['asr'] != undefined){
+		    arrows['asr']
+		    .attr("x1", function(d) {return node.data()[d.source].x;})
+		    .attr("y1", function(d) {return node.data()[d.source].y;})
+		    .attr("x2", function(d) {return (node.data()[d.source].x + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 30);})
+		    .attr("y2", function(d) {return (node.data()[d.source].y + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 30);})
+	        .attr("transform", function(d) {
+	        	return 'rotate(25, '
+	        			+ (node.data()[d.source].x + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 20) + ', '
+	        			+ (node.data()[d.source].y + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 20) + ')';});
+		}
+
+		if (arrows['asl'] != undefined){
+		    arrows['asl']
+		    .attr("x1", function(d) {return node.data()[d.source].x;})
+	        .attr("y1", function(d) {return node.data()[d.source].y;})
+	        .attr("x2", function(d) {return (node.data()[d.source].x + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 30);})
+	        .attr("y2", function(d) {return (node.data()[d.source].y + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 30);})
+	        .attr("transform", function(d) {
+	        	return 'rotate(-25, '
+				+ (node.data()[d.source].x + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).x * 20) + ', '
+				+ (node.data()[d.source].y + vec(node.data()[d.source].x, node.data()[d.source].y, node.data()[d.target].x, node.data()[d.target].y).y * 20) + ')';});
+	    }
+	};
+/*
+	svg.on("mousemove", function() {
+		redraw();
+	});
+*/
+	redraw();
+}
+
+// 繝�せ繝医ョ繝ｼ繧ｿ縺ｮ菴懈�繝｡繧ｽ繝�ラ
+function make_testdata(tdepth, ret, parent, depth){
+	// ret縲‥epth縺梧悴螳夂ｾｩ縺ｪ繧峨�螳夂ｾｩ縺励※莉｣蜈･
+	if (ret == undefined){
+		ret = new Object();
+		ret['nodes'] = new Array();
+		ret['links'] = new Array();
+	}
+	/*
+	if (depth == undefined){
+		depth = 0;
+	}
+
+	// name縺ｫaaaa縲“roup縺ｫ豺ｱ縺輔』縺ｨy縺ｫ蟷�→鬮倥＆縺ｮ蜊雁�繧偵そ繝�ヨ縺溶odes驟榊�縺ｫ霑ｽ蜉
+	ret['nodes'].push({'name':'aaaa', 'group': depth, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	// 迴ｾ蝨ｨ縺ｮnodes縺ｮ謨ｰ縺ｫ蠢懊§縺櫑ndex繧堤函謌�
+	var newIndex = ret['nodes'].length-1;
+
+	// parent縺梧悴螳夂ｾｩ縺ｧ縺ｪ縺代ｌ縺ｰlinks驟榊�縺ｫsource繧恥arent縲》arget繧地ewIndex縺ｨ螳夂ｾｩ縺励※莉｣蜈･
+	if (parent != undefined){
+		ret['links'].push({'source':parent, 'target':newIndex, 'value':5});
+	}
+
+	// 謖�ｮ壹＆繧後◆豺ｱ縺輔↓閾ｳ縺｣縺ｦ縺�↑縺代ｌ縺ｰ
+	if (tdepth > depth){
+		// 繝ｩ繝ｳ繝繝縺ｧ譛螟ｧ蝗帙▽縺ｾ縺ｧ縺ｮ謨ｰ繧堤函謌舌∝�蠎ｦ縺薙�繝｡繧ｽ繝�ラ繧貞他縺ｶ
+		// 縺薙％縺碁�ｬ｡蜻ｼ縺ｰ繧後※荳谿ｵ縺ｮ豺ｱ縺輔＃縺ｨ縺ｫ譛螟ｧ蝗帙▽縺ｮ蟄舌ｒ謖√▽繝ｩ繝ｳ繝繝縺ｮ讒矩縺後〒縺阪≠縺後ｋ
+		var c = Math.random()*4;
+		for (var i=0; i<c; i++){
+			ret = make_testdata(tdepth, ret, newIndex, depth+1);
+		}
+	}
+	*/
+
+	var obj = JSON.parse(jsontext);
+
+	// obj繝医ャ繝鈴嚴螻､縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
+	for(var i = 0; i < obj['paths'].length; i++){
+		if(i == 0){
+			// 蛻晏屓縺縺代Ν繝ｼ繝医ヮ繝ｼ繝峨ｒ繝励ャ繧ｷ繝･
+			ret['nodes'].push({'name':obj['paths'][0]['startClassURI'], 'group': 0, 'x':50, 'y':50, 'nodeid':ret['nodes'].length});
+		}
+		// 蜈医↓source縺ｫ0�医Ν繝ｼ繝茨ｼ峨ｒ莉｣蜈･
+		var source = 0;
+		// 蜈ｱ騾壹Ν繝ｼ繝亥愛螳壹ｒtrue縺ｫ
+		var isCommon = true;
+
+		// classLinks縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
+		for(var j = 0;j < obj['paths'][i]['classLinks'].length; j++){
+
+			if(MAXDEPTH < j+1){
+				MAXDEPTH = j+1;
+			}
+
+			// 縺薙％縺ｾ縺ｧ蜈ｱ騾壹Ν繝ｼ繝医↑繧�
+			if(isCommon){
+				// 莉雁屓繧ょ�騾壹°遒ｺ隱阪☆繧九◆繧√�繝輔Λ繧ｰ
+				var isCommonNow = false;
+				// nodes驟榊�縺ｫ蜷後§linkedClass縺梧里縺ｫ縺ゅｋ縺狗｢ｺ隱�
+				var targets = [];
+				for(var k = 0; k < ret['nodes'].length; k++){
+					// 蜷碁嚴螻､縺九▽蜷後§蜷榊燕縺ｮ繧ゅ�縺後≠縺｣縺溘ｉtargets驟榊�縺ｫ逡ｪ蜿ｷ繧定ｿｽ蜉
+					if(ret['nodes'][k]['group'] == (j+1) && obj['paths'][i]['classLinks'][j]['linkedClassURI'] == ret['nodes'][k]['name']){
+						targets.push(k);
+					}
+				}
+
+				// 譌｢縺ｫ縺ゅ▲縺溷ｴ蜷医�links驟榊�縺ｫ蜷後§link縺悟ｭ伜惠縺吶ｋ縺狗｢ｺ隱�
+				if(targets.length != 0){
+					// 蜈医⊇縺ｩ隕九▽縺代◆targets縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
+					for(var l = 0; l <targets.length; l++){
+						// links驟榊�縺ｫ蜈ｨ縺丞酔縺俶擅莉ｶ縺ｮ繧ゅ�縺後≠繧九°遒ｺ隱�
+						for(var m = 0; m < ret['links'].length; m++){
+							// 縺ゅ▲縺溷ｴ蜷井ｻ雁屓縺ｮ繧ゅ�縺ｯ霑ｽ蜉縺帙★source繧呈峩譁ｰ縺励※谺｡縺ｸ
+							if(ret['links'][m]['source'] == source && ret['links'][m]['target'] == targets[l] && ret['links'][m]['property'] == obj['paths'][i]['classLinks'][j]['propertyURI'] && !isCommonNow){
+								// 蜈ｱ騾壹Ν繝ｼ繝医ヵ繝ｩ繧ｰ繧偵が繝ｳ
+								isCommonNow = true;
+								source = targets[l];
+							}
+						}
+					}
+
+					// 蜷дarget繧堤｢ｺ隱阪＠縺ｦ蜈ｱ騾壹Ν繝ｼ繝医〒縺ｯ縺ｪ縺九▲縺溷ｴ蜷域眠隕剰ｿｽ蜉
+					if(!isCommonNow){
+						isCommon = false;
+						ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':(WIDTH/2), 'y':(HEIGHT/2), 'nodeid':ret['nodes'].length});
+						ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI']});
+						source = ret['nodes'].length - 1;
+					}
+
+				// 縺ｪ縺九▲縺溷ｴ蜷医�蛻･譚｡莉ｶ縺ｪ縺ｮ縺ｧ譁ｰ隕剰ｿｽ蜉縺励※谺｡縺ｸ
+				}else{
+
+					isCommon = false;
+					ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':(WIDTH/2), 'y':(HEIGHT/2), 'nodeid':ret['nodes'].length});
+					ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI']});
+					source = ret['nodes'].length - 1;
+				}
+			// 譌｢縺ｫ蜈ｱ騾壹Ν繝ｼ繝医〒縺ｪ縺�↑繧画眠隕剰ｿｽ蜉縺励※谺｡縺ｸ
+			}else{
+				ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':(WIDTH/2), 'y':(HEIGHT/2), 'nodeid':ret['nodes'].length});
+				ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI']});
+				source = ret['nodes'].length - 1;
+			}
+
+		}
+
+	}
+
+	/*
+
+	ret['nodes'].push({'name':jsontoobj['startClassURI'], 'group': 0, 'x':50, 'y':50});
+	ret['nodes'].push({'name':jsontoobj['classLinks'][0]['linkedClassURI'], 'group': 1, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':jsontoobj['classLinks'][1]['linkedClassURI'], 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+
+	ret['links'].push({'source':0, 'target':1, 'value':5, 'property':jsontoobj['classLinks'][0]['propertyURI']});
+	ret['links'].push({'source':1, 'target':2, 'value':5, 'property':jsontoobj['classLinks'][1]['propertyURI']});
+
+	ret['nodes'].push({'name':'root', 'group': 0, 'x':50, 'y':50});
+	ret['nodes'].push({'name':'a', 'group': 1, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'b', 'group': 1, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c', 'group': 1, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'a1', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'a2', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'b1', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c1', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c2', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c3', 'group': 2, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'a11', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'a12', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'a21', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c21', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c21', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['nodes'].push({'name':'c23', 'group': 3, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+
+	ret['links'].push({'source':0, 'target':1, 'value':5});
+	ret['links'].push({'source':0, 'target':2, 'value':5});
+	ret['links'].push({'source':0, 'target':3, 'value':5});
+	ret['links'].push({'source':1, 'target':4, 'value':5});
+	ret['links'].push({'source':1, 'target':5, 'value':5});
+	ret['links'].push({'source':2, 'target':6, 'value':5});
+	ret['links'].push({'source':3, 'target':7, 'value':5});
+	ret['links'].push({'source':3, 'target':8, 'value':5});
+	ret['links'].push({'source':3, 'target':9, 'value':5});
+	ret['links'].push({'source':4, 'target':10, 'value':5});
+	ret['links'].push({'source':4, 'target':11, 'value':5});
+	ret['links'].push({'source':5, 'target':12, 'value':5});
+	ret['links'].push({'source':8, 'target':13, 'value':5});
+	ret['links'].push({'source':8, 'target':14, 'value':5});
+	ret['links'].push({'source':8, 'target':15, 'value':5});
+	*/
+
+	// 縺ｧ縺阪◆邨先棡繧定ｿ斐☆
+	return ret;
+}
+
+function make_json(data){
+
+	var ret = new Object();
+	ret['nodes'] = new Array();
+	ret['links'] = new Array();
+
+	for (var d=0; d<data.length; d++){
+		var label = data[d].label;
+		var session = data[d].p;
+		var link = data[d].o;
+
+		var centerIndex = get_item_index(ret['nodes'], label, 1);
+		var sessionIndex = get_item_index(ret['nodes'], get_resource_label(session), 2);
+		var linkIndex = get_item_index(ret['nodes'], get_resource_label(link), d + 3);
+
+		add_link(ret['links'], centerIndex, sessionIndex, 10);
+		add_link(ret['links'], sessionIndex, linkIndex, 1);
+	}
+
+	set_map_location(0, ret['nodes'], ret['links']);
+
+
+	return ret;
+}
+
+function get_resource_label(resource){
+	var i = resource.lastIndexOf('/');
+	var ret = resource;
+	if (i > 0){
+		ret = resource.substring(i + '/'.length);
+	}
+	ret = ret.replace(/%20/g, " ");
+	return ret;
+}
+
+function get_item_index(item, label, group){
+	for (var i=0; i<item.length; i++){
+		if (item[i].name == label){
+			return i;
+		}
+	}
+
+	// TODO 蠎ｧ讓呎ｱｺ螳壹Ο繧ｸ繝�け繧剃ｽ懈�縺吶ｋ
+	item.push({'name':label, 'group': group, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+
+	return item.length-1;
+}
+
+function add_link(links, source, dest, value){
+	for (var i=0; i<links.length; i++){
+		if (links[i].source == source && links[i].target == dest){
+			return;
+		}
+	}
+	links.push({'source':source, 'target':dest, 'value':value});
+
+	return;
+}
+
+// 逕滓�縺輔ｌ縺溘ョ繝ｼ繧ｿ縺ｮ螳滄圀縺ｮ繝ｭ繧ｱ繝ｼ繧ｷ繝ｧ繝ｳ繧定ｨ育ｮ励☆繧九Γ繧ｽ繝�ラ�亥�蝗槭�myNodeIndex縺�縲］odes縺ｫ逕滓�縺輔ｌ縺殤odes驟榊�縲〕inks縺ｫ逕滓�縺輔ｌ縺殕inks驟榊�縺梧ｸ｡縺輔ｌ繧具ｼ�
+function set_map_location(myNodeIndex, nodes, links, depth, fromAngle, toAngle){
+
+	// depth縺梧悴螳夂ｾｩ縺ｪ繧峨�0繧偵そ繝�ヨ
+	if (depth == undefined){
+		depth = 0;
+	}
+	// fromAngle縺梧悴螳夂ｾｩ縺ｪ繧峨�0繧偵そ繝�ヨ
+	if (fromAngle == undefined){
+		fromAngle = 0;
+	}
+	// toAngle縺梧悴螳夂ｾｩ縺ｪ繧峨�1繧偵そ繝�ヨ
+	if (toAngle == undefined){
+		toAngle = 1;
+	}
+
+	// 蜷�ｨｮ蛻晄悄蛹�
+	var children = undefined;
+	var parent = undefined;
+	var parentsChildren = undefined;
+
+	/*
+	ret['nodes'].push({'name':'aaaa', 'group': depth, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
+	ret['links'].push({'source':parent, 'target':newIndex, 'value':5});
+	*/
+
+	// links驟榊�縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
+	for (var i=0; i<links.length; i++){
+		// 縺昴�links縺ｮtarget縺稽yNodeIndex縺ｪ繧英arent繧偵そ繝�ヨ
+		if (links[i].target == myNodeIndex){
+			parent = links[i].source;
+		}
+	}
+
+	// parent縺瑚ｦ九▽縺九▲縺ｦ縺�◆縺ｪ繧峨�
+	if (parent != undefined){
+		// parent縺ｨlinks繧呈ｸ｡縺揚et_children繝｡繧ｽ繝�ラ繧貞ｮ溯｡�
+		parentsChildren = get_children(parent, links);
+	}
+
+
+	var x = (WIDTH/2) + depth * (WIDTH / (MAXDEPTH * 2 + 1)) * Math.sin(2 * 3.14 * ((toAngle + fromAngle) / 2));
+	var y = (HEIGHT/2) + depth * (HEIGHT / (MAXDEPTH * 2 + 1)) * Math.cos(2 * 3.14 * ((toAngle + fromAngle) / 2));
+	nodes[myNodeIndex].x = x;
+	nodes[myNodeIndex].y = y;
+
+
+
+	children = get_children(myNodeIndex, links);
+
+	for (var i=0; i<children.length; i++){
+		var child = children[i];
+		set_map_location(child, nodes, links, depth+1, fromAngle + ((toAngle - fromAngle) / children.length) * i, fromAngle + ((toAngle - fromAngle) / children.length) * (i+1));
+	}
+
+}
+
+// 謖�ｮ壹＆繧後◆隕ｪ縺梧戟縺､蟄舌ｒ霑斐☆
+function get_children(index, links){
+	var children = new Array();
+	// links縺ｮ謨ｰ縺縺醍｢ｺ隱阪＠縺ｪ縺後ｉ
+	for (var i=0; i<links.length; i++){
+		// 隕ｪ縺梧ｸ｡縺輔ｌ縺溯ｦｪ縺ｨ荳閾ｴ縺吶ｋ譎ゅ�蟄舌ｒ霑ｽ蜉
+		if (links[i].source == index){
+			children.push(links[i].target);
+		}
+	}
+	return children;
+}
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+function setEndpoints(ep){
+	for (var i = 0; i < ep.length; i++){
+		$("*[name=selectendpoint]").append('<option value="' + ep[i] + '">' + ep[i]);
+	}
+}
+
+function setEndpoint(){
+
+	var sel = $("*[name=selectendpoint]").val();
+
+	if(sel == "input"){
+		sel = $("*[name=inputendpoint]").val();
+		alert(sel);
+	}
+
+	$.ajax({
+		type: "GET",
+		url : getClassListURL,
+		data: {
+		    ep: sel
+  },
+		dataType: 'json',
+		success : function(epclass) {
+			$("*[name=startclass] option").remove();
+			$("*[name=endclass] option").remove();
+			for (var i = 0; i < epclass.length; i++){
+				$("*[name=startclass]").append('<option value="' + epclass[i] + '">' + epclass[i]);
+				$("*[name=endclass]").append('<option value="' + epclass[i] + '">' + epclass[i]);
+			}
+		},
+		error : function(XMLHttpRequest, textStatus, errorThrown) {
+			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+		}
+	});
+	document.getElementById("seclass").style.display = "block";
+}
+
+function setSEClass(){
+
+	MAXDEPTH = 0;
+
+	document.getElementById("selectpath").innerHTML = "";
+
+	var selstart = $("*[name=startclass]").val();
+	var selend = $("*[name=endclass]").val();
+
+	$.ajax({
+		type: "GET",
+		url : getPathListURL,
+		data: {
+		    startclass: selstart,
+		    endclass: selend
+  },
+		dataType: 'text',
+		success : function(nodes) {
+			jsontext = nodes;
+			view_map();
+		},
+		error : function(XMLHttpRequest, textStatus, errorThrown) {
+			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+		}
+	});
+}
+
+function getSPARQL(){
+
+	var selectpath = JSON.stringify(pathname);
+	//document.getElementById("selectpath").innerHTML=(resultText);
+
+	$.ajax({
+		type: "GET",
+		url : getSPARQLURL,
+		data: {
+		    jsonpath: selectpath
+  },
+		dataType: 'text',
+		success : function(sparql) {
+			document.path.sparql.value = sparql;
+		},
+		error : function(XMLHttpRequest, textStatus, errorThrown) {
+			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+		}
+	});
+}
+
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+// ZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZNZN
+
+-->
+
+</script>
+</head>
+<body>
+
+<div id="graph">
+</div>
+<div id="right" style="position: absolute; top:0px; left:0px; width:200px; padding: 20px; background-color: #cccccc;">
+
+	<div id="endpoint">
+		<form name="endpoint">
+			<input type="text" style="width: 200px;" name="inputendpoint">
+			<select size=1 name="selectendpoint" style="width: 200px;">
+				<option value="input">Textbox
+			</select>
+			<input type="button" name="setendpoint" value="SetEndPoint" onClick="setEndpoint()">
+		</form>
+	</div>
+	<div id="seclass" style="margin: 15px 0px; display: none;">
+		<form name="seclass">
+			StartClass<br>
+			<select size=1 name="startclass" style="width: 200px;">
+			</select>
+			EndClass<br>
+			<select size=1 name="endclass" style="width: 200px;">
+			</select>
+			<input type="button" name="setclass" value="SetClass" onClick="setSEClass()">
+		</form>
+		<hr>
+	</div>
+	<div id="selectpath" style="word-wrap: break-word;">
+	</div>
+	<div id="sendpath" style="display: none;">
+		<hr>
+		<form name="path">
+			<input type="button" name="getsparql" value="Get SPARQL" onClick="getSPARQL()">
+			<textarea name="sparql" style="width: 200px; height: 200px;"></textarea><br><br>
+			<input type="button" name="sendsparql" value="Send SPARQL" onClick="sendSPARQL()">
+		</form>
+	</div>
+</div>
+</body>
+</html>
