チェンジセット 213 : SPARQLBuilderWWW/web/sparqlbuilder.js

差分発生行の前後
無視リスト:
更新日時:
2014/12/04 15:18:36 (10 年 前)
更新者:
lenz
ログメッセージ:

JSONの形式変更に合わせパス探索部分を改修

ファイル:
1 変更

凡例:

変更なし
追加
削除
  • SPARQLBuilderWWW/web/sparqlbuilder.js

    r209 r213  
    726726    document.getElementById("sparqlBuilderPlural").innerHTML = "s"; 
    727727 
    728     if(obj['paths'].length == 0){ 
     728    if(obj.length == 0){ 
    729729        document.getElementById("sparqlBuilderResultmessage").style.color = "red"; 
    730730        document.getElementById("sparqlBuilderResultmessage").style.fontWeight = "bold"; 
    731731        document.getElementById("sparqlBuilderPlural").innerHTML = ""; 
    732     }else if(obj['paths'].length == 1){ 
     732    }else if(obj.length == 1){ 
    733733        document.getElementById("sparqlBuilderPlural").innerHTML = ""; 
    734734    } 
    735735 
    736     if(obj['paths'].length <= 10){ 
    737         viewnum = obj['paths'].length; 
     736    if(obj.length <= 10){ 
     737        viewnum = obj.length; 
    738738        document.getElementById("sparqlBuilderViewall").style.display = "none"; 
    739739    }else if(this.pathlimit == 10){ 
     
    741741        document.getElementById("sparqlBuilderViewall").style.display = "block"; 
    742742    }else{ 
    743         viewnum = obj['paths'].length; 
     743        viewnum = obj.length; 
    744744        document.getElementById("sparqlBuilderViewall").style.display = "none"; 
    745745    } 
    746746 
    747     document.getElementById("sparqlBuilderPathnum").innerHTML = obj['paths'].length; 
     747    document.getElementById("sparqlBuilderPathnum").innerHTML = obj.length; 
    748748    document.getElementById("sparqlBuilderResultmessage").style.display = "block"; 
    749749 
     
    752752        if(i == 0){ 
    753753            // 蛻晏屓縺縺代Ν繝シ繝医ヮ繝シ繝峨r繝励ャ繧キ繝・ 
    754             ret['nodes'].push({'name': obj['paths'][0]['startClassLabel'], 'uri': obj['paths'][0]['startClassURI'], 'group': 0, 'x':50, 'y':50, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#d0a36a'}); 
     754            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': '#d0a36a'}); 
    755755        } 
    756756        // 蜈医↓source縺ォ0�医Ν繝シ繝茨シ峨r莉」蜈・ 
     
    760760 
    761761        // classLinks縺ョ謨ー縺縺醍ケー繧願ソ斐@縺ェ縺後i 
    762         for(var j = 0;j < obj['paths'][i]['classLinks'].length; j++){ 
     762        for(var j = 0;j < obj[i]['classLinks'].length; j++){ 
    763763 
    764764            // 繝ェ繝ウ繧ッ縺ョ蜷榊燕繧旦RL譛ォ蟆セ縺九i蜿門セ� 
    765             var propertytext = obj['paths'][i]['classLinks'][j]['propertyURI']; 
     765            var propertytext = obj[i]['classLinks'][j]['predicate']; 
    766766            var propertysplit1 = propertytext.split("/"); 
    767767            var propertysplit2 = propertysplit1[propertysplit1.length - 1]; 
     
    780780                for(var k = 0; k < ret['nodes'].length; k++){ 
    781781                    // 蜷碁嚴螻、縺九▽蜷後§蜷榊燕縺ョ繧ゅ�縺後≠縺」縺溘itargets驟榊�縺ォ逡ェ蜿キ繧定ソス蜉 
    782                     if(ret['nodes'][k]['group'] == (j+1) && obj['paths'][i]['classLinks'][j]['linkedClassURI'] == ret['nodes'][k]['uri']){ 
     782                    if(ret['nodes'][k]['group'] == (j+1) && obj[i]['classLinks'][j]['linkedClass'] == ret['nodes'][k]['uri']){ 
    783783                        targets.push(k); 
    784784                    } 
     
    792792                        for(var m = 0; m < ret['links'].length; m++){ 
    793793                            // 縺ゅ▲縺溷エ蜷井サ雁屓縺ョ繧ゅ�縺ッ霑ス蜉縺帙★source繧呈峩譁ー縺励※谺。縺ク 
    794                             if(ret['links'][m]['source'] == source && ret['links'][m]['target'] == targets[l] && ret['links'][m]['uri'] == obj['paths'][i]['classLinks'][j]['propertyURI'] && !isCommonNow){ 
     794                            if(ret['links'][m]['source'] == source && ret['links'][m]['target'] == targets[l] && ret['links'][m]['uri'] == obj[i]['classLinks'][j]['propertyURI'] && !isCommonNow){ 
    795795                                // 蜈ア騾壹Ν繝シ繝医ヵ繝ゥ繧ー繧偵が繝ウ 
    796796                                isCommonNow = true; 
     
    803803                    if(!isCommonNow){ 
    804804                        isCommon = false; 
    805                         ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'uri': obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); 
    806                         ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 
     805                        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'}); 
     806                        ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); 
    807807                        source = ret['nodes'].length - 1; 
    808808                    } 
     
    812812 
    813813                    isCommon = false; 
    814                     ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'uri': obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); 
    815                     ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 
     814                    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'}); 
     815                    ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); 
    816816                    source = ret['nodes'].length - 1; 
    817817                } 
    818818            // 譌「縺ォ蜈ア騾壹Ν繝シ繝医〒縺ェ縺�↑繧画眠隕剰ソス蜉縺励※谺。縺ク 
    819819            }else{ 
    820                 ret['nodes'].push({'name': obj['paths'][i]['classLinks'][j]['nodeLabel'], 'uri': obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no', 'path': 'notend', 'nodecolor': '#cccccc'}); 
    821                 ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 
     820                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'}); 
     821                ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property': propertytext, 'uri': obj[i]['classLinks'][j]['predicate'], 'view' : 'no'}); 
    822822                source = ret['nodes'].length - 1; 
    823823            } 
    824824 
    825825        } 
    826         ret['nodes'][ret['nodes'].length - 1]['path'] = obj['paths'][i]; 
     826        ret['nodes'][ret['nodes'].length - 1]['path'] = obj[i]; 
    827827        ret['nodes'][ret['nodes'].length - 1]['nodecolor'] = '#8cddc0'; 
    828828        this.PATHNUM++;