Skip to content

Commit

Permalink
Fix "Analysis" tree colors, one "Map View" button, updated footer, ot…
Browse files Browse the repository at this point in the history
…her minor fixes

1. In the "Analyis" tree, the coloring of the boxes with high operation
   time was broken since the times use thousand separators. This is now
   fixed and the colors are also a bit brighter (even the brightest red
   was a bit pale before).

2. The "Map View" now links to an instance of
   https://github.com/ad-freiburg/qlever-petrimaps . There is no longer
   a link to the old https://github.com/ad-freiburg/qlever-mapui because
   it is not subsumed by the new UI (expect that the info boxes in the
   old UI are nicer, but than can be easily carried over).

3. Update the footer information

4. Various other minor fixes, including some experimental hacks for
   specifific backends (for internal use).
  • Loading branch information
Hannah Bast committed Jun 18, 2023
1 parent f132f56 commit 8ee0887
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
8 changes: 4 additions & 4 deletions backend/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
15 changes: 9 additions & 6 deletions backend/static/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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.
Expand Down
31 changes: 19 additions & 12 deletions backend/static/js/qleverUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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 = `<form method="post" action="${mapViewUrlVanilla}" class="inline" target="_blank" ><input type="text" name="backend" value="${BASEURL}"><input type="text" name="query" value='PREFIX osm: <https://www.openstreetmap.org> SELECT * WHERE { ?s ?p ?o } LIMIT 10'><button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-map-marker"></i> Map view</button></form>`;
mapViewButtonVanilla = `<a class="btn btn-default" href="${mapViewUrlVanilla}${params}" target="_blank"><i class="glyphicon glyphicon-map-marker"></i> Map view</a>`;
mapViewButtonPetri = `<a class="btn btn-default" href="${mapViewUrlPetri}${params}" target="_blank"><i class="glyphicon glyphicon-map-marker"></i> Map view++</a>`;
mapViewButtonPetriPatrick = `<a class="btn btn-default" href="${mapViewUrlPetriPatrick}${params}" target="_blank"><i class="glyphicon glyphicon-map-marker"></i> Map view+++</a>`;
mapViewButtonPetri = `<a class="btn btn-default" href="${mapViewUrlPetri}${params}" target="_blank"><i class="glyphicon glyphicon-map-marker"></i> Map view</a>`;
}

// Show the buttons (if there are any).
Expand All @@ -468,17 +465,18 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) {
// the Django configuration of the respective backend).
var res = "<div id=\"res\">";
if (showAllButton || (mapViewButtonVanilla && mapViewButtonPetri)) {
if (BASEURL.match("osm-(germany|kenya|planet|test)")) {
res += `<div class="pull-right" style="margin-left: 1em;">${showAllButton} ${mapViewButtonVanilla} ${mapViewButtonPetri}</div>`;
if (BASEURL.match("wikidata|osm-")) {
res += `<div class="pull-right" style="margin-left: 1em;">${showAllButton} ${mapViewButtonPetri}</div>`;
// res += `<div class="pull-right" style="margin-left: 1em;">${showAllButton} ${mapViewButtonVanilla} ${mapViewButtonPetri}</div>`;
} else {
res += `<div class="pull-right" style="margin-left: 1em;">${showAllButton} ${mapViewButtonVanilla}</div>`;
// res += `<div class="pull-right" style="margin-left: 1em;">${showAllButton} ${mapViewButtonVanilla}</div>`;
}
}

// 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;
Expand All @@ -491,6 +489,15 @@ async function processQuery(sendLimit=0, element=$("#exebtn")) {
res += `<div class="pull-right">${wdqsButton}</div>`;
res += `<div class="pull-right">${virtuosoButton}</div>`;
}
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 = `<a class="btn btn-default" href="${virtuosoUrl}${virtuosoParams}" target="_blank"><i class="glyphicon glyphicon-link"></i> Query Virtuoso</a>`;
res += `<div class="pull-right">${virtuosoButton}</div>`;
}

// Leave some space to the actual result table.
res += "</div><br><br>";
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions backend/templates/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<a href="https://github.com/ad-freiburg/qlever-ui" target="_blank">QLever UI</a>,
<a href="https://github.com/ad-freiburg/osm2rdf" target="_blank">OpenStreetMap to RDF</a>,
<a href="https://github.com/ad-freiburg/qlever-mapui" target="_blank">QLever Map UI</a>,
<a href="https://github.com/ad-freiburg/qlever-evaluation" target="_blank">QLever evaluation</a>
<a href="https://ad-publications.cs.uni-freiburg.de/CIKM_sparql_autocompletion_BKKKS_2022.materials" target="_blank">QLever evaluation</a>
</br><!-- &ndash;-->Publications:
<a
href="https://ad-publications.cs.uni-freiburg.de/CIKM_qlever_BB_2017.pdf" target="_blank">SPARQL+Text</a>,
<a href="https://ad-publications.cs.uni-freiburg.de/ARXIV_sparql_autocompletion_BKKKS_2021.pdf" target="_blank">SPARQL Autocompletion</a>,
<a href="https://ad.cs.uni-freiburg.de/publications" target="_blank">SPARQL OpenStreetMap</a>,
<a href="https://ad-publications.cs.uni-freiburg.de/CIKM_sparql_autocompletion_BKKKS_2022.pdf" target="_blank">SPARQL Autocompletion</a>,
<a href="https://ad-publications.cs.uni-freiburg.de/SIGSPATIAL_osm2rdf_BBKL_2021.pdf" target="_blank">SPARQL OpenStreetMap</a>,
<a href="https://ad-publications.cs.uni-freiburg.de/student-projects/qlever-ui" target="_blank">QLever UI</a>
</span>
<br><br>
Expand Down

0 comments on commit 8ee0887

Please sign in to comment.