664 | | }); |
665 | | |
666 | | // 縺薙%縺セ縺ァ縺ョ險ュ螳壹r蜈�↓蜀肴緒逕サ |
667 | | redraw(); |
668 | | |
669 | | // 繝弱�繝峨∈縺ョ繧ッ繝ェ繝�け縺ァ驕ク謚槫崋螳壼喧�亥所縺ウ謚倥j逡ウ縺ソ蜃ヲ逅�シ� |
670 | | }).on("click", function(d){ |
671 | | |
672 | | // 蜷�ヮ繝シ繝峨↓蟇セ縺� |
673 | | node |
674 | | // 霈ェ驛ュ邱壹�蛻、螳� |
675 | | .style("stroke", function(d) { |
676 | | // 繝�ヵ繧ゥ繝ォ繝医�濶イ繧偵そ繝�ヨ |
677 | | var strokecolor = "#fafafa" |
678 | | // 陦ィ遉コ繝輔Λ繧ー縺後が繝ウ繝槭え繧ケ荳ュ繝サ蝗コ螳壻クュ繝サ遘サ蜍穂クュ�磯∈謚槭&繧後※縺�k繝弱�繝会シ峨↑繧峨� |
679 | | if(d.view == "now" || d.view == "clicked" || d.view == "moved"){ |
680 | | // 濶イ繧定オ、縺ォ |
681 | | strokecolor = "#ffaaaa" |
682 | | // 陦ィ遉コ繝輔Λ繧ー繧貞崋螳壻クュ縺ォ |
683 | | d.view = "clicked"; |
684 | | } |
685 | | // 縺薙%縺セ縺ァ縺ァ縺ァ縺阪◆濶イ繧定ソ斐☆ |
686 | | return strokecolor; |
687 | | }); |
688 | | |
689 | | // 蜷�Μ繝ウ繧ッ縺ォ蟇セ縺� |
690 | | tlink |
691 | | // 繝�く繧ケ繝郁。ィ遉コ蛻、螳� |
692 | | .text(function(d) { |
693 | | // 繝�ヵ繧ゥ繝ォ繝医〒遨コ縺ォ |
694 | | var linktext = ""; |
695 | | // 陦ィ遉コ繝輔Λ繧ー縺檎樟蝨ィ陦ィ遉コ荳ュ縺セ縺溘�蝗コ螳壼喧貂医∩縺ェ繧峨��医°縺、謚倥j逡ウ縺ソ荳ュ縺ァ縺ェ縺代l縺ー�� |
696 | | if((d.view == "now" || d.view == "fix") && (node.data()[d.target].view != "hide")){ |
697 | | // 繝ェ繝ウ繧ッ繝�く繧ケ繝医↓繝励Ο繝代ユ繧」縺ョ蛟、繧偵そ繝�ヨ |
698 | | linktext = d.property |
699 | | // 陦ィ遉コ繝輔Λ繧ー繧貞崋螳壻クュ縺ォ |
700 | | d.view = "fix"; |
701 | | } |
702 | | // 繝�く繧ケ繝医r霑斐☆ |
703 | | return linktext; |
704 | | }); |
705 | | |
706 | | // 縺薙%縺セ縺ァ縺ョ蜃ヲ逅�オ先棡繧貞�縺ォ蜀肴緒逕サ |
707 | | redraw(); |
708 | | |
709 | | }); |
710 | | |
711 | | // 蜀肴緒逕サ髢「謨ー |
712 | | var redraw = function (duration){ |
713 | | |
714 | | // 縺九¢繧区凾髢薙′譛ェ謖�ョ壹↑繧峨� |
715 | | if(duration == undefined){ |
716 | | // 0.5遘偵°縺代※繧「繝九Γ繝シ繧キ繝ァ繝ウ |
717 | | duration = 500; |
718 | | } |
719 | | |
720 | | // 蜷�Μ繝ウ繧ッ縺ォ縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ |
721 | | link |
722 | | .transition() |
723 | | .duration(duration) |
724 | | .attr("x1", function(d) {return node.data()[d.source].x;}) |
725 | | .attr("y1", function(d) {return node.data()[d.source].y;}) |
726 | | .attr("x2", function(d) {return node.data()[d.target].x;}) |
727 | | .attr("y2", function(d) {return node.data()[d.target].y;}); |
728 | | |
729 | | // 蜷�ヮ繝シ繝峨↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ�医°縺、謚倥j縺溘◆縺セ繧御クュ縺ョ蝣エ蜷医�謠冗判蛻�イ仙�逅�シ� |
730 | | node |
731 | | .transition() |
732 | | .duration(duration) |
733 | | .attr("cx", function(d) {return d.x;}) |
734 | | .attr("cy", function(d) {return d.y;}); |
735 | | |
736 | | // 蜷�ヮ繝シ繝峨ユ繧ュ繧ケ繝医↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ縲√ユ繧ュ繧ケ繝域緒逕サ菴咲スョ繧剃ク贋ク九↓謖ッ繧具シ医°縺、謚倥j縺溘◆縺セ繧御クュ縺ョ蝣エ蜷医�謠冗判蛻�イ仙�逅�シ� |
737 | | tnode |
738 | | .transition() |
739 | | .duration(duration) |
740 | | .attr("x", function(d) {return d.x;}) |
741 | | .attr("y", function(d) { |
742 | | // 繝�ヵ繧ゥ繝ォ繝医〒蟆代@荳九£繧� |
743 | | var updown = (self.NODEHEIGHT * 0.4); |
744 | | // 螂�焚逡ェ逶ョ縺ョ豺ア縺輔↑繧牙ー代@荳翫£繧� |
745 | | if(d.group % 2 == 1){ |
746 | | updown = -(self.NODEHEIGHT * 0.2); |
747 | | } |
748 | | // 縺昴�蛟、繧帝ォ倥&縺ォ霑斐☆縺薙→縺ァ繝�く繧ケ繝域緒逕サ菴咲スョ縺御コ偵>驕輔>縺ォ縺ェ繧� |
749 | | return d.y + updown; |
750 | | }); |
751 | | |
752 | | // 蜷�Μ繝ウ繧ッ繝�く繧ケ繝医↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ |
753 | | tlink |
754 | | .transition() |
755 | | .duration(duration) |
756 | | .attr("x", function(d) {return (node.data()[d.source].x + node.data()[d.target].x) / 2;}) |
757 | | .attr("y", function(d) {return ((node.data()[d.source].y + node.data()[d.target].y) / 2) + 5;}); |
758 | | |
759 | | }; |
760 | | |
761 | | // 閭梧勹驛ィ蛻�′繧ッ繝ェ繝�け縺輔l縺溘i陦ィ遉コ縺ョ蝗コ螳壼喧繧定ァ」髯、 |
762 | | bg.on("click", function() { |
763 | | // 繝��繝ォ繝√ャ繝励r髱櫁。ィ遉コ |
764 | | $('.SBTooltip').hide(); |
765 | | d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; }); |
766 | | d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; }); |
767 | | |
768 | | // 蜷�ヮ繝シ繝峨�霈ェ驛ュ邱壹�濶イ繧偵ョ繝輔か繝ォ繝医↓ |
769 | | node |
770 | | .style("stroke", function(d){ |
771 | | if(d.view != "hide"){ |
772 | | d.view = "no"; |
773 | | } |
774 | | return "#fafafa"; |
775 | | }); |
776 | | |
777 | | // 繝ェ繝ウ繧ッ繝�く繧ケ繝医r蜈ィ縺ヲ遨コ縺ォ |
778 | | tlink |
779 | | .text(function(d) { |
780 | | d.view = "no"; |
781 | | return ""; |
782 | | }); |
783 | | |
784 | | // 繝ェ繝ウ繧ッ縺ョ濶イ繧貞�縺ヲ繝�ヵ繧ゥ繝ォ繝医↓ |
785 | | link |
786 | | .style("stroke", function(d){ |
787 | | return "#999"; |
788 | | }); |
789 | | |
790 | | /* |
791 | | if(svg.attr("width") == width){ |
792 | | svg.attr("width", (width / 5)) |
793 | | .attr("height", (width * 9 / 16 / 5)) |
794 | | .attr("viewBox", "0 0 " + width + " " + (width * 9 / 16)); |
795 | | }else{ |
796 | | svg.attr("width", width) |
797 | | .attr("height", height) |
798 | | .attr("viewBox", "0 0 " + width + " " + height); |
799 | | } |
800 | | */ |
801 | | |
802 | | }); |
803 | | |
804 | | // 蛻晏屓縺ョ縺ソduration繧�縺ィ謖�ョ壹@蜀肴緒逕サ�医い繝九Γ繝シ繧キ繝ァ繝ウ縺ェ縺暦シ� |
805 | | redraw(0); |
806 | | |
807 | | }else{ |
808 | | // SVG縺ョ蜑企勁 |
809 | | d3.select(".SBGraph svg").remove(); |
810 | | } |
| 672 | }); |
| 673 | |
| 674 | // 縺薙%縺セ縺ァ縺ョ險ュ螳壹r蜈�↓蜀肴緒逕サ |
| 675 | redraw(); |
| 676 | |
| 677 | // 繧ッ繝ェ繝�け縺輔l縺溘→縺� |
| 678 | }).on("click", function(d){ |
| 679 | // 譛ォ遶ッ繝弱�繝峨↑繧峨せ繝代�繧ッ繝ォ逋コ陦� |
| 680 | if(d.path != "notend"){ |
| 681 | generateSPARQL(); |
| 682 | } |
| 683 | }); |
| 684 | |
| 685 | // 蜀肴緒逕サ髢「謨ー |
| 686 | var redraw = function (duration){ |
| 687 | |
| 688 | // 縺九¢繧区凾髢薙′譛ェ謖�ョ壹↑繧峨� |
| 689 | if(duration == undefined){ |
| 690 | // 0.5遘偵°縺代※繧「繝九Γ繝シ繧キ繝ァ繝ウ |
| 691 | duration = 500; |
| 692 | } |
| 693 | |
| 694 | // 蜷�Μ繝ウ繧ッ縺ォ縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ |
| 695 | link |
| 696 | .transition() |
| 697 | .duration(duration) |
| 698 | .attr("x1", function(d) {return node.data()[d.source].x;}) |
| 699 | .attr("y1", function(d) {return node.data()[d.source].y;}) |
| 700 | .attr("x2", function(d) {return node.data()[d.target].x;}) |
| 701 | .attr("y2", function(d) {return node.data()[d.target].y;}); |
| 702 | |
| 703 | // 蜷�ヮ繝シ繝峨↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ |
| 704 | node |
| 705 | .transition() |
| 706 | .duration(duration) |
| 707 | .attr("cx", function(d) {return d.x;}) |
| 708 | .attr("cy", function(d) {return d.y;}); |
| 709 | |
| 710 | // 蜷�ヮ繝シ繝峨ユ繧ュ繧ケ繝医↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ縲√ユ繧ュ繧ケ繝域緒逕サ菴咲スョ繧剃ク贋ク九↓謖ッ繧� |
| 711 | tnode |
| 712 | .transition() |
| 713 | .duration(duration) |
| 714 | .attr("x", function(d) {return d.x;}) |
| 715 | .attr("y", function(d) { |
| 716 | // 繝�ヵ繧ゥ繝ォ繝医〒蟆代@荳九£繧� |
| 717 | var updown = (NODEHEIGHT * 0.4); |
| 718 | // 螂�焚逡ェ逶ョ縺ョ豺ア縺輔↑繧牙ー代@荳翫£繧� |
| 719 | if(d.group % 2 == 1){ |
| 720 | updown = -(NODEHEIGHT * 0.2); |
| 721 | } |
| 722 | // 縺昴�蛟、繧帝ォ倥&縺ォ霑斐☆縺薙→縺ァ繝�く繧ケ繝域緒逕サ菴咲スョ縺御コ偵>驕輔>縺ォ縺ェ繧� |
| 723 | return d.y + updown; |
| 724 | }); |
| 725 | |
| 726 | // 蜷�Μ繝ウ繧ッ繝�く繧ケ繝医↓縺、縺�※險ュ螳壹&繧後◆菴咲スョ縺ォ蜀肴緒逕サ |
| 727 | tlink |
| 728 | .transition() |
| 729 | .duration(duration) |
| 730 | .attr("x", function(d) {return (node.data()[d.source].x + node.data()[d.target].x) / 2;}) |
| 731 | .attr("y", function(d) {return ((node.data()[d.source].y + node.data()[d.target].y) / 2) + 4;}); |
| 732 | |
| 733 | }; |
| 734 | |
| 735 | // 蛻晏屓縺ョ縺ソduration繧�縺ィ謖�ョ壹@蜀肴緒逕サ�医い繝九Γ繝シ繧キ繝ァ繝ウ縺ェ縺暦シ� |
| 736 | redraw(0); |
| 737 | |
| 738 | }else{ |
| 739 | // SVG縺ョ蜑企勁 |
| 740 | d3.select(".SBGraph svg").remove(); |
| 741 | } |
858 | | // obj繝医ャ繝鈴嚴螻、縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
859 | | for(var i = 0; i < viewnum; i++){ |
860 | | if(i == 0){ |
861 | | // 蛻晏屓縺縺代Ν繝シ繝医ヮ繝シ繝峨r繝励ャ繧キ繝・ |
862 | | ret['nodes'].push({'name': obj[0]['label'], 'uri': obj[0]['startClass'], 'group': 0, 'x':50, 'y':50, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': 'hsl(40, 50%, 75%)'}); |
863 | | } |
864 | | // 蜈医↓source縺ォ0�医Ν繝シ繝茨シ峨r莉」蜈・ |
865 | | var source = 0; |
866 | | // 蜈ア騾壹Ν繝シ繝亥愛螳壹rtrue縺ォ |
867 | | var isCommon = true; |
868 | | |
869 | | var score = obj[i]['score']; |
870 | | |
871 | | // classLinks縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
872 | | for(var j = 0;j < obj[i]['classLinks'].length; j++){ |
873 | | |
874 | | // 繝ェ繝ウ繧ッ縺ョ蜷榊燕繧旦RL譛ォ蟆セ縺九i蜿門セ� |
875 | | var propertytext = obj[i]['classLinks'][j]['predicate']; |
876 | | var propertysplit1 = propertytext.split("/"); |
877 | | var propertysplit2 = propertysplit1[propertysplit1.length - 1]; |
878 | | var propertysplit3 = propertysplit2.split("#"); |
879 | | propertytext = propertysplit3[propertysplit3.length - 1]; |
880 | | |
881 | | if(MAXDEPTH < j+1){ |
882 | | MAXDEPTH = j+1; |
883 | | } |
884 | | // 縺薙%縺セ縺ァ蜈ア騾壹Ν繝シ繝医↑繧� |
885 | | if(isCommon){ |
886 | | // 莉雁屓繧ょ�騾壹°遒コ隱阪☆繧九◆繧√�繝輔Λ繧ー |
887 | | var isCommonNow = false; |
888 | | // nodes驟榊�縺ォ蜷後§linkedClass縺梧里縺ォ縺ゅk縺狗「コ隱� |
889 | | var targets = []; |
890 | | for(var k = 0; k < ret['nodes'].length; k++){ |
891 | | // 蜷碁嚴螻、縺九▽蜷後§蜷榊燕縺ョ繧ゅ�縺後≠縺」縺溘itargets驟榊�縺ォ逡ェ蜿キ繧定ソス蜉 |
892 | | if(ret['nodes'][k]['group'] == (j+1) && obj[i]['classLinks'][j]['linkedClass'] == ret['nodes'][k]['uri']){ |
893 | | targets.push(k); |
894 | | } |
895 | | } |
896 | | |
897 | | // 譌「縺ォ縺ゅ▲縺溷エ蜷医�links驟榊�縺ォ蜷後§link縺悟ュ伜惠縺吶k縺狗「コ隱� |
898 | | if(targets.length != 0){ |
899 | | // 蜈医⊇縺ゥ隕九▽縺代◆targets縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
900 | | for(var l = 0; l <targets.length; l++){ |
901 | | // links驟榊�縺ォ蜈ィ縺丞酔縺俶擅莉カ縺ョ繧ゅ�縺後≠繧九°遒コ隱� |
902 | | for(var m = 0; m < ret['links'].length; m++){ |
903 | | // 縺ゅ▲縺溷エ蜷井サ雁屓縺ョ繧ゅ�縺ッ霑ス蜉縺帙★source繧呈峩譁ー縺励※谺。縺ク |
904 | | if(ret['links'][m]['source'] == source && ret['links'][m]['target'] == targets[l] && ret['links'][m]['uri'] == obj[i]['classLinks'][j]['predicate'] && !isCommonNow){ |
905 | | // 蜈ア騾壹Ν繝シ繝医ヵ繝ゥ繧ー繧偵が繝ウ |
906 | | isCommonNow = true; |
907 | | source = targets[l]; |
908 | | } |
909 | | } |
910 | | } |
911 | | |
912 | | // 蜷дarget繧堤「コ隱阪@縺ヲ蜈ア騾壹Ν繝シ繝医〒縺ッ縺ェ縺九▲縺溷エ蜷域眠隕剰ソス蜉 |
913 | | if(!isCommonNow){ |
914 | | isCommon = false; |
915 | | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); |
916 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); |
917 | | source = ret['nodes'].length - 1; |
918 | | } |
919 | | |
920 | | // 縺ェ縺九▲縺溷エ蜷医�蛻・譚。莉カ縺ェ縺ョ縺ァ譁ー隕剰ソス蜉縺励※谺。縺ク |
921 | | }else{ |
922 | | |
923 | | isCommon = false; |
924 | | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); |
925 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); |
926 | | source = ret['nodes'].length - 1; |
927 | | } |
928 | | // 譌「縺ォ蜈ア騾壹Ν繝シ繝医〒縺ェ縺�↑繧画眠隕剰ソス蜉縺励※谺。縺ク |
929 | | }else{ |
930 | | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); |
931 | | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); |
932 | | source = ret['nodes'].length - 1; |
933 | | } |
934 | | |
935 | | } |
936 | | ret['nodes'][ret['nodes'].length - 1]['path'] = obj[i]; |
937 | | ret['nodes'][ret['nodes'].length - 1]['score'] = score; |
938 | | ret['nodes'][ret['nodes'].length - 1]['nodecolor'] = 'hsl(150, 50%, 75%)'; |
939 | | PATHNUM++; |
940 | | } |
941 | | TREESPACE = $('.SBGraph').width() / (MAXDEPTH + 1); |
942 | | |
943 | | // 縺ァ縺阪◆邨先棡繧定ソ斐☆ |
944 | | return ret; |
| 812 | // obj繝医ャ繝鈴嚴螻、縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
| 813 | for(var i = 0; i < viewnum; i++){ |
| 814 | if(i == 0){ |
| 815 | // 蛻晏屓縺縺代Ν繝シ繝医ヮ繝シ繝峨r繝励ャ繧キ繝・ |
| 816 | ret['nodes'].push({'name': obj[0]['label'], 'uri': obj[0]['startClass'], 'group': 0, 'x':50, 'y':50, 'nodeid':ret['nodes'].length, 'path': 'notend', 'nodecolor': 'hsl(40, 50%, 75%)'}); |
| 817 | } |
| 818 | // 蜈医↓source縺ォ0�医Ν繝シ繝茨シ峨r莉」蜈・ |
| 819 | var source = 0; |
| 820 | // 蜈ア騾壹Ν繝シ繝亥愛螳壹rtrue縺ォ |
| 821 | var isCommon = true; |
| 822 | |
| 823 | // 縺薙�繝代せ縺ョ繧ケ繧ウ繧「繧貞叙蠕� |
| 824 | var score = obj[i]['score']; |
| 825 | |
| 826 | // classLinks縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
| 827 | for(var j = 0;j < obj[i]['classLinks'].length; j++){ |
| 828 | |
| 829 | // 繝ェ繝ウ繧ッ縺ョ蜷榊燕繧旦RL譛ォ蟆セ縺九i蜿門セ� |
| 830 | var propertytext = obj[i]['classLinks'][j]['predicate']; |
| 831 | var propertysplit1 = propertytext.split("/"); |
| 832 | var propertysplit2 = propertysplit1[propertysplit1.length - 1]; |
| 833 | var propertysplit3 = propertysplit2.split("#"); |
| 834 | propertytext = propertysplit3[propertysplit3.length - 1]; |
| 835 | |
| 836 | // 豺ア縺輔′譛螟ァ繧医j螟ァ縺阪¢繧後�譖エ譁ー |
| 837 | if(MAXDEPTH < j+1){ |
| 838 | MAXDEPTH = j+1; |
| 839 | } |
| 840 | // 縺薙%縺セ縺ァ蜈ア騾壹Ν繝シ繝医↑繧� |
| 841 | if(isCommon){ |
| 842 | // 莉雁屓繧ょ�騾壹°遒コ隱阪☆繧九◆繧√�繝輔Λ繧ー |
| 843 | var isCommonNow = false; |
| 844 | // nodes驟榊�縺ォ蜷後§linkedClass縺梧里縺ォ縺ゅk縺狗「コ隱� |
| 845 | var targets = []; |
| 846 | for(var k = 0; k < ret['nodes'].length; k++){ |
| 847 | // 蜷碁嚴螻、縺九▽蜷後§蜷榊燕縺ョ繧ゅ�縺後≠縺」縺溘itargets驟榊�縺ォ逡ェ蜿キ繧定ソス蜉 |
| 848 | if(ret['nodes'][k]['group'] == (j+1) && obj[i]['classLinks'][j]['linkedClass'] == ret['nodes'][k]['uri']){ |
| 849 | targets.push(k); |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | // 譌「縺ォ縺ゅ▲縺溷エ蜷医�links驟榊�縺ォ蜷後§link縺悟ュ伜惠縺吶k縺狗「コ隱� |
| 854 | if(targets.length != 0){ |
| 855 | // 蜈医⊇縺ゥ隕九▽縺代◆targets縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i |
| 856 | for(var l = 0; l <targets.length; l++){ |
| 857 | // links驟榊�縺ォ蜈ィ縺丞酔縺俶擅莉カ縺ョ繧ゅ�縺後≠繧九°遒コ隱� |
| 858 | for(var m = 0; m < ret['links'].length; m++){ |
| 859 | // 縺ゅ▲縺溷エ蜷井サ雁屓縺ョ繧ゅ�縺ッ霑ス蜉縺帙★source繧呈峩譁ー縺励※谺。縺ク |
| 860 | if(ret['links'][m]['source'] == source && ret['links'][m]['target'] == targets[l] && ret['links'][m]['uri'] == obj[i]['classLinks'][j]['predicate'] && !isCommonNow){ |
| 861 | // 蜈ア騾壹Ν繝シ繝医ヵ繝ゥ繧ー繧偵が繝ウ |
| 862 | isCommonNow = true; |
| 863 | source = targets[l]; |
| 864 | } |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | // 蜷дarget繧堤「コ隱阪@縺ヲ蜈ア騾壹Ν繝シ繝医〒縺ッ縺ェ縺九▲縺溷エ蜷域眠隕剰ソス蜉 |
| 869 | if(!isCommonNow){ |
| 870 | isCommon = false; |
| 871 | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'nodeid':ret['nodes'].length, 'path': 'notend', 'nodecolor': '#cccccc'}); |
| 872 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate']}); |
| 873 | source = ret['nodes'].length - 1; |
| 874 | } |
| 875 | |
| 876 | // 縺ェ縺九▲縺溷エ蜷医�蛻・譚。莉カ縺ェ縺ョ縺ァ譁ー隕剰ソス蜉縺励※谺。縺ク |
| 877 | }else{ |
| 878 | |
| 879 | isCommon = false; |
| 880 | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'nodeid':ret['nodes'].length, 'path': 'notend', 'nodecolor': '#cccccc'}); |
| 881 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate']}); |
| 882 | source = ret['nodes'].length - 1; |
| 883 | } |
| 884 | // 譌「縺ォ蜈ア騾壹Ν繝シ繝医〒縺ェ縺�↑繧画眠隕剰ソス蜉縺励※谺。縺ク |
| 885 | }else{ |
| 886 | ret['nodes'].push({'name': obj[i]['classLinks'][j]['label'], 'uri': obj[i]['classLinks'][j]['linkedClass'], 'group': (j+1), 'x':0, 'y':0, 'nodeid':ret['nodes'].length, 'path': 'notend', 'nodecolor': '#cccccc'}); |
| 887 | ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate']}); |
| 888 | source = ret['nodes'].length - 1; |
| 889 | } |
| 890 | |
| 891 | } |
| 892 | // 譛蠕鯉シ域忰遶ッ繝弱�繝会シ峨↓蜷�ィョ蛟、繧定ソス蜉 |
| 893 | ret['nodes'][ret['nodes'].length - 1]['path'] = obj[i]; |
| 894 | ret['nodes'][ret['nodes'].length - 1]['score'] = score; |
| 895 | ret['nodes'][ret['nodes'].length - 1]['nodecolor'] = 'hsl(150, 50%, 75%)'; |
| 896 | // 繝代せ謨ー繧定ソス蜉 |
| 897 | PATHNUM++; |
| 898 | } |
| 899 | // 繝弱�繝蛾俣縺ョ繧ケ繝壹�繧ケ繧定ィ育ョ� |
| 900 | TREESPACE = $('.SBGraph').width() / (MAXDEPTH + 1); |
| 901 | |
| 902 | // 縺ァ縺阪◆邨先棡繧定ソ斐☆ |
| 903 | return ret; |