diff --git a/backend/static/css/style.css b/backend/static/css/style.css index fdc4771b..4aa286ab 100644 --- a/backend/static/css/style.css +++ b/backend/static/css/style.css @@ -308,7 +308,7 @@ li.CodeMirror-hint-active { #result-tree .node.cached-pinned { color: grey; border: 1px solid grey; } #result-tree .node.cached-not-pinned { color: grey; border: 1px solid grey; } #result-tree .node-total { display: none; } -#result-tree .node.high { background-color: #FFF7F7; } -#result-tree .node.veryhigh { background-color: #FFEEEE; } -#result-tree .node.high.cached { background-color: #FFFFF7; } -#result-tree .node.veryhigh.cached { background-color: #FFFFEE; } +#result-tree .node.high { background-color: #FFEEEE; } +#result-tree .node.veryhigh { background-color: #FFCCCC; } +#result-tree .node.high.cached { background-color: #FFFFEE; } +#result-tree .node.veryhigh.cached { background-color: #FFFFCC; } diff --git a/backend/static/js/helper.js b/backend/static/js/helper.js index 6a590c89..805436dc 100644 --- a/backend/static/js/helper.js +++ b/backend/static/js/helper.js @@ -898,11 +898,12 @@ function getFormattedResultEntry(str, maxLength, column = undefined) { // the column header. var var_name = $($("#resTable").find("th")[column + 1]).html(); // console.log("Check if \"" + str + "\" in column \"" + var_name + "\" is a float ..."); - if (var_name == "?note" || var_name.endsWith("_note")) str = parseFloat(str).toFixed(2).toString(); + if (var_name.endsWith("?note") || var_name.endsWith("_note")) str = parseFloat(str).toFixed(2).toString(); + if (var_name.endsWith("_per_paper")) str = parseFloat(str).toFixed(2).toString(); if (var_name.endsWith("_perc") || var_name.endsWith("percent")) str = parseFloat(str).toFixed(2).toString(); - if (var_name == "?lp_proz") str = parseFloat(str).toFixed(0).toString(); - if (var_name == "?gesamt_score") str = parseFloat(str).toFixed(1).toString(); - if (var_name == "?lehrpreis") str = parseFloat(str).toFixed(0).toString(); + if (var_name.endsWith("?lp_proz")) str = parseFloat(str).toFixed(0).toString(); + if (var_name.endsWith("?gesamt_score") || var_name.endsWith("?imdb_rating")) str = parseFloat(str).toFixed(1).toString(); + if (var_name.endsWith("?lehrpreis")) str = parseFloat(str).toFixed(0).toString(); pos = cpy.lastIndexOf("^^") pos_http = cpy.indexOf("http"); @@ -930,8 +931,10 @@ function getFormattedResultEntry(str, maxLength, column = undefined) { const typeIsInteger = link.endsWith("int") || link.endsWith("integer"); const typeIsDecimalButNumberIsInteger = link.endsWith("decimal") && str.match(/^\d+$/); if (typeIsInteger || typeIsDecimalButNumberIsInteger) { - str = formatInteger(str); - rightAlign = true; + if (!var_name.endsWith("year")) { + str = formatInteger(str); + rightAlign = true; + } } // For IRIs that start with http display the item depending on the link type. diff --git a/backend/static/js/qleverUI.js b/backend/static/js/qleverUI.js index b63f7f25..2e12d1f8 100755 --- a/backend/static/js/qleverUI.js +++ b/backend/static/js/qleverUI.js @@ -129,7 +129,7 @@ $(document).ready(function () { return; } - if (token.string.match(/^[.`\w?<@]\w*$/)) { + if (token.string.match(new RegExp('^[.`\w?<@]\w*$'))) { string = token.string; } // do not suggest anything inside a word @@ -422,7 +422,7 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) { var nofRows = result.res.length; const [totalTime, computeTime, resolveTime] = getResultTime(result.time); let resultSize = result.resultsize; - let limitMatch = result.query.match(/LIMIT\s+(\d+)\s*$/); + let limitMatch = result.query.match(/\bLIMIT\s+(\d+)\s*$/); if (limitMatch) { resultSize = parseInt(limitMatch[1]); } let resultSizeString = tsep(resultSize.toString()); $('#resultSize').html(resultSizeString); @@ -446,19 +446,16 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) { // create "Map View" buttons. let mapViewButtonVanilla = ''; let mapViewButtonPetri = ''; - let mapViewButtonPetriPatrick = ''; if (result.res.length > 0 && /wktLiteral/.test(result.res[0][columns.length - 1])) { let mapViewUrlVanilla = 'http://qlever.cs.uni-freiburg.de/mapui/index.html?'; let mapViewUrlPetri = 'http://qlever.cs.uni-freiburg.de/mapui-petri/?'; - let mapViewUrlPetriPatrick = 'http://qlever.cs.uni-freiburg.de/mapui-petri-patrick/?'; let params = $.param({ query: normalizeQuery(query), backend: BASEURL }); // var query_escaped = query.replace(/"/g, "\\\""); // console.log("QUERY:", `'${query}'`); // var query_escaped = encodeURIComponent(query); // mapViewButtonVanilla = `
`; mapViewButtonVanilla = ` Map view`; - mapViewButtonPetri = ` Map view++`; - mapViewButtonPetriPatrick = ` Map view+++`; + mapViewButtonPetri = ` Map view`; } // Show the buttons (if there are any). @@ -468,17 +465,18 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) { // the Django configuration of the respective backend). var res = "
"; if (showAllButton || (mapViewButtonVanilla && mapViewButtonPetri)) { - if (BASEURL.match("osm-(germany|kenya|planet|test)")) { - res += `
${showAllButton} ${mapViewButtonVanilla} ${mapViewButtonPetri}
`; + if (BASEURL.match("wikidata|osm-")) { + res += `
${showAllButton} ${mapViewButtonPetri}
`; + // res += `
${showAllButton} ${mapViewButtonVanilla} ${mapViewButtonPetri}
`; } else { - res += `
${showAllButton} ${mapViewButtonVanilla}
`; + // res += `
${showAllButton} ${mapViewButtonVanilla}
`; } } // Optionally show links to other SPARQL endpoints. // NOTE: we want the *original* query here, as it appears in the editor, // without the QLever-specific rewrites (see above). - if (SLUG == "wikidata") { + if (SLUG.startsWith("wikidata")) { const queryEncoded = encodeURIComponent(original_query); wdqsUrl = "https://query.wikidata.org/"; wdqsParams = "#" + queryEncoded; @@ -491,6 +489,15 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) { res += `
${wdqsButton}
`; res += `
${virtuosoButton}
`; } + if (SLUG.startsWith("dbpedia")) { + const queryEncoded = encodeURIComponent(original_query); + virtuosoUrl = "https://dbpedia.org/sparql?"; + virtuosoParams = $.param({ "default-graph-uri": "http://dbpedia.org", + "qtxt": original_query, // use "query" instead of "qtxt" to execute query directly + "format": "text/html", "timeout": 0, "signal_void": "on" }); + virtuosoButton = ` Query Virtuoso`; + res += `
${virtuosoButton}
`; + } // Leave some space to the actual result table. res += "


"; @@ -652,10 +659,10 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) { } var treant_chart = new Treant(treant_tree); $("p.node-time"). - filter(function () { return $(this).html() >= high_query_time_ms }). + filter(function () { return $(this).html().replace(/,/g, "") >= high_query_time_ms }). parent().addClass("high"); $("p.node-time"). - filter(function () { return $(this).html() >= very_high_query_time_ms }). + filter(function () { return $(this).html().replace(/,/g, "") >= very_high_query_time_ms }). parent().addClass("veryhigh"); $("p.node-cache-status").filter(function () { return $(this).html() === "cached_not_pinned" }) .parent().addClass("cached-not-pinned").addClass("cached"); diff --git a/backend/templates/partials/footer.html b/backend/templates/partials/footer.html index a03a743e..fb48af80 100644 --- a/backend/templates/partials/footer.html +++ b/backend/templates/partials/footer.html @@ -10,12 +10,12 @@ QLever UI, OpenStreetMap to RDF, QLever Map UI, - QLever evaluation + QLever evaluation
Publications: SPARQL+Text, - SPARQL Autocompletion, - SPARQL OpenStreetMap, + SPARQL Autocompletion, + SPARQL OpenStreetMap, QLever UI