From: <tob...@us...> - 2014-03-14 23:49:46
|
Revision: 7973 http://sourceforge.net/p/bigdata/code/7973 Author: tobycraig Date: 2014-03-14 23:49:43 +0000 (Fri, 14 Mar 2014) Log Message: ----------- #827 - Made SID components in header clickable, and removed old code Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-14 23:44:38 UTC (rev 7972) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-14 23:49:43 UTC (rev 7973) @@ -631,7 +631,19 @@ var uri = $(this).find('input').val(); if(uri) { loadURI(uri); - $('#explore-header h1').text(uri); + + // if this is a SID, make the components clickable + var re = /< <([^<>]*)> <([^<>]*)> <([^<>]*)> >/; + var match = uri.match(re); + if(match) { + $('#explore-header h1').html('< <<a href="#">' + match[1] + '</a> > <<a href="#">' + match[2] + '</a> > <<a href="#">' + match[3] + '</a> > >'); + $('#explore-header h1 a').click(function(e) { + e.preventDefault(); + explore(this.text); + }); + } else { + $('#explore-header h1').text(uri); + } } }); @@ -762,68 +774,6 @@ e.preventDefault(); explore($(this).data('sid') ? $(this).data('sid') : this.text); }); - - return; - - var outbound={}, inbound={}, attributes={}; - for(var i=0; i<data.results.bindings.length; i++) { - var binding = data.results.bindings[i]; - var star = typeof(binding.sidP) != 'undefined'; - if('o' in binding) { - var key = [binding.p.value, binding.o.value]; - if(binding.o.type == 'uri') { - // leave star true if it was before, or set it to current value - outbound[key] = !!outbound[key] || star; - } else { - // do not show star for attributes - attributes[key] = false; - } - } else { - var key = [binding.s.value, binding.p.value] - inbound[key] == !!inbound[key] || star; - } - } - - var outgoingContainer = $('#explore-outgoing'); - outgoingContainer.html(''); - if(outbound.length) { - outgoingContainer.append('<h2>Outgoing links</h2>'); - var table = $('<table>').appendTo(outgoingContainer); - for(key in outbound) { - table.append('<tr><td>' + key[0] + '</td><td><a href="#">' + key[1] + '</a></td><td>' + (outbound[key] ? '*' : '') + '</td></tr>'); - } - } else { - outgoingContainer.append('<h2>No outgoing links</h2>'); - } - - var incomingContainer = $('#explore-incoming'); - incomingContainer.html(''); - if(inbound.length) { - incomingContainer.append('<h2>Inbound links</h2>'); - var table = $('<table>').appendTo(incomingContainer); - for(key in inbound) { - table.append('<tr><td>' + key[0] + '</td><td><a href="#">' + key[1] + '</a></td><td>' + (inbound[key] ? '*' : '') + '</td></tr>'); - } - } else { - incomingContainer.append('<h2>No incoming links</h2>'); - } - - var attributesContainer = $('#explore-attributes'); - attributesContainer.html(''); - if(attributes.length) { - attributesContainer.append('<h4>Attributes</h4>'); - var table = $('<table>').appendTo(attributesContainer); - for(var i=0; i<attributes.length; i++) { - table.append('<tr><td>' + attributes[i].p.value + '</td><td>' + attributes[i].o.value + '</td></tr>'); - } - } else { - attributesContainer.append('<h2>No attributes</h2>'); - } - - $('#explore-results a').click(function(e) { - e.preventDefault(); - explore(this.text); - }); } function explore(uri) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |