removed unneeded order by to improve sparql performace; updated checkLocationHash method so that tab name was not hard-coded
This commit is contained in:
parent
a2f2e58fc3
commit
06c7dcfabd
2 changed files with 29 additions and 21 deletions
|
@ -68,19 +68,23 @@ $(document).ready(function(){
|
|||
// remove the trailing white space
|
||||
location.hash = location.hash.replace(/\s+/g, '');
|
||||
if ( location.hash.indexOf("map") >= 0 ) {
|
||||
// if the first tab section is named "Research" we don't have to do anything;
|
||||
// otherwise, select the Research tab and deselect the first one
|
||||
// get the name of the group that contains the geographicFocusOf property.
|
||||
var tabName = $('h3#geographicFocusOf').parent('article').parent('div').attr("id");
|
||||
tabName = tabName.replace("Group","");
|
||||
tabNameCapped = tabName.charAt(0).toUpperCase() + tabName.slice(1);
|
||||
// if the name of the first tab section = tabName we don't have to do anything;
|
||||
// otherwise, select the correct tab and deselect the first one
|
||||
var $firstTab = $('li.clickable').first();
|
||||
if ( $firstTab.text() != "Research") {
|
||||
// select the stored tab
|
||||
$("li[groupName='research']").removeClass("nonSelectedGroupTab clickable");
|
||||
$("li[groupName='research']").addClass("selectedGroupTab clickable");
|
||||
if ( $firstTab.text() != tabNameCapped ) {
|
||||
// select the correct tab
|
||||
$('li[groupName="' + tabName + '"]').removeClass("nonSelectedGroupTab clickable");
|
||||
$('li[groupName="' + tabName + '"]').addClass("selectedGroupTab clickable");
|
||||
// deselect the first tab
|
||||
$firstTab.removeClass("selectedGroupTab clickable");
|
||||
$firstTab.addClass("nonSelectedGroupTab clickable");
|
||||
$('section.property-group:visible').hide();
|
||||
// show the selected tab section
|
||||
$('section#research').show();
|
||||
$('section#' + tabName).show();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -34,23 +34,14 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
|
||||
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
|
||||
+ "PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#> \n"
|
||||
+ "SELECT DISTINCT ?label ?location (COUNT(?person) AS ?count) \n"
|
||||
+ "WHERE { {"
|
||||
+ "WHERE {"
|
||||
+ " ?location rdf:type core:GeographicRegion . \n"
|
||||
+ " ?location rdfs:label ?label . "
|
||||
+ " ?location core:geographicFocusOf ?person . \n"
|
||||
+ " ?person rdf:type foaf:Person \n"
|
||||
+ " FILTER (! regex(str(?location), \"dbpedia\")) \n"
|
||||
+ "} UNION { \n "
|
||||
+ " ?sublocation rdf:type vivoc:DomesticGeographicalRegion . \n"
|
||||
+ " ?sublocation core:geographicFocusOf ?person . \n"
|
||||
+ " ?person rdf:type foaf:Person \n"
|
||||
+ " bind((\"United States of America\"^^<http://www.w3.org/2001/XMLSchema#string>) AS ?label) \n"
|
||||
+ " bind(<http://aims.fao.org/aos/geopolitical.owl#United_States_of_America> AS ?location) \n"
|
||||
+ "} } \n"
|
||||
+ "GROUP BY ?label ?location \n"
|
||||
+ "ORDER BY ?label ?location \n";
|
||||
+ "} \n"
|
||||
+ "GROUP BY ?label ?location \n";
|
||||
|
||||
public GeoFocusMapLocations(HttpServlet parent, VitroRequest vreq,
|
||||
HttpServletResponse resp) {
|
||||
|
@ -76,12 +67,25 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
}
|
||||
Integer count = Integer.parseInt(map.get("count"));
|
||||
String radius = String.valueOf(calculateRadius(count));
|
||||
String name = "";
|
||||
|
||||
if ( label != null && !label.equals(previousLabel) ) {
|
||||
if ( label.contains("Ivoire") ) {
|
||||
name = "Ivory Coast";
|
||||
}
|
||||
else if ( label.contains("New York State") ) {
|
||||
name = "New York";
|
||||
}
|
||||
else if ( label.contains("United Kingdom") ) {
|
||||
name = "United Kingdom";
|
||||
}
|
||||
else {
|
||||
name = label;
|
||||
}
|
||||
String tempStr = geometry; //+label
|
||||
tempStr += typeProps //+ label
|
||||
+ "\"popupContent\": \""
|
||||
+ label
|
||||
+ name
|
||||
+ "\",\"html\":"
|
||||
+ html
|
||||
+ ",\"radius\":"
|
||||
|
|
Loading…
Add table
Reference in a new issue