From: <tob...@us...> - 2014-02-19 01:47:37
|
Revision: 7850 http://bigdata.svn.sourceforge.net/bigdata/?rev=7850&view=rev Author: tobycraig Date: 2014-02-19 01:47:28 +0000 (Wed, 19 Feb 2014) Log Message: ----------- Initial new layout with most load functionality Modified Paths: -------------- branches/RDR/bigdata-war/src/html/workbench.js Added Paths: ----------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/style.css Added: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html (rev 0) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-19 01:47:28 UTC (rev 7850) @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>RedPoint Workbench</title> + <link rel="stylesheet" href="style.css"> + </head> + + <body> + <div id="tab-selector"> + <a data-target="load" class="active">Load</a> + <a data-target="query">Query</a> + <a data-target="explore">Explore</a> + <a data-target="status">Status</a> + <a data-target="namespaces">Namespaces</a> + </div> + + <div id="current-namespace"> + Current namespace: <span>kb</span> + </div> + + <div class="tab" id="load"> + <input id="load-file" type="file" name="file"> + <input id="load-hidden" type="hidden" name="large-file-contents"> + <p id="large-file-message" style="display: none;">Your file is too large to display here, but will be uploaded as normal.</p> + <br> + <textarea id="load-box" name="textarea" rows="10" cols="80"></textarea> + <br> + Type: <select id="load-type"> + <option value="sparql" selected="selected">SPARQL</option> + <option value="rdf">RDF</option> + <option value="path">File path</option> + </select> + <select id="rdf-type" style="display: none;"> + <option value="">Select RDF format</option> + <option value="n-quads">N-Quads</option> + <option value="n-triples">N-Triples</option> + <option value="n3">Notation3</option> + <option value="rdf/xml">RDF/XML</option> + <option value="trig">TriG</option> + <option value="trix">TriX</option> + <option value="turtle">Turtle</option> + </select> + <br> + <button>Load</button> + <hr> + <p>Response:</p> + <pre id="response"></pre> + + </div> + + <div class="tab" id="query">query + </div> + + <div class="tab" id="explore">explore + </div> + + <div class="tab" id="status">status + </div> + + <div class="tab" id="namespaces">namespaces + </div> + + <!--[if IE]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> + <script>window.jQuery || document.write('<script src="/jquery.min.js"><\/script>')</script> + <script src="workbench.js"></script> + </body> +</html> Property changes on: branches/RDR/bigdata-war/src/html/new.html ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Date Revision Author HeadURL Added: branches/RDR/bigdata-war/src/html/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/style.css (rev 0) +++ branches/RDR/bigdata-war/src/html/style.css 2014-02-19 01:47:28 UTC (rev 7850) @@ -0,0 +1,84 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} + + +/* Workbench */ + +body { + margin: 10px; +} + +#tab-selector a { + padding: 10px; + border: 1px solid; + border-right: none; + border-bottom: none; + display: inline-block; + float: left; +} + +#tab-selector a:last-of-type { + border-right: 1px solid; +} + +#current-namespace { + float: right; +} + +.active { + text-shadow: 1px 0px 0px black; + /*font-weight: bold;*/ +} + +.tab { + display: none; + clear: both; + border: 1px solid; + padding: 10px; +} Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-17 19:20:06 UTC (rev 7849) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-19 01:47:28 UTC (rev 7850) @@ -1,5 +1,26 @@ -/* Multi purpose data entry */ +$(function() { +$('#tab-selector a').click(function() { + $('.tab').hide(); + $('#' + $(this).data('target')).show(); + $('#tab-selector a').removeClass(); + $(this).addClass('active'); +}); + +$('#tab-selector a:first').click(); + +// TODO: set namespace initially + +/* Namespaces */ + +function getNamespaces() { + $.get('/namespace', function(data) { + + }); +} + +/* Load */ + function handleDragOver(e) { e.stopPropagation(); e.preventDefault(); @@ -26,22 +47,22 @@ // if file is too large, tell user to supply local path if(f.size > 100 * 1048576) { alert('File too large, enter local path to file'); - $('#mp-box').val('/path/to/' + f.name); + $('#load-box').val('/path/to/' + f.name); setType('path'); - $('#mp-file').val(''); + $('#load-file').val(''); $('#large-file-message').hide(); return; } // if file is small enough, populate the textarea with it if(f.size < 10 * 1024) { - holder = '#mp-box'; - $('#mp-hidden').val(''); + holder = '#load-box'; + $('#load-hidden').val(''); $('#large-file-message').hide(); } else { // store file contents in hidden input and clear textarea - holder = '#mp-hidden'; - $('#mp-box').val(''); + holder = '#load-hidden'; + $('#load-box').val(''); $('#large-file-message').show(); } var fr = new FileReader(); @@ -50,7 +71,7 @@ guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); }; fr.readAsText(f); - $('#mp-file').val(''); + $('#load-file').val(''); } function guessType(extension, content) { @@ -100,7 +121,7 @@ } function setType(type, format) { - $('#mp-type').val(type); + $('#load-type').val(type); if(type == 'rdf') { $('#rdf-type').show(); $('#rdf-type').val(format); @@ -133,15 +154,15 @@ var sparql_update_commands = ['INSERT', 'DELETE']; // stores the id of the element that contains the data to be sent -var holder = '#mp-box'; +var holder = '#load-box'; -$('#mp-file').change(handleFile); -$('#mp-box').on('dragover', handleDragOver); -$('#mp-box').on('drop', handleFile); -$('#mp-box').on('paste', handlePaste); -$('#mp-type').change(handleTypeChange); +$('#load-file').change(handleFile); +$('#load-box').on('dragover', handleDragOver); +$('#load-box').on('drop', handleFile); +$('#load-box').on('paste', handlePaste); +$('#load-type').change(handleTypeChange); -$('#mp-send').click(function() { +$('#load button').click(function() { // determine action based on type var settings = { type: 'POST', @@ -149,7 +170,7 @@ success: updateResponseXML, error: updateResponseError } - switch($('#mp-type').val()) { + switch($('#load-type').val()) { case 'sparql': settings.data = 'update=' + encodeURI(settings.data); settings.success = updateResponseHTML; @@ -170,11 +191,11 @@ $.ajax('/sparql', settings); }); -function updateResponseHTML(data, textStatus, jqXHR) { +function updateResponseHTML(data) { $('#response').html(data); } -function updateResponseXML(data, textStatus, jqXHR) { +function updateResponseXML(data) { var modified = data.childNodes[0].attributes['modified'].value; var milliseconds = data.childNodes[0].attributes['milliseconds'].value; $('#response').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds); @@ -236,7 +257,7 @@ $.ajax('/sparql', settings); } -function updateNavigationStart(data, textStatus, jqXHR) { +function updateNavigationStart(data) { var disp = $('#navigator-display'); disp.html(''); // see if we got any results @@ -295,3 +316,4 @@ $('#navigator-display').html('Error! ' + textStatus + ' ' + errorThrown); } +}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-11 23:29:46
|
Revision: 7845 http://bigdata.svn.sourceforge.net/bigdata/?rev=7845&view=rev Author: tobycraig Date: 2014-02-11 23:29:39 +0000 (Tue, 11 Feb 2014) Log Message: ----------- Added form at bottom of index page to accept file selection or drag/drops, and detect file type. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/index.html Added Paths: ----------- branches/RDR/bigdata-war/src/html/jquery.min.js branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/index.html =================================================================== --- branches/RDR/bigdata-war/src/html/index.html 2014-02-05 20:10:41 UTC (rev 7844) +++ branches/RDR/bigdata-war/src/html/index.html 2014-02-11 23:29:39 UTC (rev 7845) @@ -39,6 +39,13 @@ which this page was accessed. </p> +<h2>Linked Data Navigation</h2> +<form action="navigate" method="get"> + <p>Enter a URI to navigate to <input type="text" name="uri"></p> + <p>Tenant Namespace <input type="text" name="namespace" title="Tenant namespace."> (leave empty for default KB)</p> + <input type="submit" value="Send" title="Submit query."> +</form> + <!-- Note: Some applications (firefox 7) can not handle a GET with a very long URL. For that reason ONLY this operation defaults to a POST. You SHOULD use GET for database queries since they are, by and large, idempotent. @@ -136,5 +143,32 @@ </p> </form> --> + +<h2>Multi-purpose textarea</h2> +<form method="post" id="mp-form" enctype="multipart/form-data"> +<input id="mp-file" type="file" name="file"> +<input id="mp-hidden" type="hidden" name="large-file-contents"> +<textarea id="mp-box" name="textarea"></textarea> +<select id="mp-type"> +<option value="sparql" selected="selected">SPARQL</option> +<option value="rdf">RDF</option> +<option value="path">File path</option> +</select> +<select id="rdf-type" style="display: none;"> +<option value="">Select RDF format</option> +<option value="n-quads">N-Quads</option> +<option value="n-triples">N-Triples</option> +<option value="n3">Notation3</option> +<option value="rdf/xml">RDF/XML</option> +<option value="trig">TriG</option> +<option value="trix">TriX</option> +<option value="turtle">Turtle</option> +</select> +<input type="submit"> +</form> + +<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> +<script>window.jQuery || document.write('<script src="/jquery.min.js"><\/script>')</script> +<script src="/workbench.js"></script> </body> </html> \ No newline at end of file Added: branches/RDR/bigdata-war/src/html/jquery.min.js =================================================================== Added: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js (rev 0) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-11 23:29:39 UTC (rev 7845) @@ -0,0 +1,114 @@ +function handleFile(e) { + e.stopPropagation(); + e.preventDefault(); + + if(e.type == 'drop') { + var files = e.originalEvent.dataTransfer.files; + } else { + var files = e.originalEvent.target.files; + } + + // only one file supported + if(files.length > 1) { + alert('Ignoring all but first file'); + } + + var f = files[0]; + + // if file is too large, tell user to supply local path + if(f.size > 100 * 1048576) { + alert('File too large, enter local path to file'); + $('#mp-box').val('/path/to/' + f.name); + setType('path'); + $('#mp-file').val(''); + return; + } + + // if file is small enough, populate the textarea with it + var holder; + if(f.size < 10 * 1024) { + holder = '#mp-box'; + $('#mp-hidden').val(''); + } else { + // store file contents in hidden input and clear textarea + holder = '#mp-hidden'; + $('#mp-box').val(''); + } + var fr = new FileReader(); + fr.onload = function(e2) { + $(holder).val(e2.target.result); + guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); + }; + fr.readAsText(f); + $('#mp-file').val(''); +} + +function guessType(extension, content) { + // try to guess type + if(extension == 'rq') { + // SPARQL + setType('sparql'); + } else if(extension in rdf_types) { + // RDF + setType('rdf', rdf_types[extension]); + } else { + // extension is no help, see if we can find some SPARQL commands + content = content.toUpperCase(); + for(var i=0, found=false; i<sparql_update_commands.length; i++) { + if(content.indexOf(sparql_update_commands[i]) != -1) { + setType('sparql'); + found = true; + break; + } + } + if(!found) { + setType('rdf', ''); + } + } +} + +function handlePaste(e) { + alert('pasted!'); + e.stopPropagation(); + e.preventDefault(); +} + +function handleTypeChange(e) { + $('#rdf-type').toggle($(this).val() == 'rdf'); +} + +function setType(type, format) { + $('#mp-type').val(type); + if(type == 'rdf') { + $('#rdf-type').show(); + $('#rdf-type').val(format); + } else { + $('#rdf-type').hide(); + } +} + +// .xml is used for both RDF and TriX, assume it's RDF +// We could check the parent element to see which it is +var rdf_types = {'nq': 'n-quads', + 'nt': 'n-triples', + 'n3': 'n3', + 'rdf': 'rdf/xml', + 'rdfs': 'rdf/xml', + 'owl': 'rdf/xml', + 'xml': 'rdf/xml', + 'trig': 'trig', + 'trix': 'trix', + //'xml': 'trix', + 'ttl': 'turtle'}; + +var sparql_update_commands = ['INSERT', 'DELETE']; + +$('#mp-file').change(handleFile); +$('#mp-box').on('drop', handleFile); +$('#mp-box').on('paste', handlePaste); +$('#mp-type').change(handleTypeChange); + +$('#mp-form').submit(function() { + // determine action based on type + +}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-13 23:42:18
|
Revision: 7847 http://bigdata.svn.sourceforge.net/bigdata/?rev=7847&view=rev Author: tobycraig Date: 2014-02-13 23:42:11 +0000 (Thu, 13 Feb 2014) Log Message: ----------- SPARQL updates, RDF and file paths can all be sent to the server and added to the database. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/index.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/index.html =================================================================== --- branches/RDR/bigdata-war/src/html/index.html 2014-02-12 00:58:18 UTC (rev 7846) +++ branches/RDR/bigdata-war/src/html/index.html 2014-02-13 23:42:11 UTC (rev 7847) @@ -145,10 +145,12 @@ --> <h2>Multi-purpose textarea</h2> -<form method="post" id="mp-form" enctype="multipart/form-data"> <input id="mp-file" type="file" name="file"> +<br> <input id="mp-hidden" type="hidden" name="large-file-contents"> -<textarea id="mp-box" name="textarea"></textarea> +<p id="large-file-message" style="display: none;">Your file is too large to display here, but will be uploaded as normal.</p> +<textarea id="mp-box" name="textarea" rows="10" cols="80"></textarea> +<br> <select id="mp-type"> <option value="sparql" selected="selected">SPARQL</option> <option value="rdf">RDF</option> @@ -164,8 +166,13 @@ <option value="trix">TriX</option> <option value="turtle">Turtle</option> </select> -<input type="submit"> -</form> +<br> +Tenant Namespace <input type="text" name="namespace" title="Tenant namespace."> (leave empty for default KB) +<br> +<button type="button" id="mp-send">Send</button> +<br> +Response: +<pre id="response"></pre> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="/jquery.min.js"><\/script>')</script> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-12 00:58:18 UTC (rev 7846) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-13 23:42:11 UTC (rev 7847) @@ -27,18 +27,20 @@ $('#mp-box').val('/path/to/' + f.name); setType('path'); $('#mp-file').val(''); + $('#large-file-message').hide(); return; } // if file is small enough, populate the textarea with it - var holder; if(f.size < 10 * 1024) { holder = '#mp-box'; $('#mp-hidden').val(''); + $('#large-file-message').hide(); } else { // store file contents in hidden input and clear textarea holder = '#mp-hidden'; $('#mp-box').val(''); + $('#large-file-message').show(); } var fr = new FileReader(); fr.onload = function(e2) { @@ -59,24 +61,36 @@ setType('rdf', rdf_types[extension]); } else { // extension is no help, see if we can find some SPARQL commands - content = content.toUpperCase(); - for(var i=0, found=false; i<sparql_update_commands.length; i++) { - if(content.indexOf(sparql_update_commands[i]) != -1) { - setType('sparql'); - found = true; - break; - } + setType(identify(content)); + } +} + +function identify(text, considerPath) { + text = text.toUpperCase(); + + if(considerPath) { + // match Unix or Windows paths + var re = /^(((\/[^\/]+)+)|([A-Z]:([\\\/][^\\\/]+)+))$/; + if(re.test(text.trim())) { + return 'path'; } - if(!found) { - setType('rdf', ''); + } + + for(var i=0; i<sparql_update_commands.length; i++) { + if(text.indexOf(sparql_update_commands[i]) != -1) { + return 'sparql'; } } + + return 'rdf'; } -function handlePaste(e) { - alert('pasted!'); - e.stopPropagation(); - e.preventDefault(); +function handlePaste(e) { + // if the input is currently empty, try to identify the pasted content + var that = this; + if(this.value == '') { + setTimeout(function() { setType(identify(that.value, true)); }, 10); + } } function handleTypeChange(e) { @@ -106,8 +120,18 @@ 'trix': 'trix', //'xml': 'trix', 'ttl': 'turtle'}; + +var rdf_content_types = {'n-quads': 'application/n-quads', + 'n-triples': 'text/plain', + 'n3': 'text/n3', + 'rdf/xml': 'application/rdf+xml', + 'trig': 'application/trig', + 'trix': 'application/trix', + 'turtle': 'text/turtle'}; var sparql_update_commands = ['INSERT', 'DELETE']; +// stores the id of the element that contains the data to be sent +var holder = '#mp-box'; $('#mp-file').change(handleFile); $('#mp-box').on('dragover', handleDragOver); @@ -115,7 +139,45 @@ $('#mp-box').on('paste', handlePaste); $('#mp-type').change(handleTypeChange); -$('#mp-form').submit(function() { +$('#mp-send').click(function() { // determine action based on type - + var settings = { + type: 'POST', + data: $(holder).val(), + success: updateResponseXML, + error: updateResponseError + } + switch($('#mp-type').val()) { + case 'sparql': + settings.data = 'update=' + encodeURI(settings.data); + settings.success = updateResponseHTML; + break; + case 'rdf': + var type = $('#rdf-type').val(); + if(!type) { + alert('Please select an RDF content type.'); + return; + } + settings.contentType = rdf_content_types[type]; + break; + case 'path': + settings.data = 'uri=file://' + encodeURI(settings.data); + break; + } + + $.ajax('/sparql', settings); }); + +function updateResponseHTML(data, textStatus, jqXHR) { + $('#response').html(data); +} + +function updateResponseXML(data, textStatus, jqXHR) { + var modified = data.childNodes[0].attributes['modified'].value; + var milliseconds = data.childNodes[0].attributes['milliseconds'].value; + $('#response').text('Modified: ' + modified + '\nMilliseconds: ' + milliseconds); +} + +function updateResponseError(jqXHR, textStatus, errorThrown) { + $('#response').text('Error! ' + textStatus + ' ' + errorThrown); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-17 19:20:18
|
Revision: 7849 http://bigdata.svn.sourceforge.net/bigdata/?rev=7849&view=rev Author: tobycraig Date: 2014-02-17 19:20:06 +0000 (Mon, 17 Feb 2014) Log Message: ----------- Added initial navigator functionality, allowing vertex exploration. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/index.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/index.html =================================================================== --- branches/RDR/bigdata-war/src/html/index.html 2014-02-17 15:40:41 UTC (rev 7848) +++ branches/RDR/bigdata-war/src/html/index.html 2014-02-17 19:20:06 UTC (rev 7849) @@ -5,6 +5,11 @@ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <title>bigdata® NanoSparqlServer</title> <!-- $Id$ --> +<style> +td { + border: 1px solid; +} +</style> </head> <body> @@ -174,6 +179,15 @@ Response: <pre id="response"></pre> +<h2>Navigator</h2> +Enter a URI to begin navigation +<br> +<form id="navigator"> +<input type="text" id="navigator-uri"> +<input type="submit"> +</form> +<div id="navigator-display"></div> + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="/jquery.min.js"><\/script>')</script> <script src="/workbench.js"></script> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-17 15:40:41 UTC (rev 7848) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-17 19:20:06 UTC (rev 7849) @@ -1,3 +1,5 @@ +/* Multi purpose data entry */ + function handleDragOver(e) { e.stopPropagation(); e.preventDefault(); @@ -181,3 +183,115 @@ function updateResponseError(jqXHR, textStatus, errorThrown) { $('#response').text('Error! ' + textStatus + ' ' + errorThrown); } + + +/* Navigator */ + +$('#navigator').submit(function() { + // get URI + var uri = $('#navigator-uri').val(); + if(uri) { + loadURI(uri); + } + return false; +}); + +function loadURI(uri) { + // send query to server + var query = 'select * \ + where { \ + bind (<URI> as ?vertex) . \ + { \ + bind (<<?vertex ?p ?o>> as ?sid) . \ + optional \ + { \ + { \ + ?sid ?sidP ?sidO . \ + } union { \ + ?sidS ?sidP ?sid . \ + } \ + } \ + } union { \ + bind (<<?s ?p ?vertex>> as ?sid) . \ + optional \ + { \ + { \ + ?sid ?sidP ?sidO . \ + } union { \ + ?sidS ?sidP ?sid . \ + } \ + } \ + } \ + }'; + + query = query.replace('URI', uri); + var settings = { + type: 'POST', + data: 'query=' + encodeURI(query), + dataType: 'json', + accepts: {'json': 'application/sparql-results+json'}, + success: updateNavigationStart, + error: updateNavigationError + }; + $.ajax('/sparql', settings); +} + +function updateNavigationStart(data, textStatus, jqXHR) { + var disp = $('#navigator-display'); + disp.html(''); + // see if we got any results + if(data.results.bindings.length == 0) { + disp.append('No vertex found!'); + return; + } + + var vertex = data.results.bindings[0].vertex; + disp.append('<h3>' + vertex.value + '</h3>'); + var outbound=[], inbound=[], attributes=[]; + for(var i=0; i<data.results.bindings.length; i++) { + var binding = data.results.bindings[i]; + // TODO: are attributes always on outbound relationships? + if('o' in binding) { + if(binding.o.type == 'uri') { + outbound.push(binding); + } else { + attributes.push(binding); + } + } else { + inbound.push(binding); + } + } + + if(outbound.length) { + disp.append('<h4>Outbound links</h4>'); + var table = $('<table>').appendTo(disp); + for(var i=0; i<outbound.length; i++) { + var linkAttributes = outbound[i].sidP.value + ': ' + outbound[i].sidO.value; + table.append('<tr><td>' + outbound[i].p.value + '</td><td><a href="#">' + outbound[i].o.value + '</a></td><td>' + linkAttributes + '</td></tr>'); + } + } + + if(inbound.length) { + disp.append('<h4>Inbound links</h4>'); + var table = $('<table>').appendTo(disp); + for(var i=0; i<inbound.length; i++) { + var linkAttributes = inbound[i].sidP.value + ': ' + inbound[i].sidO.value; + table.append('<tr><td><a href="#">' + inbound[i].s.value + '</a></td><td>' + inbound[i].p.value + '</td><td>' + linkAttributes + '</td></tr>'); + } + } + + if(attributes.length) { + disp.append('<h4>Attributes</h4>'); + var table = $('<table>').appendTo(disp); + for(var i=0; i<attributes.length; i++) { + table.append('<tr><td>' + attributes[i].p.value + '</td><td>' + attributes[i].o.value + '</td></tr>'); + } + } + + disp.find('a').click(function() { loadURI(this.text); return false; }); +} + +function updateNavigationError(jqXHR, textStatus, errorThrown) { + $('#navigator-display').html('Error! ' + textStatus + ' ' + errorThrown); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-24 23:06:45
|
Revision: 7886 http://sourceforge.net/p/bigdata/code/7886 Author: tobycraig Date: 2014-02-24 23:06:39 +0000 (Mon, 24 Feb 2014) Log Message: ----------- Fixed query explanation and made it detailed. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/style.css branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-24 22:37:29 UTC (rev 7885) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-24 23:06:39 UTC (rev 7886) @@ -104,7 +104,7 @@ <a href="#" id="advanced-features-toggle">Advanced features</a> <div id="advanced-features"> - <input type="checkbox" name="explain" value="true" id="query-explain"> <label for="query-explain">Explain</label> + <input type="checkbox" name="explain" value="details" id="query-explain"> <label for="query-explain">Explain</label> <input type="checkbox" name="analytic" value="true" id="query-analytic"> <label for="query-analytic">Analytic</label> <input type="checkbox" name="RTO" value="true" id="query-rto"> <label for="query-rto">Runtime Query Optimizer</label> </div> Modified: branches/RDR/bigdata-war/src/html/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/style.css 2014-02-24 22:37:29 UTC (rev 7885) +++ branches/RDR/bigdata-war/src/html/style.css 2014-02-24 23:06:39 UTC (rev 7886) @@ -106,6 +106,7 @@ border: 1px solid; border-bottom: none; min-height: 100px; + overflow-x: scroll; } .box:last-of-type { @@ -171,3 +172,7 @@ padding: 2px; } +pre { + font-family: monospace; +} + Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-24 22:37:29 UTC (rev 7885) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-24 23:06:39 UTC (rev 7886) @@ -250,11 +250,18 @@ var settings = { type: 'POST', data: $(this).serialize(), - dataType: 'json', - accepts: {'json': 'application/sparql-results+json'}, success: showQueryResults, error: queryResultsError } + + // queries return JSON, explanations return HTML + if($('#query-explain').is(':checked')) { + settings.dataType = 'html'; + } else { + settings.dataType = 'json'; + settings.accepts = {'json': 'application/sparql-results+json'}; + } + $.ajax('/sparql', settings); return false; }); @@ -264,25 +271,28 @@ }); function showQueryResults(data) { - $('#query-response').html(''); - var table = $('<table>').appendTo($('#query-response')); - var thead = $('<thead>').appendTo(table); - var vars = []; - var tr = $('<tr>'); - for(var i=0; i<data.head.vars.length; i++) { - tr.append('<td>' + data.head.vars[i] + '</td>'); - vars.push(data.head.vars[i]); - } - thead.append(tr); - table.append(thead); - for(var i=0; i<data.results.bindings.length; i++) { + if(this.dataType == 'html') { + $('#query-response').html(data); + } else { + $('#query-response').html(''); + var table = $('<table>').appendTo($('#query-response')); + var thead = $('<thead>').appendTo(table); + var vars = []; var tr = $('<tr>'); - for(var j=0; j<vars.length; j++) { - tr.append('<td>' + data.results.bindings[i][vars[j]].value + '</td>'); + for(var i=0; i<data.head.vars.length; i++) { + tr.append('<td>' + data.head.vars[i] + '</td>'); + vars.push(data.head.vars[i]); } - table.append(tr); + thead.append(tr); + table.append(thead); + for(var i=0; i<data.results.bindings.length; i++) { + var tr = $('<tr>'); + for(var j=0; j<vars.length; j++) { + tr.append('<td>' + data.results.bindings[i][vars[j]].value + '</td>'); + } + table.append(tr); + } } - } function queryResultsError(jqXHR, textStatus, errorThrown) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-26 19:59:53
|
Revision: 7891 http://sourceforge.net/p/bigdata/code/7891 Author: tobycraig Date: 2014-02-26 19:59:50 +0000 (Wed, 26 Feb 2014) Log Message: ----------- Added namespace selection/deletion support. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-25 17:33:49 UTC (rev 7890) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-26 19:59:50 UTC (rev 7891) @@ -12,7 +12,7 @@ <div id="top"> <img src="logo.png" id="logo"> <p><label for="search-text">Search:</label> <input type="text" id="search-text"></p> - <p>Current namespace: <span id="current-namespace">kb</span></p> + <p>Current namespace: <span id="current-namespace"></span></p> </div> <div id="tab-selector"> @@ -135,7 +135,15 @@ <div class="tab" id="status-tab">status </div> - <div class="tab" id="namespaces-tab">namespaces + <div class="tab" id="namespaces-tab"> + + <div class="box"> + <ul id="namespaces-list"> + + </ul> + <button id="namespaces-refresh">Refresh</button> + </div> + </div> </div> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-25 17:33:49 UTC (rev 7890) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 19:59:50 UTC (rev 7891) @@ -24,17 +24,56 @@ function getNamespaces() { $.get('/namespace', function(data) { - var namespaces = data.getElementsByTagName('Namespace'); + $('#namespaces-list').empty(); + var rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; + var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description') for(var i=0; i<namespaces.length; i++) { - var namespace = namespaces[i].textContent; + var title = namespaces[i].getElementsByTagName('title')[0].textContent; + var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); + $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + title + ' - <a href="#" class="use-namespace">Use</a> - <a href="#" class="delete-namespace">Delete</a></li>'); } + $('.use-namespace').click(function(e) { + e.preventDefault(); + useNamespace($(this).parent().data('name'), $(this).parent().data('url')); + }); + $('.delete-namespace').click(function(e) { + e.preventDefault(); + deleteNamespace($(this).parent().data('name')); + }); }); } +function useNamespace(name, url) { + $('#current-namespace').html(name); + $('.namespace').val(name); + NAMESPACE = name; + NAMESPACE_URL = url; +} + +function deleteNamespace(namespace) { + if(confirm('Are you sure you want to delete the namespace ' + namespace + '?')) { + // FIXME: should we check if the default namespace is the one being deleted? + if(namespace == NAMESPACE) { + // FIXME: what is the desired behaviour when deleting the current namespace? + } + var url = '/namespace/' + namespace; + var settings = { + type: 'DELETE', + success: getNamespaces, + error: function() { alert('Could not delete namespace ' + namespace); } + }; + $.ajax(url, settings); + } +} + +var NAMESPACE, NAMESPACE_URL; // default namespace -namespace = 'kb'; -$('.namespace').val(namespace); +useNamespace('kb', '/namespace/kb/sparql'); +getNamespaces(); +$('#namespaces-refresh').click(getNamespaces); + + /* Namespace shortcuts */ $('.namespace-shortcuts li').click(function() { @@ -192,16 +231,17 @@ $('#load-type').change(handleTypeChange); $('#load-load').click(function() { - // determine action based on type var settings = { type: 'POST', data: $(holder).val(), success: updateResponseXML, error: updateResponseError } + + // determine action based on type switch($('#load-type').val()) { case 'sparql': - settings.data = 'update=' + encodeURI(settings.data); + settings.data = 'update=' + encodeURIComponent(settings.data); settings.success = updateResponseHTML; break; case 'rdf': @@ -213,11 +253,11 @@ settings.contentType = rdf_content_types[type]; break; case 'path': - settings.data = 'uri=file://' + encodeURI(settings.data); + settings.data = 'uri=file://' + encodeURIComponent(settings.data); break; } - $.ajax('/sparql', settings); + $.ajax(NAMESPACE_URL, settings); }); $('#load-clear').click(function() { @@ -262,7 +302,7 @@ settings.accepts = {'json': 'application/sparql-results+json'}; } - $.ajax('/sparql', settings); + $.ajax(NAMESPACE_URL, settings); return false; }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-26 20:35:18
|
Revision: 7892 http://sourceforge.net/p/bigdata/code/7892 Author: tobycraig Date: 2014-02-26 20:35:12 +0000 (Wed, 26 Feb 2014) Log Message: ----------- Added keyboard shortcuts to switch between tabs. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Added Paths: ----------- branches/RDR/bigdata-war/src/html/jquery.hotkeys.js Added: branches/RDR/bigdata-war/src/html/jquery.hotkeys.js =================================================================== --- branches/RDR/bigdata-war/src/html/jquery.hotkeys.js (rev 0) +++ branches/RDR/bigdata-war/src/html/jquery.hotkeys.js 2014-02-26 20:35:12 UTC (rev 7892) @@ -0,0 +1,110 @@ +/* + * jQuery Hotkeys Plugin + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Based upon the plugin by Tzury Bar Yochay: + * http://github.com/tzuryby/hotkeys + * + * Original idea by: + * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ +*/ + +/* + * One small change is: now keys are passed by object { keys: '...' } + * Might be useful, when you want to pass some other data to your handler + */ + +(function(jQuery){ + + jQuery.hotkeys = { + version: "0.8", + + specialKeys: { + 8: "backspace", 9: "tab", 10: "return", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", + 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", + 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", + 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", + 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", + 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", + 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 186: ";", 191: "/", + 220: "\\", 222: "'", 224: "meta" + }, + + shiftNums: { + "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", + "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", + ".": ">", "/": "?", "\\": "|" + } + }; + + function keyHandler( handleObj ) { + if ( typeof handleObj.data === "string" ) { + handleObj.data = { keys: handleObj.data }; + } + + // Only care when a possible input has been specified + if ( !handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string" ) { + return; + } + + var origHandler = handleObj.handler, + keys = handleObj.data.keys.toLowerCase().split(" "), + textAcceptingInputTypes = ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color", "tel"]; + + handleObj.handler = function( event ) { + // Don't fire in text-accepting inputs that we didn't directly bind to + if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || + jQuery.inArray(event.target.type, textAcceptingInputTypes) > -1 ) ) { + return; + } + + var special = jQuery.hotkeys.specialKeys[ event.keyCode ], + character = String.fromCharCode( event.which ).toLowerCase(), + modif = "", possible = {}; + + // check combinations (alt|ctrl|shift+anything) + if ( event.altKey && special !== "alt" ) { + modif += "alt+"; + } + + if ( event.ctrlKey && special !== "ctrl" ) { + modif += "ctrl+"; + } + + // TODO: Need to make sure this works consistently across platforms + if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { + modif += "meta+"; + } + + if ( event.shiftKey && special !== "shift" ) { + modif += "shift+"; + } + + if ( special ) { + possible[ modif + special ] = true; + } + + if ( character ) { + possible[ modif + character ] = true; + possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; + + // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" + if ( modif === "shift+" ) { + possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; + } + } + + for ( var i = 0, l = keys.length; i < l; i++ ) { + if ( possible[ keys[i] ] ) { + return origHandler.apply( this, arguments ); + } + } + }; + } + + jQuery.each([ "keydown", "keyup", "keypress" ], function() { + jQuery.event.special[ this ] = { add: keyHandler }; + }); + +})( this.jQuery ); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-26 19:59:50 UTC (rev 7891) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-26 20:35:12 UTC (rev 7892) @@ -150,7 +150,8 @@ <!--[if IE]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> - <script>window.jQuery || document.write('<script src="/jquery.min.js"><\/script>')</script> + <script>window.jQuery || document.write('<script src="jquery.min.js"><\/script>')</script> + <script src="jquery.hotkeys.js"></script> <script src="workbench.js"></script> </body> </html> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 19:59:50 UTC (rev 7891) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 20:35:12 UTC (rev 7892) @@ -20,6 +20,28 @@ window.location.hash = tab; } +function moveTab(next) { + // get current position + var current = $('#tab-selector .active'); + if(next) { + if(current.next().length) { + current.next().click(); + } else { + $('#tab-selector a:first').click(); + } + } else { + if(current.prev().length) { + current.prev().click(); + } else { + $('#tab-selector a:last').click(); + } + } +} + +// these should be , and . but Hotkeys views those keypresses as these characters +$(document).bind('keydown', 'ctrl+¼', function() { moveTab(false); }); +$(document).bind('keydown', 'ctrl+¾', function() { moveTab(true); }); + /* Namespaces */ function getNamespaces() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-26 23:44:15
|
Revision: 7893 http://sourceforge.net/p/bigdata/code/7893 Author: tobycraig Date: 2014-02-26 23:44:11 +0000 (Wed, 26 Feb 2014) Log Message: ----------- Disallow uploads larger than 1MB and remove hidden field for containing them. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-26 20:35:12 UTC (rev 7892) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-26 23:44:11 UTC (rev 7893) @@ -41,8 +41,6 @@ </ul> </div> - <input id="load-hidden" type="hidden" name="large-file-contents"> - <p id="large-file-message">Your file is too large to display here, but will be uploaded as normal.</p> <textarea id="load-box" placeholder="(Type in or drag a file containing RDF data, a SPARQL update or a file path or URL)"></textarea> <p> <label for="load-type">Type:</label> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 20:35:12 UTC (rev 7892) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-26 23:44:11 UTC (rev 7893) @@ -135,32 +135,20 @@ var f = files[0]; // if file is too large, tell user to supply local path - if(f.size > 100 * 1048576) { + if(f.size > 1048576) { alert('File too large, enter local path to file'); $('#load-box').val('/path/to/' + f.name); setType('path'); - $('#load-file').val(''); $('#large-file-message').hide(); - return; - } - - // if file is small enough, populate the textarea with it - if(f.size < 10 * 1024) { - holder = '#load-box'; - $('#load-hidden').val(''); - $('#large-file-message').hide(); } else { - // store file contents in hidden input and clear textarea - holder = '#load-hidden'; - $('#load-box').val(''); - $('#large-file-message').show(); + // display file contents in the textarea + var fr = new FileReader(); + fr.onload = function(e2) { + $('#load-box').val(e2.target.result); + guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); + }; + fr.readAsText(f); } - var fr = new FileReader(); - fr.onload = function(e2) { - $(holder).val(e2.target.result); - guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); - }; - fr.readAsText(f); $('#load-file').val(''); } @@ -243,8 +231,6 @@ 'turtle': 'text/turtle'}; var sparql_update_commands = ['INSERT', 'DELETE']; -// stores the id of the element that contains the data to be sent -var holder = '#load-box'; $('#load-file').change(handleFile); $('#load-box').on('dragover', handleDragOver); @@ -255,7 +241,7 @@ $('#load-load').click(function() { var settings = { type: 'POST', - data: $(holder).val(), + data: $('#load-box').val(), success: updateResponseXML, error: updateResponseError } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-27 23:09:10
|
Revision: 7896 http://sourceforge.net/p/bigdata/code/7896 Author: tobycraig Date: 2014-02-27 23:09:07 +0000 (Thu, 27 Feb 2014) Log Message: ----------- #823 - Disable textarea when a large file is selected Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-27 19:07:35 UTC (rev 7895) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-27 23:09:07 UTC (rev 7896) @@ -42,7 +42,9 @@ </div> <textarea id="load-box" placeholder="(Type in or drag a file containing RDF data, a SPARQL update or a file path or URL)"></textarea> + <p id="large-file-message">Your file is too large to display here, but will be uploaded as normal. <a href="#" id="clear-file">Remove file</a></p> <p> + <input type="file" id="load-file"><br> <label for="load-type">Type:</label> <select id="load-type"> <option value="sparql" selected="selected">SPARQL</option> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-27 19:07:35 UTC (rev 7895) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-27 23:09:07 UTC (rev 7896) @@ -88,7 +88,7 @@ } } -var NAMESPACE, NAMESPACE_URL; +var NAMESPACE, NAMESPACE_URL, fileContents; // default namespace useNamespace('kb', '/namespace/kb/sparql'); getNamespaces(); @@ -135,23 +135,43 @@ var f = files[0]; // if file is too large, tell user to supply local path - if(f.size > 1048576) { + if(f.size > 1048576 * 100) { alert('File too large, enter local path to file'); $('#load-box').val('/path/to/' + f.name); setType('path'); - $('#large-file-message').hide(); + $('#load-box').prop('disabled', false) + $('#large-file-message, #clear-file').hide(); } else { - // display file contents in the textarea var fr = new FileReader(); fr.onload = function(e2) { - $('#load-box').val(e2.target.result); + if(f.size > 10240) { + // do not use textarea + $('#load-box').prop('disabled', true) + $('#large-file-message, #clear-file').show() + $('#load-box').val(''); + fileContents = e2.target.result; + } else { + // display file contents in the textarea + clearFile(); + $('#load-box').val(e2.target.result); + } guessType(f.name.split('.').pop().toLowerCase(), e2.target.result); }; fr.readAsText(f); } + $('#load-file').val(''); } +function clearFile(e) { + if(e) { + e.preventDefault(); + } + $('#load-box').prop('disabled', false) + $('#large-file-message, #clear-file').hide() + fileContents = null; +} + function guessType(extension, content) { // try to guess type if(extension == 'rq') { @@ -237,11 +257,12 @@ $('#load-box').on('drop', handleFile); $('#load-box').on('paste', handlePaste); $('#load-type').change(handleTypeChange); +$('#clear-file').click(clearFile); $('#load-load').click(function() { var settings = { type: 'POST', - data: $('#load-box').val(), + data: fileContents == null ? $('#load-box').val() : fileContents, success: updateResponseXML, error: updateResponseError } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-27 23:42:13
|
Revision: 7897 http://sourceforge.net/p/bigdata/code/7897 Author: tobycraig Date: 2014-02-27 23:42:09 +0000 (Thu, 27 Feb 2014) Log Message: ----------- #819 - Retrieve default namespace on page load Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-27 23:09:07 UTC (rev 7896) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-27 23:42:09 UTC (rev 7897) @@ -141,7 +141,6 @@ <ul id="namespaces-list"> </ul> - <button id="namespaces-refresh">Refresh</button> </div> </div> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-27 23:09:07 UTC (rev 7896) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-27 23:42:09 UTC (rev 7897) @@ -51,8 +51,9 @@ var namespaces = namespaces = data.getElementsByTagNameNS(rdf, 'Description') for(var i=0; i<namespaces.length; i++) { var title = namespaces[i].getElementsByTagName('title')[0].textContent; + var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); - $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + title + ' - <a href="#" class="use-namespace">Use</a> - <a href="#" class="delete-namespace">Delete</a></li>'); + $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - <a href="#" class="use-namespace">Use</a> - <a href="#" class="delete-namespace">Delete</a></li>'); } $('.use-namespace').click(function(e) { e.preventDefault(); @@ -88,12 +89,17 @@ } } -var NAMESPACE, NAMESPACE_URL, fileContents; -// default namespace -useNamespace('kb', '/namespace/kb/sparql'); -getNamespaces(); +function getDefaultNamespace() { + $.get('/sparql', function(data) { + DEFAULT_NAMESPACE = $(data).find('Description[rdf\\:nodeID=defaultDataset]').find('title')[0].textContent; + var url = $(data).find('Description[rdf\\:nodeID=defaultDataset]').find('sparqlEndpoint')[0].attributes['rdf:resource'].textContent; + useNamespace(DEFAULT_NAMESPACE, url); + getNamespaces(); + }); +} +var DEFAULT_NAMESPACE, NAMESPACE, NAMESPACE_URL, fileContents; -$('#namespaces-refresh').click(getNamespaces); +getDefaultNamespace(); /* Namespace shortcuts */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-28 01:21:56
|
Revision: 7899 http://sourceforge.net/p/bigdata/code/7899 Author: tobycraig Date: 2014-02-28 01:21:52 +0000 (Fri, 28 Feb 2014) Log Message: ----------- #822 - Display results as well as explanation when explain query is selected Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/style.css branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-28 00:21:09 UTC (rev 7898) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-28 01:21:52 UTC (rev 7899) @@ -104,7 +104,7 @@ <a href="#" id="advanced-features-toggle">Advanced features</a> <div id="advanced-features"> - <input type="checkbox" name="explain" value="details" id="query-explain"> <label for="query-explain">Explain</label> + <input type="checkbox" id="query-explain"> <label for="query-explain">Explain</label> <input type="checkbox" name="analytic" value="true" id="query-analytic"> <label for="query-analytic">Analytic</label> <input type="checkbox" name="RTO" value="true" id="query-rto"> <label for="query-rto">Runtime Query Optimizer</label> </div> @@ -122,6 +122,9 @@ <div id="query-response" class="box"> </div> + <div id="query-explanation" class="box"> + </div> + <div class="bottom"> <button id="query-export">Export</button> <button id="query-response-clear">Clear</button> Modified: branches/RDR/bigdata-war/src/html/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/style.css 2014-02-28 00:21:09 UTC (rev 7898) +++ branches/RDR/bigdata-war/src/html/style.css 2014-02-28 01:21:52 UTC (rev 7899) @@ -163,7 +163,7 @@ text-align: right; } -#advanced-features { +#advanced-features, #query-explanation { display: none; } Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 00:21:09 UTC (rev 7898) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 01:21:52 UTC (rev 7899) @@ -335,51 +335,61 @@ var settings = { type: 'POST', data: $(this).serialize(), + dataType: 'json', + accepts: {'json': 'application/sparql-results+json'}, success: showQueryResults, error: queryResultsError } - // queries return JSON, explanations return HTML + $.ajax(NAMESPACE_URL, settings); + + $('#query-explanation').empty(); if($('#query-explain').is(':checked')) { - settings.dataType = 'html'; + settings = { + type: 'POST', + data: $(this).serialize() + '&explain=details', + dataType: 'html', + success: showQueryExplanation, + error: queryResultsError + }; + $.ajax(NAMESPACE_URL, settings); } else { - settings.dataType = 'json'; - settings.accepts = {'json': 'application/sparql-results+json'}; + $('#query-explanation').hide(); } - $.ajax(NAMESPACE_URL, settings); return false; }); $('#query-response-clear').click(function() { - $('#query-response').html(''); + $('#query-response, #query-explanation').empty(''); + $('#query-explanation').hide(); }); function showQueryResults(data) { - if(this.dataType == 'html') { - $('#query-response').html(data); - } else { - $('#query-response').html(''); - var table = $('<table>').appendTo($('#query-response')); - var thead = $('<thead>').appendTo(table); - var vars = []; + $('#query-response').empty(); + var table = $('<table>').appendTo($('#query-response')); + var thead = $('<thead>').appendTo(table); + var vars = []; + var tr = $('<tr>'); + for(var i=0; i<data.head.vars.length; i++) { + tr.append('<td>' + data.head.vars[i] + '</td>'); + vars.push(data.head.vars[i]); + } + thead.append(tr); + table.append(thead); + for(var i=0; i<data.results.bindings.length; i++) { var tr = $('<tr>'); - for(var i=0; i<data.head.vars.length; i++) { - tr.append('<td>' + data.head.vars[i] + '</td>'); - vars.push(data.head.vars[i]); + for(var j=0; j<vars.length; j++) { + tr.append('<td>' + data.results.bindings[i][vars[j]].value + '</td>'); } - thead.append(tr); - table.append(thead); - for(var i=0; i<data.results.bindings.length; i++) { - var tr = $('<tr>'); - for(var j=0; j<vars.length; j++) { - tr.append('<td>' + data.results.bindings[i][vars[j]].value + '</td>'); - } - table.append(tr); - } + table.append(tr); } } +function showQueryExplanation(data) { + $('#query-explanation').html(data).show(); +} + function queryResultsError(jqXHR, textStatus, errorThrown) { $('#query-response').text('Error! ' + textStatus + ' ' + errorThrown); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-28 18:42:30
|
Revision: 7900 http://sourceforge.net/p/bigdata/code/7900 Author: tobycraig Date: 2014-02-28 18:42:27 +0000 (Fri, 28 Feb 2014) Log Message: ----------- #827 - Basic explore tab functionality Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/style.css branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-28 01:21:52 UTC (rev 7899) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-28 18:42:27 UTC (rev 7900) @@ -132,7 +132,14 @@ </div> - <div class="tab" id="explore-tab">explore + <div class="tab" id="explore-tab"> + + <div class="box"> + <p>Enter a URI to begin navigation <form id="explore-form"><input type="text"> <input type="submit"></form></p> + </div> + + <div class="box" id="explore-results"> + </div> </div> <div class="tab" id="status-tab">status Modified: branches/RDR/bigdata-war/src/html/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/style.css 2014-02-28 01:21:52 UTC (rev 7899) +++ branches/RDR/bigdata-war/src/html/style.css 2014-02-28 18:42:27 UTC (rev 7900) @@ -169,7 +169,7 @@ td { border: 1px solid; - padding: 2px; + padding: 5px; } pre { Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 01:21:52 UTC (rev 7899) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 18:42:27 UTC (rev 7900) @@ -395,15 +395,14 @@ } -/* Navigator */ +/* Explore */ -$('#navigator').submit(function() { - // get URI - var uri = $('#navigator-uri').val(); +$('#explore-form').submit(function(e) { + e.preventDefault(); + var uri = $(this).find('input').val(); if(uri) { loadURI(uri); } - return false; }); function loadURI(uri) { @@ -440,14 +439,14 @@ data: 'query=' + encodeURI(query), dataType: 'json', accepts: {'json': 'application/sparql-results+json'}, - success: updateNavigationStart, - error: updateNavigationError + success: updateExploreStart, + error: updateExploreError }; $.ajax('/sparql', settings); } -function updateNavigationStart(data) { - var disp = $('#navigator-display'); +function updateExploreStart(data) { + var disp = $('#explore-results'); disp.html(''); // see if we got any results if(data.results.bindings.length == 0) { @@ -498,11 +497,11 @@ } } - disp.find('a').click(function() { loadURI(this.text); return false; }); + disp.find('a').click(function(e) { e.preventDefault(); loadURI(this.text); }); } -function updateNavigationError(jqXHR, textStatus, errorThrown) { - $('#navigator-display').html('Error! ' + textStatus + ' ' + errorThrown); +function updateExploreError(jqXHR, textStatus, errorThrown) { + $('#explore-results').html('Error! ' + textStatus + ' ' + errorThrown); } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-02-28 19:56:32
|
Revision: 7902 http://sourceforge.net/p/bigdata/code/7902 Author: tobycraig Date: 2014-02-28 19:56:28 +0000 (Fri, 28 Feb 2014) Log Message: ----------- Removed unnecessary hidden input for namespace Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-02-28 18:57:43 UTC (rev 7901) +++ branches/RDR/bigdata-war/src/html/new.html 2014-02-28 19:56:28 UTC (rev 7902) @@ -97,8 +97,6 @@ </div> <form id="query-form"> - <input type="hidden" class="namespace" name="namespace"> - <textarea id="query-box" name="query" placeholder="(Input a SPARQL query)"></textarea> <a href="#" id="advanced-features-toggle">Advanced features</a> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 18:57:43 UTC (rev 7901) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-02-28 19:56:28 UTC (rev 7902) @@ -68,7 +68,6 @@ function useNamespace(name, url) { $('#current-namespace').html(name); - $('.namespace').val(name); NAMESPACE = name; NAMESPACE_URL = url; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-04 01:06:19
|
Revision: 7906 http://sourceforge.net/p/bigdata/code/7906 Author: tobycraig Date: 2014-03-04 01:06:16 +0000 (Tue, 04 Mar 2014) Log Message: ----------- #829 - Added XML export support. Language tags still to be done Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-03 19:18:48 UTC (rev 7905) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-04 01:06:16 UTC (rev 7906) @@ -124,7 +124,9 @@ </div> <div class="bottom"> - <button id="query-export">Export</button> + <button id="query-export-csv">Export CSV</button> + <button id="query-export-json">Export JSON</button> + <button id="query-export-xml">Export XML</button> <button id="query-response-clear">Clear</button> </div> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-03-03 19:18:48 UTC (rev 7905) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-03-04 01:06:16 UTC (rev 7906) @@ -373,7 +373,39 @@ $('#query-explanation').hide(); }); -$('#query-export').click(function() { +$('#query-export-csv').click(exportCSV); +$('#query-export-xml').click(exportXML); + +function exportXML() { + var xml = '<?xml version="1.0"?>\n<sparql xmlns="http://www.w3.org/2005/sparql-results#">\n\t<head>\n'; + var bindings = []; + $('#query-response thead tr td').each(function(i, td) { + xml += '\t\t<variable name="' + td.textContent + '"/>\n'; + bindings.push(td.textContent); + }); + xml += '\t</head>\n\t<results>\n'; + $('#query-response tbody tr').each(function(i, tr) { + xml += '\t\t<result>\n'; + $(tr).find('td').each(function(j, td) { + var bindingType = td.className; + if(bindingType == 'unbound') { + return; + } + var dataType = $(td).data('datatype'); + if(dataType) { + dataType = ' datatype="' + dataType + '"'; + } else { + dataType = ''; + } + xml += '\t\t\t<binding name="' + bindings[j] + '"><' + bindingType + dataType + '>' + td.textContent + '</' + bindingType + '></binding>\n'; + }); + xml += '\t\t</result>\n'; + }); + xml += '\t</results>\n</sparql>\n'; + downloadFile(xml, 'application/sparql-results+xml', 'export.xml'); +} + +function exportCSV() { // FIXME: escape commas var csv = ''; $('#query-response table tr').each(function(i, tr) { @@ -385,10 +417,14 @@ }); csv += '\n'; }); - var uri = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv); - $('<a id="download-link" download="export.csv" href="' + uri + '">').appendTo('body')[0].click(); + downloadFile(csv, 'application/csv', 'export.csv'); +} + +function downloadFile(data, type, filename) { + var uri = 'data:' + type + ';charset=utf-8,' + encodeURIComponent(data); + $('<a id="download-link" download="' + filename + '" href="' + uri + '">').appendTo('body')[0].click(); $('#download-link').remove(); -}); +} function showQueryResults(data) { $('#query-response').empty(); @@ -431,7 +467,18 @@ for(var i=0; i<data.results.bindings.length; i++) { var tr = $('<tr>'); for(var j=0; j<vars.length; j++) { - tr.append('<td>' + data.results.bindings[i][vars[j]].value + '</td>'); + if(vars[j] in data.results.bindings[i]) { + var binding = data.results.bindings[i][vars[j]]; + if(binding.type == 'typed-literal') { + var tdData = ' class="literal" data-datatype="' + binding.datatype + '"'; + } else { + var tdData = ' class="' + binding.type + '"'; + } + tr.append('<td' + tdData + '>' + binding.value + '</td>'); + } else { + // no binding + tr.append('<td class="unbound">'); + } } table.append(tr); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-04 19:50:12
|
Revision: 7908 http://sourceforge.net/p/bigdata/code/7908 Author: tobycraig Date: 2014-03-04 19:50:06 +0000 (Tue, 04 Mar 2014) Log Message: ----------- #836 - Added simple create namespace form Modified Paths: -------------- branches/RDR/bigdata-war/src/html/new.html branches/RDR/bigdata-war/src/html/workbench.js Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-04 19:12:18 UTC (rev 7907) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-04 19:50:06 UTC (rev 7908) @@ -151,6 +151,8 @@ <ul id="namespaces-list"> </ul> + + <form id="namespace-create"><input type="text"> <input type="submit" value="Create namespace"></form> </div> </div> Modified: branches/RDR/bigdata-war/src/html/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/workbench.js 2014-03-04 19:12:18 UTC (rev 7907) +++ branches/RDR/bigdata-war/src/html/workbench.js 2014-03-04 19:50:06 UTC (rev 7908) @@ -88,6 +88,26 @@ } } +function createNamespace(e) { + e.preventDefault(); + var namespace = $(this).find('input').val(); + if(!namespace) { + return; + } + // TODO: validate namespace + // TODO: allow for other options to be specified + var data = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">\n<properties>\n<entry key="com.bigdata.rdf.sail.namespace">' + namespace + '</entry>\n</properties>'; + var settings = { + type: 'POST', + data: data, + contentType: 'application/xml', + success: getNamespaces, + error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } + }; + $.ajax('/namespace', settings); +} +$('#namespace-create').submit(createNamespace); + function getDefaultNamespace() { $.get('/sparql', function(data) { // Chrome does not work with rdf\:Description, so look for Description too This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-11 20:42:52
|
Revision: 7931 http://sourceforge.net/p/bigdata/code/7931 Author: tobycraig Date: 2014-03-11 20:42:49 +0000 (Tue, 11 Mar 2014) Log Message: ----------- #843 - Initial implementation of Status and Performance tabs. Needs work to prevent user being taken away from workbench. Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-11 20:16:38 UTC (rev 7930) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-11 20:42:49 UTC (rev 7931) @@ -691,4 +691,20 @@ $('#explore-results').html('Error! ' + textStatus + ' ' + errorThrown); } +/* Status */ + +$('#tab-selector a[data-target=status]').click(function(e) { + $.get('/bigdata/status', function(data) { + $('#status-tab .box').html(data); + }); }); + +/* Performance */ + +$('#tab-selector a[data-target=performance]').click(function(e) { + $.get('/bigdata/counters', function(data) { + $('#performance-tab .box').html(data); + }); +}); + +}); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-11 20:16:38 UTC (rev 7930) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-11 20:42:49 UTC (rev 7931) @@ -24,6 +24,7 @@ <a data-target="query">Query</a> <a data-target="explore">Explore</a> <a data-target="status">Status</a> + <a data-target="performance">Performance</a> <a data-target="namespaces">Namespaces</a> </div> @@ -146,9 +147,18 @@ </div> </div> - <div class="tab" id="status-tab">status + <div class="tab" id="status-tab"> + + <div class="box"></div> + </div> + <div class="tab" id="performance-tab"> + + <div class="box"></div> + + </div> + <div class="tab" id="namespaces-tab"> <div class="box"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-12 00:22:08
|
Revision: 7935 http://sourceforge.net/p/bigdata/code/7935 Author: tobycraig Date: 2014-03-12 00:22:02 +0000 (Wed, 12 Mar 2014) Log Message: ----------- #836 - Moved create namespace to its own box, added header, tweaked behaviour Modified Paths: -------------- branches/RDR/bigdata-war/src/html/css/style.css branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/css/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-11 21:49:22 UTC (rev 7934) +++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-12 00:22:02 UTC (rev 7935) @@ -54,6 +54,11 @@ margin: 10px; } +h1 { + font-size: 125%; + margin-bottom: 10px; +} + #container { /*max-width: 600px;*/ } Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-11 21:49:22 UTC (rev 7934) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 00:22:02 UTC (rev 7935) @@ -53,7 +53,13 @@ var title = namespaces[i].getElementsByTagName('title')[0].textContent; var titleText = title == DEFAULT_NAMESPACE ? title + ' (default)' : title; var url = namespaces[i].getElementsByTagName('sparqlEndpoint')[0].getAttributeNS(rdf, 'resource'); - $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - <a href="#" class="use-namespace">Use</a> - <a href="#" class="delete-namespace">Delete</a></li>'); + var use; + if(title == NAMESPACE) { + use = 'In use'; + } else { + use = '<a href="#" class="use-namespace">Use</a>'; + } + $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a></li>'); } $('.use-namespace').click(function(e) { e.preventDefault(); @@ -95,7 +101,8 @@ function createNamespace(e) { e.preventDefault(); - var namespace = $(this).find('input').val(); + var input = $(this).find('input[type=text]'); + var namespace = input.val(); if(!namespace) { return; } @@ -106,7 +113,7 @@ type: 'POST', data: data, contentType: 'application/xml', - success: getNamespaces, + success: function() { input.val(''); getNamespaces(); }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }; $.ajax('/bigdata/namespace', settings); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-11 21:49:22 UTC (rev 7934) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-12 00:22:02 UTC (rev 7935) @@ -162,10 +162,11 @@ <div class="tab" id="namespaces-tab"> <div class="box"> - <ul id="namespaces-list"> + <h1>Namespaces</h1> + <ul id="namespaces-list"></ul> + </div> - </ul> - + <div class="box"> <form id="namespace-create"><input type="text"> <input type="submit" value="Create namespace"></form> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-12 01:13:16
|
Revision: 7936 http://sourceforge.net/p/bigdata/code/7936 Author: tobycraig Date: 2014-03-12 01:13:11 +0000 (Wed, 12 Mar 2014) Log Message: ----------- #845 - Added Properties link to namespaces allowing user to view a namespace's properties Modified Paths: -------------- branches/RDR/bigdata-war/src/html/css/style.css branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/css/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-12 00:22:02 UTC (rev 7935) +++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-12 01:13:11 UTC (rev 7936) @@ -181,3 +181,6 @@ font-family: monospace; } +#namespace-details { + display: none; +} Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 00:22:02 UTC (rev 7935) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 01:13:11 UTC (rev 7936) @@ -59,7 +59,7 @@ } else { use = '<a href="#" class="use-namespace">Use</a>'; } - $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a></li>'); + $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a> - <a href="#" class="namespace-properties">Properties</a></li>'); } $('.use-namespace').click(function(e) { e.preventDefault(); @@ -69,6 +69,10 @@ e.preventDefault(); deleteNamespace($(this).parent().data('name')); }); + $('.namespace-properties').click(function(e) { + e.preventDefault(); + getNamespaceProperties($(this).parent().data('name')); + }); }); } @@ -99,6 +103,18 @@ } } +function getNamespaceProperties(namespace) { + $('#namespace-properties h1').html(namespace); + $('#namespace-properties ul').empty(); + $('#namespace-properties').show(); + var url = '/bigdata/namespace/' + namespace + '/properties'; + $.get(url, function(data) { + $.each(data.getElementsByTagName('entry'), function(i, entry) { + $('#namespace-properties ul').append('<li>' + entry.getAttribute('key') + ': ' + entry.textContent + '</li>'); + }); + }); +} + function createNamespace(e) { e.preventDefault(); var input = $(this).find('input[type=text]'); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-12 00:22:02 UTC (rev 7935) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-12 01:13:11 UTC (rev 7936) @@ -166,6 +166,11 @@ <ul id="namespaces-list"></ul> </div> + <div id="namespace-properties" class="box"> + <h1></h1> + <ul></ul> + </div> + <div class="box"> <form id="namespace-create"><input type="text"> <input type="submit" value="Create namespace"></form> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-12 20:33:22
|
Revision: 7944 http://sourceforge.net/p/bigdata/code/7944 Author: tobycraig Date: 2014-03-12 20:33:19 +0000 (Wed, 12 Mar 2014) Log Message: ----------- #845 - Put namespace properties in a table Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 17:48:28 UTC (rev 7943) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 20:33:19 UTC (rev 7944) @@ -108,12 +108,12 @@ function getNamespaceProperties(namespace) { $('#namespace-properties h1').html(namespace); - $('#namespace-properties ul').empty(); + $('#namespace-properties table').empty(); $('#namespace-properties').show(); var url = '/bigdata/namespace/' + namespace + '/properties'; $.get(url, function(data) { $.each(data.getElementsByTagName('entry'), function(i, entry) { - $('#namespace-properties ul').append('<li>' + entry.getAttribute('key') + ': ' + entry.textContent + '</li>'); + $('#namespace-properties table').append('<tr><td>' + entry.getAttribute('key') + '</td><td>' + entry.textContent + '</td></tr>'); }); }); } Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-12 17:48:28 UTC (rev 7943) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-12 20:33:19 UTC (rev 7944) @@ -170,7 +170,7 @@ <div id="namespace-properties" class="box"> <h1></h1> - <ul></ul> + <table></table> </div> <div class="box"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-12 21:08:23
|
Revision: 7945 http://sourceforge.net/p/bigdata/code/7945 Author: tobycraig Date: 2014-03-12 21:08:16 +0000 (Wed, 12 Mar 2014) Log Message: ----------- #850 - Search functionality Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 20:33:19 UTC (rev 7944) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-12 21:08:16 UTC (rev 7945) @@ -1,5 +1,19 @@ $(function() { +/* Search */ + +$('#search-form').submit(function(e) { + e.preventDefault(); + var term = $(this).find('input').val(); + if(!term) { + return; + } + var query = 'select * { ?o bds:search "' + term + '" . ?s ?p ?o . }' + $('#query-box').val(query); + $('#query-form').submit(); + showTab('query'); +}); + /* Tab selection */ $('#tab-selector a').click(function(e) { Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-12 20:33:19 UTC (rev 7944) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-12 21:08:16 UTC (rev 7945) @@ -15,7 +15,7 @@ <div id="top"> <img src="/bigdata/html/images/logo.png" id="logo"> - <p><label for="search-text">Search:</label> <input type="text" id="search-text"></p> + <form id="search-form"><label for="search-text">Search:</label> <input type="text" id="search-text"></form> <p>Current namespace: <span id="current-namespace"></span></p> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-13 20:11:30
|
Revision: 7958 http://sourceforge.net/p/bigdata/code/7958 Author: tobycraig Date: 2014-03-13 20:11:25 +0000 (Thu, 13 Mar 2014) Log Message: ----------- #827 - Split results up into separate sections Modified Paths: -------------- branches/RDR/bigdata-war/src/html/css/style.css branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/css/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-13 16:57:19 UTC (rev 7957) +++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-13 20:11:25 UTC (rev 7958) @@ -59,6 +59,11 @@ margin-bottom: 10px; } +h2 { + font-size: 110%; + margin-bottom: 10px; +} + #container { /*max-width: 600px;*/ } @@ -106,11 +111,9 @@ } .box { - border: 1px solid; padding: 10px; border: 1px solid; border-bottom: none; - min-height: 100px; overflow-x: scroll; } @@ -168,7 +171,7 @@ text-align: right; } -#advanced-features, #query-explanation { +#advanced-features, #query-explanation, #explore-results, #namespace-properties { display: none; } @@ -180,7 +183,3 @@ pre { font-family: monospace; } - -#namespace-properties { - display: none; -} Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-13 16:57:19 UTC (rev 7957) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-13 20:11:25 UTC (rev 7958) @@ -673,16 +673,18 @@ } function updateExploreStart(data) { - var disp = $('#explore-results'); - disp.html(''); + var results = data.results.bindings.length > 0; + $('#explore-results').toggle(results); + $('#explore-no-results').toggle(!results); + // see if we got any results - if(data.results.bindings.length == 0) { - disp.append('No vertex found!'); + if(!results) { + $('#explore-no-results').html('<h1>No results found!</h1>'); return; } var vertex = data.results.bindings[0].vertex; - disp.append('<h3>' + vertex.value + '</h3>'); + $('#explore-header h1').text(vertex.value); var outbound=[], inbound=[], attributes=[]; for(var i=0; i<data.results.bindings.length; i++) { var binding = data.results.bindings[i]; @@ -698,33 +700,45 @@ } } + var outgoingContainer = $('#explore-outgoing'); + outgoingContainer.html(''); if(outbound.length) { - disp.append('<h4>Outbound links</h4>'); - var table = $('<table>').appendTo(disp); + outgoingContainer.append('<h2>Outgoing links</h2>'); + var table = $('<table>').appendTo(outgoingContainer); for(var i=0; i<outbound.length; i++) { var linkAttributes = outbound[i].sidP.value + ': ' + outbound[i].sidO.value; table.append('<tr><td>' + outbound[i].p.value + '</td><td><a href="#">' + outbound[i].o.value + '</a></td><td>' + linkAttributes + '</td></tr>'); } + } else { + outgoingContainer.append('<h2>No outgoing links</h2>'); } + var incomingContainer = $('#explore-incoming'); + incomingContainer.html(''); if(inbound.length) { - disp.append('<h4>Inbound links</h4>'); - var table = $('<table>').appendTo(disp); + incomingContainer.append('<h2>Inbound links</h2>'); + var table = $('<table>').appendTo(incomingContainer); for(var i=0; i<inbound.length; i++) { var linkAttributes = inbound[i].sidP.value + ': ' + inbound[i].sidO.value; table.append('<tr><td><a href="#">' + inbound[i].s.value + '</a></td><td>' + inbound[i].p.value + '</td><td>' + linkAttributes + '</td></tr>'); } + } else { + incomingContainer.append('<h2>No incoming links</h2>'); } + var attributesContainer = $('#explore-attributes'); + attributesContainer.html(''); if(attributes.length) { - disp.append('<h4>Attributes</h4>'); - var table = $('<table>').appendTo(disp); + 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>'); } - disp.find('a').click(function(e) { e.preventDefault(); loadURI(this.text); }); + $('#explore-results a').click(function(e) { e.preventDefault(); loadURI(this.text); }); } function updateExploreError(jqXHR, textStatus, errorThrown) { Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-13 16:57:19 UTC (rev 7957) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-13 20:11:25 UTC (rev 7958) @@ -143,8 +143,15 @@ <p>Enter a URI to begin navigation <form id="explore-form"><input type="text"> <input type="submit"></form></p> </div> - <div class="box" id="explore-results"> + <div id="explore-results"> + <div class="box" id="explore-header"><h1></h1></div> + <div class="box" id="explore-incoming"></div> + <div class="box" id="explore-outgoing"></div> + <div class="box" id="explore-attributes"></div> </div> + + <div class="box" id="explore-no-results"></div> + </div> <div class="tab" id="status-tab"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-14 23:21:10
|
Revision: 7971 http://sourceforge.net/p/bigdata/code/7971 Author: tobycraig Date: 2014-03-14 23:21:07 +0000 (Fri, 14 Mar 2014) Log Message: ----------- #827 - Support SIDs in explore panel Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-14 21:58:32 UTC (rev 7970) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-14 23:21:07 UTC (rev 7971) @@ -588,8 +588,7 @@ } else { var text = binding.value; } - // hack to escape HTML characters - text = $('<div/>').text(text).html(); + text = escapeHTML(text); if(binding.type == 'typed-literal') { var tdData = ' class="literal" data-datatype="' + binding.datatype + '"'; } else { @@ -612,7 +611,6 @@ $('#query-response a').click(function(e) { e.preventDefault(); - // var uri = $(this).text(); explore(this.textContent); }); } @@ -626,56 +624,72 @@ $('#query-response').text('Error! ' + textStatus + ' ' + errorThrown); } -function getSID(binding) { - return '<< <' + binding.value['sid-s'].value + '> <' + binding.value['sid-p'].value + '> <' + binding.value['sid-o'].value + '> >>'; -} - -function parseSID(sid) { - var re = /<< <([^<>]*)> <([^<>]*)> <([^<>]*)> >>/; - var matches = sid.match(re); - return {'s': matches[1], 'p': matches[2], 'o': matches[3]}; -} - /* Explore */ $('#explore-form').submit(function(e) { e.preventDefault(); var uri = $(this).find('input').val(); if(uri) { - loadURI(uri); + loadURI(uri); + $('#explore-header h1').text(uri); } }); -function loadURI(uri) { - // send query to server - var query = 'select * \ - where { \ - bind (<URI> as ?vertex) . \ - { \ - bind (<<?vertex ?p ?o>> as ?sid) . \ - optional \ - { \ - { \ - ?sid ?sidP ?sidO . \ - } union { \ - ?sidS ?sidP ?sid . \ - } \ - } \ - } union { \ - bind (<<?s ?p ?vertex>> as ?sid) . \ - optional \ - { \ - { \ - ?sid ?sidP ?sidO . \ - } union { \ - ?sidS ?sidP ?sid . \ - } \ - } \ - } \ - }'; - - query = query.replace('URI', uri); - console.log('Explore query'); +function loadURI(target) { + // identify if this is a vertex or a SID + var re = /< (?:<[^<>]*> ){3}>/; + var vertex = !target.match(re); + + var vertexQuery = '\ +select ?col1 ?col2 ?incoming (count(?star) as ?star) {\n\ + bind (<URI> as ?explore ) .\n\ + {\n\ + bind (<<?explore ?col1 ?col2>> as ?sid) . \n\ + bind (false as ?incoming) . \n\ + optional {\n\ + { ?sid ?sidP ?star } union { ?star ?sidP ?sid }\n\ + }\n\ + } union {\n\ + bind (<<?col1 ?col2 ?explore>> as ?sid) .\n\ + bind (true as ?incoming) . \n\ + optional {\n\ + { ?sid ?sidP ?star } union { ?star ?sidP ?sid }\n\ + }\n\ + }\n\ +}\n\ +group by ?col1 ?col2 ?incoming'; + + var edgeQuery = '\ +select ?col1 ?col2 ?incoming (count(?star) as ?star)\n\ +with {\n\ + select ?explore where {\n\ + bind (<SID> as ?explore) .\n\ + }\n\ +} as %_explore\n\ +where {\n\ + include %_explore .\n\ + {\n\ + bind (<<?explore ?col1 ?col2>> as ?sid) . \n\ + bind (false as ?incoming) . \n\ + optional {\n\ + { ?sid ?sidP ?star } union { ?star ?sidP ?sid }\n\ + }\n\ + } union {\n\ + bind (<<?col1 ?col2 ?explore>> as ?sid) .\n\ + bind (true as ?incoming) . \n\ + optional {\n\ + { ?sid ?sidP ?star } union { ?star ?sidP ?sid }\n\ + }\n\ + }\n\ +}\n\ +group by ?col1 ?col2 ?incoming'; + + if(vertex) { + var query = vertexQuery.replace('URI', target); + } else { + var query = edgeQuery.replace('SID', target); + } + console.log('Explore query for ' + (vertex ? 'vertex ' : 'edge ') + target); console.log(query); var settings = { type: 'POST', @@ -701,20 +715,72 @@ return; } - var vertex = data.results.bindings[0].vertex; - $('#explore-header h1').text(vertex.value); - var outbound=[], inbound=[], attributes=[]; + // clear tables + $('#explore-incoming table, #explore-outgoing table, #explore-attributes table').html(''); + + // go through each binding, adding it to the appropriate table + $.each(data.results.bindings, function(i, binding) { + var cols = [binding.col1, binding.col2].map(function(col) { + if(col.type == 'sid') { + var output = getSID(col); + } else { + var output = col.value; + } + output = escapeHTML(output); + if(col.type == 'uri' || col.type == 'sid') { + output = '<a href="#">' + output + '</a>'; + } + return output; + }); + var star = parseInt(binding.star.value); + if(star > 0) { + if(binding.incoming.value == 'true') { + var sid = '< <' + binding.col1.value + '> <' + binding.col2.value + '> <' + $('#explore-form input[type=text]').val() + '> >'; + } else { + var sid = '< <' + $('#explore-form input[type=text]').val() + '> <' + binding.col1.value + '> <' + binding.col2.value + '> >'; + } + star = '<a href="#" data-sid="' + sid + '">*</a> (' + star + ')'; + } else { + star = ''; + } + var row = '<tr><td>' + cols[0] + '</td><td>' + cols[1] + '</td><td>' + star + '</td></tr>'; + if(binding.incoming.value == 'true') { + $('#explore-incoming table').append(row); + } else { + // either attribute or outgoing + if(binding.col2.type == 'uri') { + // outgoing + $('#explore-outgoing table').append(row); + } else { + // attribute + $('#explore-attributes table').append(row); + } + } + }); + + $('#explore-results a').click(function(e) { + 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]; - // TODO: are attributes always on outbound relationships? + var star = typeof(binding.sidP) != 'undefined'; if('o' in binding) { + var key = [binding.p.value, binding.o.value]; if(binding.o.type == 'uri') { - outbound.push(binding); + // leave star true if it was before, or set it to current value + outbound[key] = !!outbound[key] || star; } else { - attributes.push(binding); + // do not show star for attributes + attributes[key] = false; } } else { - inbound.push(binding); + var key = [binding.s.value, binding.p.value] + inbound[key] == !!inbound[key] || star; } } @@ -723,9 +789,8 @@ if(outbound.length) { outgoingContainer.append('<h2>Outgoing links</h2>'); var table = $('<table>').appendTo(outgoingContainer); - for(var i=0; i<outbound.length; i++) { - var linkAttributes = outbound[i].sidP.value + ': ' + outbound[i].sidO.value; - table.append('<tr><td>' + outbound[i].p.value + '</td><td><a href="#">' + outbound[i].o.value + '</a></td><td>' + linkAttributes + '</td></tr>'); + 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>'); @@ -736,9 +801,8 @@ if(inbound.length) { incomingContainer.append('<h2>Inbound links</h2>'); var table = $('<table>').appendTo(incomingContainer); - for(var i=0; i<inbound.length; i++) { - var linkAttributes = inbound[i].sidP.value + ': ' + inbound[i].sidO.value; - table.append('<tr><td><a href="#">' + inbound[i].s.value + '</a></td><td>' + inbound[i].p.value + '</td><td>' + linkAttributes + '</td></tr>'); + 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>'); @@ -790,4 +854,20 @@ }); }); +/* Utility functions */ + +function getSID(binding) { + return '< <' + binding.value['sid-s'].value + '> <' + binding.value['sid-p'].value + '> <' + binding.value['sid-o'].value + '> >'; +} + +function parseSID(sid) { + var re = /<< <([^<>]*)> <([^<>]*)> <([^<>]*)> >>/; + var matches = sid.match(re); + return {'s': matches[1], 'p': matches[2], 'o': matches[3]}; +} + +function escapeHTML(text) { + return $('<div/>').text(text).html(); +} + }); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-14 21:58:32 UTC (rev 7970) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-14 23:21:07 UTC (rev 7971) @@ -145,9 +145,18 @@ <div id="explore-results"> <div class="box" id="explore-header"><h1></h1></div> - <div class="box" id="explore-incoming"></div> - <div class="box" id="explore-outgoing"></div> - <div class="box" id="explore-attributes"></div> + <div class="box" id="explore-incoming"> + <h2>Incoming links</h2> + <table></table> + </div> + <div class="box" id="explore-outgoing"> + <h2>Outgoing links</h2> + <table></table> + </div> + <div class="box" id="explore-attributes"> + <h2>Attributes</h2> + <table></table> + </div> </div> <div class="box" id="explore-no-results"></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-15 01:21:23
|
Revision: 7977 http://sourceforge.net/p/bigdata/code/7977 Author: tobycraig Date: 2014-03-15 01:21:15 +0000 (Sat, 15 Mar 2014) Log Message: ----------- #827 - Changed header when no incoming/outgoing links/attributes Modified Paths: -------------- branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-15 00:54:42 UTC (rev 7976) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-15 01:21:15 UTC (rev 7977) @@ -728,7 +728,7 @@ } // clear tables - $('#explore-incoming table, #explore-outgoing table, #explore-attributes table').html(''); + $('#explore-incoming, #explore-outgoing, #explore-attributes').html('<table>'); // go through each binding, adding it to the appropriate table $.each(data.results.bindings, function(i, binding) { @@ -770,6 +770,13 @@ } }); + var sections = {incoming: 'Incoming Links', outgoing: 'Outgoing Links', attributes: 'Attributes'}; + for(var k in sections) { + if($('#explore-' + k + ' table tr').length == 0) { + $('#explore-' + k).html('No ' + sections[k]); + } + } + $('#explore-results a').click(function(e) { e.preventDefault(); explore($(this).data('sid') ? $(this).data('sid') : this.text); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-15 00:54:42 UTC (rev 7976) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-15 01:21:15 UTC (rev 7977) @@ -145,18 +145,9 @@ <div id="explore-results"> <div class="box" id="explore-header"><h1></h1></div> - <div class="box" id="explore-incoming"> - <h2>Incoming links</h2> - <table></table> - </div> - <div class="box" id="explore-outgoing"> - <h2>Outgoing links</h2> - <table></table> - </div> - <div class="box" id="explore-attributes"> - <h2>Attributes</h2> - <table></table> - </div> + <div class="box" id="explore-incoming"></div> + <div class="box" id="explore-outgoing"></div> + <div class="box" id="explore-attributes"></div> </div> <div class="box" id="explore-no-results"></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-15 01:32:51
|
Revision: 7978 http://sourceforge.net/p/bigdata/code/7978 Author: tobycraig Date: 2014-03-15 01:32:44 +0000 (Sat, 15 Mar 2014) Log Message: ----------- #827 - Change No Results Found to No Incoming/Outgoing Links/Attributes Modified Paths: -------------- branches/RDR/bigdata-war/src/html/css/style.css branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/css/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-15 01:21:15 UTC (rev 7977) +++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-15 01:32:44 UTC (rev 7978) @@ -179,7 +179,7 @@ border: none; } -#advanced-features, #query-explanation, #explore-results, #namespace-properties { +#advanced-features, #query-explanation, #namespace-properties { display: none; } Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-15 01:21:15 UTC (rev 7977) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-15 01:32:44 UTC (rev 7978) @@ -636,13 +636,13 @@ 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').html('<h1><< <<a href="#">' + match[1] + '</a> > <<a href="#">' + match[2] + '</a> > <<a href="#">' + match[3] + '</a> > >></h1>'); $('#explore-header h1 a').click(function(e) { e.preventDefault(); explore(this.text); }); } else { - $('#explore-header h1').text(uri); + $('#explore-header').html('<h1>' + uri + '</h1>'); } } }); @@ -718,15 +718,7 @@ console.log('Explore results'); console.log(data); var results = data.results.bindings.length > 0; - $('#explore-results').toggle(results); - $('#explore-no-results').toggle(!results); - // see if we got any results - if(!results) { - $('#explore-no-results').html('<h1>No results found!</h1>'); - return; - } - // clear tables $('#explore-incoming, #explore-outgoing, #explore-attributes').html('<table>'); @@ -790,9 +782,8 @@ } function updateExploreError(jqXHR, textStatus, errorThrown) { - $('#explore-results').hide(); - $('#explore-no-results').show(); - $('#explore-no-results').html('Error! ' + textStatus + ' ' + errorThrown); + $('#explore-results .box').html(''); + $('#explore-header').html('Error! ' + textStatus + ' ' + errorThrown); } /* Status */ Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-15 01:21:15 UTC (rev 7977) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-15 01:32:44 UTC (rev 7978) @@ -144,14 +144,12 @@ </div> <div id="explore-results"> - <div class="box" id="explore-header"><h1></h1></div> + <div class="box" id="explore-header"></div> <div class="box" id="explore-incoming"></div> <div class="box" id="explore-outgoing"></div> <div class="box" id="explore-attributes"></div> </div> - <div class="box" id="explore-no-results"></div> - </div> <div class="tab" id="status-tab"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tob...@us...> - 2014-03-18 04:38:11
|
Revision: 7993 http://sourceforge.net/p/bigdata/code/7993 Author: tobycraig Date: 2014-03-18 04:38:07 +0000 (Tue, 18 Mar 2014) Log Message: ----------- #843 - Initial improvements to status tab Modified Paths: -------------- branches/RDR/bigdata-war/src/html/css/style.css branches/RDR/bigdata-war/src/html/js/workbench.js branches/RDR/bigdata-war/src/html/new.html Modified: branches/RDR/bigdata-war/src/html/css/style.css =================================================================== --- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-17 18:33:10 UTC (rev 7992) +++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-18 04:38:07 UTC (rev 7993) @@ -191,3 +191,23 @@ pre { font-family: monospace; } + +#running-queries li { + margin: 10px 0; +} + +#running-queries div { + border: 1px solid; + border-bottom: none; + padding: 10px; +} + +#running-queries .query { + max-height: 50px; + overflow: scroll; +} + +#running-queries div.query-details { + border-bottom: 1px solid; +} + Modified: branches/RDR/bigdata-war/src/html/js/workbench.js =================================================================== --- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-17 18:33:10 UTC (rev 7992) +++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-18 04:38:07 UTC (rev 7993) @@ -20,12 +20,6 @@ showTab($(this).data('target')); }); -if(window.location.hash) { - showTab(window.location.hash.substr(1)); -} else { - $('#tab-selector a:first').click(); -} - function showTab(tab) { $('.tab').hide(); $('#' + tab + '-tab').show(); @@ -795,10 +789,58 @@ $('#tab-selector a[data-target=status]').click(function(e) { $.get('/bigdata/status', function(data) { - $('#status-tab .box').html(data); + var accepted = data.match(/Accepted query count=(\d+)/)[1]; + var running = data.match(/Running query count=(\d+)/)[1]; + var numbers = $(data).get(-1).textContent; + $('#accepted-query-count').html(accepted); + $('#running-query-count').html(running); + $('#status-numbers').html(numbers); }); }); +$('#show-queries').click(function(e) { + e.preventDefault(); + $.get('/bigdata/status?showQueries', function(data) { + // clear current list + $('#running-queries').empty(); + + // get data inside a jQuery object + data = $('<div>').append(data); + data.find('h1').each(function(i, e) { + // per running query, data is structured h1 form (with numbers/cancel data) h2 pre (with SPARQL) + e = $(e); + // get numbers string, which includes cancel link + var form = e.next(); + var numbers = form.find('p')[0].textContent; + // remove cancel link + numbers = numbers.substring(0, numbers.lastIndexOf(',')); + // get query id + var queryId = form.find('input[type=hidden]').val(); + // get SPARQL + var sparql = form.next().next().html(); + + // got all data, create a li for each query + var li = $('<li><div class="query"><pre>' + sparql + '</pre></div><div class="query-numbers">' + numbers + ', <a href="#" class="cancel-query">Cancel</a></div><div class="query-details"><a href="#" class="query-details collapsed">Details</a></div>'); + li.find('a').data('queryId', queryId); + $('#running-queries').append(li); + }); + + $('.cancel-query').click(cancelQuery); + $('a.query-details').click(getQueryDetails); + }); +}); + +function cancelQuery(e) { + e.preventDefault(); + if(confirm('Cancel query?')) { + var id = $(this).data('queryId'); + $.post('/bigdata/?cancel&queryId=' + id); + $(this).parents('li').remove(); + } +} + +function getQueryDetails(e) {} + /* Performance */ $('#tab-selector a[data-target=performance]').click(function(e) { @@ -823,4 +865,10 @@ return $('<div/>').text(text).html(); } +if(window.location.hash) { + $('a[data-target=' + window.location.hash.substring(1) + ']').click(); +} else { + $('#tab-selector a:first').click(); +} + }); Modified: branches/RDR/bigdata-war/src/html/new.html =================================================================== --- branches/RDR/bigdata-war/src/html/new.html 2014-03-17 18:33:10 UTC (rev 7992) +++ branches/RDR/bigdata-war/src/html/new.html 2014-03-18 04:38:07 UTC (rev 7993) @@ -154,8 +154,14 @@ <div class="tab" id="status-tab"> - <div class="box"></div> - + <div class="box"> + <p>Accepted query count: <span id="accepted-query-count"></span></p> + <p>Running query count: <span id="running-query-count"></span></p> + <p>Show <a href="#" id="show-queries">queries</a>, <a href="#" id="show-query-details">query details</a>.</p> + <pre id="status-numbers"></pre> + <ul id="running-queries"></ul> + </div> + </div> <div class="tab" id="performance-tab"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |