1. Added dynamic reload of data instead of page refresh, for temporal graph vis.

2. Added link-textbox for viz of each parameter form the dropdown box in temporal vis.
3. Made sure that the choices are preserved when another option is selected from the dropdown box.
4. Refactor of some legacy front-end code for temporal vis.
5. Added legend for bars drawn below the graph.
6. Formatted the last cached at date time.
This commit is contained in:
cdtank 2011-03-31 15:37:32 +00:00
parent a47a480552
commit f7452b1bce
15 changed files with 519 additions and 170 deletions

View file

@ -20,6 +20,55 @@
.easy-deselect-label a.temporal-vis-url { .easy-deselect-label a.temporal-vis-url {
float: right; float: right;
} }
.known-bar {
display: inline-block;
cursor: help;
}
.unknown-inner-bar {
opacity: 0.5;
filter:alpha(opacity=50);
display: inline-block;
}
.bar-count-text {
padding-right: 3px;
vertical-align: super;
}
img.bar-count-icon {
vertical-align: super;
cursor: help;
}
.unknown-bar {
background: url("../../../images/visualization/diagonal.png") repeat scroll 50% 50% #666666;
cursor: help;
}
.legend-bar {
margin-bottom: 3px;
}
.unknown-legend-bar {
background: url("../../../images/visualization/legend-unknown-bar-dark.png") repeat #B7B7B7;
}
#legend-known-bar-text,
#legend-unknown-bar-text {
font-size: 0.75em;
}
span#copy-vis-viewlink {
display: none;
}
img#copy-vis-viewlink-icon {
cursor: pointer;
}
a.temporalGraphLinks { a.temporalGraphLinks {
background-color: #2485AE; background-color: #2485AE;
color: white; color: white;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

View file

@ -37,8 +37,8 @@ var globalDateObject;
var year; var year;
var colors, prevColor, colorToAssign, var colors, prevColor, colorToAssign,
colorToRemove, renderedObjects, labelToEntityRecord, colorToRemove, renderedObjects, URIToEntityRecord,
setOfLabels, labelToCheckedEntities, stopWordsToCount; setOfLabels, URIToCheckedEntities, stopWordsToCount;
var graphContainer; var graphContainer;
var tableDiv; var tableDiv;
@ -66,9 +66,9 @@ function initConstants() {
prevColor = {}; prevColor = {};
colorToAssign, colorToRemove; colorToAssign, colorToRemove;
renderedObjects = []; renderedObjects = [];
labelToEntityRecord = {}; URIToEntityRecord = {};
setOfLabels = []; setOfLabels = [];
labelToCheckedEntities = {}; URIToCheckedEntities = {};
stopWordsToCount = {}; stopWordsToCount = {};
lastCachedAtDateTimes = []; lastCachedAtDateTimes = [];
//options for Flot //options for Flot
@ -100,7 +100,5 @@ function initConstants() {
borderColor : "#D9D9D9" borderColor : "#D9D9D9"
} }
}; };
FlotOptions.colors = colorConstantQueue; FlotOptions.colors = colorConstantQueue;
} }

View file

@ -3,9 +3,10 @@
$(document).ready(function() { $(document).ready(function() {
/* /*
* This will set intitial values of the constants present in constants.js * This will set initial values of the constants present in constants.js
* */ * */
initConstants(); initConstants();
/* This is used to cache the current state whether the user is allowed to select more entities from /* This is used to cache the current state whether the user is allowed to select more entities from
the datatable or not. Once Max number of entity selection is reached the user can no longer select the datatable or not. Once Max number of entity selection is reached the user can no longer select
more & this variable will be set to false. */ more & this variable will be set to false. */
@ -27,34 +28,45 @@ $(document).ready(function() {
var selectedValue = $("select.comparisonValues option:selected").val(); var selectedValue = $("select.comparisonValues option:selected").val();
var selectedParameter; var selectedDataURL;
$.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) { $.each(COMPARISON_PARAMETERS_INFO, function(index, parameter) {
if (parameter.value === selectedValue) { if (parameter.value === selectedValue) {
selectedParameter = parameter;
window.location = parameter.viewLink; currentParameter = parameter.name;
selectedDataURL = parameter.dataLink;
} }
}); });
//$("#body").empty().html("<div id='loading-comparisons'>Loading " + selectedValue + "&nbsp;&nbsp;<img src='" + loadingImageLink + "' /></div>"); options = {
responseContainer: $("div#temporal-graph-response"),
bodyContainer: $("#body"),
errorContainer: $("#error-container"),
dataURL: selectedDataURL
};
/* setupLoadingScreen(options.responseContainer);
* This piece of code is not executed at all because the redirect happens before there is a chance
* to render the below contents.
* */
/* $.ajax({
url: options.dataURL,
$("#comparisonParameter").text("Total Number of " + selectedValue); dataType: "json",
$('#yaxislabel').html("Number of " + selectedValue).mbFlipText(false); timeout: 5 * 60 * 1000,
$('#yaxislabel').css("color", "#595B5B"); success: function (data) {
$('#comparisonHeader').html(selectedValue).css('font-weight', 'bold');
*/
if (data.error) {
options.bodyContainer.remove();
options.errorContainer.show();
options.responseContainer.unblock();
} else {
options.bodyContainer.show();
options.errorContainer.remove();
temporalGraphProcessor.redoTemporalGraphRenderProcess(graphContainer, data);
options.responseContainer.unblock();
}
}
});
}); });
}); });
@ -68,8 +80,9 @@ $("input[type=checkbox].easyDeselectCheckbox").live('click', function(){
var checkbox = $(this); var checkbox = $(this);
var checkboxValue = $(this).attr("value"); var checkboxValue = $(this).attr("value");
var linkedCheckbox = labelToCheckedEntities[checkboxValue]; var linkedCheckbox = URIToCheckedEntities[checkboxValue];
var entityToBeRemoved = labelToEntityRecord[checkboxValue];
var entityToBeRemoved = URIToEntityRecord[checkboxValue];
if(!checkbox.is(':checked')){ if(!checkbox.is(':checked')){
//console.log("Easy deselect checkbox is unclicked!"); //console.log("Easy deselect checkbox is unclicked!");
@ -85,7 +98,6 @@ $("input[type=checkbox].easyDeselectCheckbox").live('click', function(){
} }
}); });
$(".disabled-checkbox-event-receiver").live("click", function () { $(".disabled-checkbox-event-receiver").live("click", function () {
if ($(this).next().is(':disabled')) { if ($(this).next().is(':disabled')) {
@ -97,11 +109,32 @@ $(".disabled-checkbox-event-receiver").live("click", function () {
custom: true, custom: true,
expires: false expires: false
}); });
}
});
$("#copy-vis-viewlink-icon").live('click', function() {
if ($("#copy-vis-viewlink").is(':visible')) {
$("#copy-vis-viewlink").hide();
} else {
$("#copy-vis-viewlink").show();
var linkTextBox = $("#copy-vis-viewlink input[type='text']");
linkTextBox.val(getCurrentParameterVisViewLink());
linkTextBox.select();
} }
}); });
function getCurrentParameterVisViewLink() {
return location.protocol + "//" + location.host + COMPARISON_PARAMETERS_INFO[currentParameter].viewLink;
}
function performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox) { function performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox) {
removeUsedColor(entity); removeUsedColor(entity);
@ -121,10 +154,10 @@ function performEntityCheckboxSelectedActions(entity, checkboxValue, checkbox) {
createLegendRow(entity, $("#bottom")); createLegendRow(entity, $("#bottom"));
renderLineGraph(renderedObjects, entity); renderLineGraph(renderedObjects, entity);
labelToCheckedEntities[checkboxValue] = checkbox;
labelToCheckedEntities[checkboxValue].entity = entity;
// console.log(labelToCheckedEntities[checkboxValue], entity); URIToCheckedEntities[checkboxValue] = checkbox;
URIToCheckedEntities[checkboxValue].entity = entity;
/* /*
* To highlight the rows belonging to selected entities. * To highlight the rows belonging to selected entities.
@ -151,7 +184,7 @@ function loadData(jsonData, dataTableParams) {
$.each(jsonData, function (index, val) { $.each(jsonData, function (index, val) {
setOfLabels.push(val.label); setOfLabels.push(val.label);
labelToEntityRecord[val.label] = val; URIToEntityRecord[val.entityURI] = val;
if (val.lastCachedAtDateTime) { if (val.lastCachedAtDateTime) {
lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime; lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime;
} }
@ -164,6 +197,26 @@ function loadData(jsonData, dataTableParams) {
} }
/*
* function to populate the labelToEntityRecord object with the
* values from the json file and
* dynamically generate checkboxes
*/
function reloadData(preselectedEntityURIs, jsonData) {
$.each(jsonData, function (index, val) {
setOfLabels.push(val.label);
URIToEntityRecord[val.entityURI] = val;
if (val.lastCachedAtDateTime) {
lastCachedAtDateTimes[lastCachedAtDateTimes.length] = val.lastCachedAtDateTime;
}
});
reloadDataTablePagination(preselectedEntityURIs, jsonData);
setEntityLevel(getEntityVisMode(jsonData));
}
function entityCheckboxOperatedOnEventListener() { function entityCheckboxOperatedOnEventListener() {
/* /*
@ -174,7 +227,7 @@ function entityCheckboxOperatedOnEventListener() {
var checkbox = $(this); var checkbox = $(this);
var checkboxValue = $(this).attr("value"); var checkboxValue = $(this).attr("value");
var entity = labelToEntityRecord[checkboxValue]; var entity = URIToEntityRecord[checkboxValue];
if (checkbox.is(':checked')) { if (checkbox.is(':checked')) {
@ -183,13 +236,10 @@ function entityCheckboxOperatedOnEventListener() {
} else { } else {
performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox); performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox);
} }
performEntityCheckboxClickedRedrawActions(); performEntityCheckboxClickedRedrawActions();
}); });
} }
function renderTemporalGraphVisualization(parameters) { function renderTemporalGraphVisualization(parameters) {
@ -200,7 +250,6 @@ function renderTemporalGraphVisualization(parameters) {
parameters.bodyContainer, parameters.bodyContainer,
parameters.errorContainer, parameters.errorContainer,
parameters.responseContainer); parameters.responseContainer);
} }
/* /*
@ -216,7 +265,7 @@ function setupLoadingScreen(visContainerDIV) {
$.blockUI.defaults.css.width = '500px'; $.blockUI.defaults.css.width = '500px';
$.blockUI.defaults.css.border = '0px'; $.blockUI.defaults.css.border = '0px';
$.blockUI.defaults.css.top = '15%'; $.blockUI.defaults.css.top = '1%';
visContainerDIV.block({ visContainerDIV.block({
message: '<div id="loading-data-container"><h3><img id="data-loading-icon" src="' + loadingImageLink message: '<div id="loading-data-container"><h3><img id="data-loading-icon" src="' + loadingImageLink
@ -225,7 +274,9 @@ function setupLoadingScreen(visContainerDIV) {
+ '</i></h3></div>' + '</i></h3></div>'
}); });
setTimeout(function() { clearTimeout(temporalGraphProcessor.loadingScreenTimeout);
temporalGraphProcessor.loadingScreenTimeout = setTimeout(function() {
$("#loading-data-container") $("#loading-data-container")
.html('<h3><img id="refresh-page-icon" src="' .html('<h3><img id="refresh-page-icon" src="'
+ refreshPageImageLink + refreshPageImageLink
@ -235,22 +286,8 @@ function setupLoadingScreen(visContainerDIV) {
.css({'cursor': 'pointer'}); .css({'cursor': 'pointer'});
}, 10 * 1000); }, 10 * 1000);
} }
$("#reload-data").live('click', function() {
options = {
responseContainer: $("div#temporal-graph-response"),
bodyContainer: $("#body"),
errorContainer: $("#error-container"),
dataURL: temporalGraphDataURL
};
renderTemporalGraphVisualization(options);
});
/* /*
* This function gets json data for temporal graph & after rendering removes the * This function gets json data for temporal graph & after rendering removes the
* loading message. It will also display the error container in case of any error. * loading message. It will also display the error container in case of any error.
@ -274,7 +311,6 @@ function getTemporalGraphData(temporalGraphDataURL,
graphBodyDIV.remove(); graphBodyDIV.remove();
errorBodyDIV.show(); errorBodyDIV.show();
visContainerDIV.unblock(); visContainerDIV.unblock();
} else { } else {
graphBodyDIV.show(); graphBodyDIV.show();
errorBodyDIV.remove(); errorBodyDIV.remove();
@ -291,25 +327,57 @@ function getTemporalGraphData(temporalGraphDataURL,
} }
function parseXSDateTime(rawDateTimeString) { var lastCachedAtDateTimeParser = {
getDateObjectFromRawXSDateTimeString: function(rawDateTimeString) {
var dateTime = rawDateTimeString.split("T", 2); var dateTime = rawDateTimeString.split("T", 2);
var date = dateTime[0].split("-"); var date = dateTime[0].split("-");
var time = dateTime[1].split(":"); var time = dateTime[1].split(":");
return new Date(date[0], parseInt(date[1], 10) -1, date[2], time[0], time[1], 0); return new Date(date[0], parseInt(date[1], 10) -1, date[2], time[0], time[1], 0);
} },
function getReadableDateForLastCachedAtDate(dateObject) { getReadableDateString: function(dateObject) {
var day = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] if (typeof dateObject === "string") {
var month = ['January','February','March','April','May','June','July','August','September','October','November'] dateObject = this.getDateObjectFromRawXSDateTimeString(dateObject);
}
var day = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var month = ['January','February','March','April','May','June','July','August','September','October','November'];
return day[dateObject.getDay()] + ", " + month[dateObject.getMonth()] + " " + dateObject.getDate(); return day[dateObject.getDay()] + ", " + month[dateObject.getMonth()] + " " + dateObject.getDate();
},
ascendingDateSorter: function(rawDateStringA, rawDateStringB) {
var dateA = lastCachedAtDateTimeParser.getDateObjectFromRawXSDateTimeString(rawDateStringA);
var dateB = lastCachedAtDateTimeParser.getDateObjectFromRawXSDateTimeString(rawDateStringB);
return dateA-dateB; //sort by date ascending
}
};
var entitySelector = {
manuallyTriggerSelectOnDataTableCheckbox: function(checkbox) {
checkbox.attr('checked', true);
var checkboxValue = checkbox.attr("value");
var entity = URIToEntityRecord[checkboxValue];
performEntityCheckboxSelectedActions(entity, checkboxValue, checkbox);
performEntityCheckboxClickedRedrawActions();
}
} }
temporalGraphProcessor = { temporalGraphProcessor = {
loadingScreenTimeout: '',
initiateTemporalGraphRenderProcess: function(givenGraphContainer, jsonData) { initiateTemporalGraphRenderProcess: function(givenGraphContainer, jsonData) {
this.dataTableParams = { this.dataTableParams = {
@ -328,11 +396,7 @@ temporalGraphProcessor = {
* */ * */
loadData(jsonData, this.dataTableParams); loadData(jsonData, this.dataTableParams);
lastCachedAtDateTimes.sort(function(a, b) { lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter);
var dateA = parseXSDateTime(a);
var dateB = parseXSDateTime(b);
return dateA-dateB; //sort by date ascending
});
/* /*
* This will make sure that top 3 entities are selected by default when the page loads. * This will make sure that top 3 entities are selected by default when the page loads.
@ -343,21 +407,75 @@ temporalGraphProcessor = {
return false; return false;
} }
$(this).attr('checked', true); entitySelector.manuallyTriggerSelectOnDataTableCheckbox($(this));
var checkboxValue = $(this).attr("value");
var entity = labelToEntityRecord[checkboxValue];
performEntityCheckboxSelectedActions(entity, checkboxValue, $(this));
performEntityCheckboxClickedRedrawActions();
}); });
if ($("#incomplete-data-disclaimer").length > 0 && lastCachedAtDateTimes.length > 0) { if ($("#incomplete-data-disclaimer").length > 0 && lastCachedAtDateTimes.length > 0) {
$("#incomplete-data-disclaimer").attr( $("#incomplete-data-disclaimer").attr(
"title", "title",
$("#incomplete-data-disclaimer").attr("title") + " as of " + getReadableDateForLastCachedAtDate(parseXSDateTime(lastCachedAtDateTimes[0]))); $("#incomplete-data-disclaimer").attr("title") + " as of "
+ lastCachedAtDateTimeParser.getReadableDateString(lastCachedAtDateTimes[0]));
} }
},
redoTemporalGraphRenderProcess: function(givenGraphContainer, jsonData) {
var currentSelectedEntityURIs = [];
$.each(URIToCheckedEntities, function(index, entity){
currentSelectedEntityURIs.push(index);
});
clearRenderedObjects();
initConstants();
/*
* initial display of the grid when the page loads
* */
init(givenGraphContainer);
/*
* render the temporal graph per the sent content.
* */
reloadData(currentSelectedEntityURIs, jsonData);
lastCachedAtDateTimes.sort(lastCachedAtDateTimeParser.ascendingDateSorter);
if (currentSelectedEntityURIs.length > 0) {
$.each(currentSelectedEntityURIs, function(index, uri) {
var targetPrevSelectedCheckbox = $('input.' + entityCheckboxSelectorDOMClass + '[value="' + uri + '"]');
if (targetPrevSelectedCheckbox.length > 0) {
entitySelector.manuallyTriggerSelectOnDataTableCheckbox(targetPrevSelectedCheckbox);
}
});
} else {
/*
* This will make sure that top 3 entities are selected by default when the page loads.
*/
$.each($("input." + entityCheckboxSelectorDOMClass), function(index, checkbox) {
if (index > 2) {
return false;
}
entitySelector.manuallyTriggerSelectOnDataTableCheckbox($(this));
});
}
if ($("#incomplete-data-disclaimer").length > 0 && lastCachedAtDateTimes.length > 0) {
var disclaimerText = "This information is based solely on "
+ COMPARISON_PARAMETERS_INFO[currentParameter].value
+ " which have been loaded into the VIVO system"
+ " as of " + lastCachedAtDateTimeParser.getReadableDateString(lastCachedAtDateTimes[0]);
$("#incomplete-data-disclaimer").attr(
"title", disclaimerText);
}
$("#copy-vis-viewlink input[type='text']").val(getCurrentParameterVisViewLink());
} }
} }

View file

@ -221,9 +221,11 @@ function init(graphContainer) {
var optionSelected = $("select.comparisonValues option:selected").val(); var optionSelected = $("select.comparisonValues option:selected").val();
// TODO: make use of the id on the select field instead of a generic one. // TODO: make use of the id on the select field instead of a generic one.
$("#comparisonParameter").text("Total Number of " + $("select.comparisonValues option:selected").val()); $("#comparisonParameter").text("Total Number of " + optionSelected);
$('#yaxislabel').html("Number of " + optionSelected).mbFlipText(false); $('#yaxislabel').html("Number of " + optionSelected).mbFlipText(false);
$('#comparisonHeader').html(optionSelected).css('font-weight', 'bold'); $('#comparisonHeader').html(optionSelected).css('font-weight', 'bold');
$('#legend-known-bar-text').text("Known " + COMPARISON_PARAMETERS_INFO[currentParameter].name + " year");
$('#legend-unknown-bar-text').text("Unknown " + COMPARISON_PARAMETERS_INFO[currentParameter].name + " year");
var defaultFlotOptions = { var defaultFlotOptions = {
@ -455,11 +457,8 @@ function calcMinandMaxYears(jsonObject, year) {
} }
}); });
year.min = Math.min.apply(Math, validYearsInData); year.min = Math.min.apply(Math, validYearsInData);
year.max = Math.max.apply(Math, validYearsInData); year.max = Math.max.apply(Math, validYearsInData);
} }
/** /**
@ -473,7 +472,8 @@ function calcMaxOfComparisonParameter(allEntities) {
var validCountsInData = new Array(); var validCountsInData = new Array();
$.each(allEntities, function(key, currentEntity) { $.each(allEntities, function(key, currentEntity) {
validCountsInData.push(calcSumOfComparisonParameter(currentEntity)); combinedCount = calcSumOfComparisonParameter(currentEntity);
validCountsInData.push(combinedCount.knownYearCount + combinedCount.unknownYearCount);
}); });
return Math.max.apply(Math, validCountsInData); return Math.max.apply(Math, validCountsInData);
@ -510,12 +510,26 @@ function calcMaxWithinComparisonParameter(jsonObject){
*/ */
function calcSumOfComparisonParameter(entity) { function calcSumOfComparisonParameter(entity) {
var sum = 0; var known = 0;
var unknown = 0;
$.each(entity.data, function(index, data){ $.each(entity.data, function(index, data){
sum += this[1];
if (this[0] === -1) {
unknown += this[1];
} else {
known += this[1];
}
}); });
sum = {
knownYearCount: known,
unknownYearCount: unknown
};
return sum; return sum;
} }
@ -539,47 +553,39 @@ function contains(objectArray, object) {
return flag; return flag;
} }
/** var LineWidth = {
* Dynamically change the linewidth and ticksize based on input year range.
*
* @param {Object}
* yearRange
*/
function setLineWidthAndTickSize(yearRange, flotOptions) {
if (yearRange > 0 && yearRange < 15) { getLineWidth: function(tickSize) {
flotOptions.series.lines.lineWidth = 3; if (tickSize >= 0 && tickSize < 10) {
flotOptions.xaxis.tickSize = 1; return 3;
} else if (yearRange > 15 && yearRange < 70) { } else if (tickSize >= 10 && tickSize < 50) {
flotOptions.series.lines.lineWidth = 2; return 2;
flotOptions.xaxis.tickSize = 5;
} else if (yearRange == 0 ) {
flotOptions.series.lines.lineWidth = 3;
flotOptions.xaxis.tickSize = 1;
} else { } else {
flotOptions.series.lines.lineWidth = 1; return 1;
flotOptions.xaxis.tickSize = 10; }
} }
} };
var TickSize = { var TickSize = {
maxValue: 0.0, maxValue: 0.0,
maxTicks: { maxTicks: {
yAxis: 12.0 yAxis: 12.0,
xAxis: 12.0
}, },
tickSizeUnits: { tickSizeUnits: {
yAxis: [1.0, 2.5, 5.0] yAxis: [1.0, 2.5, 5.0],
xAxis: [1.0, 2, 5.0]
}, },
getApproximateTickSize: function(allowedMaxTicks) { getApproximateTickSize: function(allowedMaxTicks) {
return Math.max(Math.ceil(parseFloat(this.maxValue) / allowedMaxTicks), 1.0); return Math.max(Math.ceil(parseFloat(this.maxValue) / allowedMaxTicks), 1.0);
}, },
getFinalTickSizeForYaxis: function(unitTickSizeGenerator) { getFinalTickSize: function(unitTickSizeGenerator) {
tickSizeMultiplier = 1.0; tickSizeMultiplier = 1.0;
finalTickSize = 1.0; finalTickSize = 1.0;
approximateTickSize = this.getApproximateTickSize(this.maxTicks.yAxis); approximateTickSize = this.getApproximateTickSize(this.maxTicks.yAxis);
@ -599,14 +605,15 @@ var TickSize = {
} }
tickSizeMultiplier *= 10.0; tickSizeMultiplier *= 10.0;
} }
return finalTickSize; return finalTickSize;
}, },
getTickSize: function(value, onAxis) { getTickSize: function(value, onAxis) {
this.maxValue = value; this.maxValue = value;
if (onAxis.trim().toLowerCase() === 'y') { if (onAxis.trim().toLowerCase() === 'y') {
return this.getFinalTickSizeForYaxis(this.tickSizeUnits.yAxis); return this.getFinalTickSize(this.tickSizeUnits.yAxis);
} else if (onAxis.trim().toLowerCase() === 'x') {
return this.getFinalTickSize(this.tickSizeUnits.xAxis);
} }
} }
}; };
@ -622,7 +629,7 @@ var TickSize = {
function createLegendRow(entity, bottomDiv) { function createLegendRow(entity, bottomDiv) {
var parentP = $('<p>'); var parentP = $('<p>');
parentP.attr('id', slugify(entity.label)); parentP.attr('id', slugify(entity.entityURI));
var labelDiv = $('<div>'); var labelDiv = $('<div>');
labelDiv.attr('class', 'easy-deselect-label'); labelDiv.attr('class', 'easy-deselect-label');
@ -651,8 +658,23 @@ function createLegendRow(entity, bottomDiv) {
var barDiv = $('<div>'); var barDiv = $('<div>');
barDiv.attr('id', 'bar'); barDiv.attr('id', 'bar');
var knownBar = $('<span>');
knownBar.attr('class', 'known-bar');
var unknownBar = $('<span>');
unknownBar.attr('class', 'unknown-bar');
var unknownBarInnerSpan = $('<span>');
unknownBarInnerSpan.attr('class', 'unknown-inner-bar');
unknownBarInnerSpan.html('&nbsp;');
unknownBar.append(unknownBarInnerSpan);
barDiv.append(knownBar);
barDiv.append(unknownBar);
var numAttributeText = $('<span>'); var numAttributeText = $('<span>');
numAttributeText.attr('id', 'text'); numAttributeText.attr('class', 'bar-count-text');
parentP.append(checkbox); parentP.append(checkbox);
parentP.append(labelDiv); parentP.append(labelDiv);
@ -660,7 +682,13 @@ function createLegendRow(entity, bottomDiv) {
parentP.append(barDiv); parentP.append(barDiv);
parentP.append(numAttributeText); parentP.append(numAttributeText);
if (bottomDiv.children('p.displayCounter').nextAll().last().length > 0) {
bottomDiv.children('p.displayCounter').nextAll().last().after(parentP);
} else {
bottomDiv.children('p.displayCounter').after(parentP); bottomDiv.children('p.displayCounter').after(parentP);
}
renderBarAndLabel(entity, barDiv, labelDiv, numAttributeText); renderBarAndLabel(entity, barDiv, labelDiv, numAttributeText);
} }
@ -672,19 +700,35 @@ function createLegendRow(entity, bottomDiv) {
function renderBarAndLabel(entity, divBar, divLabel, spanElement) { function renderBarAndLabel(entity, divBar, divLabel, spanElement) {
var sum = calcSumOfComparisonParameter(entity); var combinedCount = calcSumOfComparisonParameter(entity);
var normalizedWidth = getNormalizedWidth(entity, sum);
divBar.css("background-color", colorToAssign); var sum = combinedCount.knownYearCount + combinedCount.unknownYearCount;
divBar.css("width", normalizedWidth);
var normalizedWidth = getNormalizedWidth(entity, sum);
var knownNormalizedWidth = getNormalizedWidth(entity, combinedCount.knownYearCount);
if (combinedCount.unknownYearCount) {
var unknownNormalizedWidth = getNormalizedWidth(entity, combinedCount.unknownYearCount);
} else {
var unknownNormalizedWidth = 0;
}
divBar.css("width", normalizedWidth + 5);
divBar.children(".known-bar").html("&nbsp;").css("background-color", colorToAssign).css("width", knownNormalizedWidth);
divBar.children(".unknown-bar").children(".unknown-inner-bar").html("&nbsp;").css("background-color", colorToAssign).css("width", unknownNormalizedWidth);
var entityLabelForLegend = divLabel.find(".entity-label-url"); var entityLabelForLegend = divLabel.find(".entity-label-url");
entityLabelForLegend.html(entity.label); entityLabelForLegend.html(entity.label);
entityLabelForLegend.ellipsis(); entityLabelForLegend.ellipsis();
entityLabelForLegend.wrap("<a class='entity-url' title='" + entity.label + "' href='" + getVIVOURL(entity) + "'></a>"); entityLabelForLegend.wrap("<a class='entity-url' title='" + entity.label + "' href='" + getVIVOURL(entity) + "'></a>");
spanElement.text(sum).css("font-size", "0.8em").css("color", "#595B5B"); var countExplanation = 'VIVO knows the ' + COMPARISON_PARAMETERS_INFO[currentParameter].name + ' year for '
+ combinedCount.knownYearCount + ' out of '
+ sum + ' of these ' + COMPARISON_PARAMETERS_INFO[currentParameter].pluralName;
divBar.attr("title", countExplanation);
spanElement.text(sum).css("font-size", "0.8em").css("color", "#595B5B");
} }
function getVIVOURL(entity){ function getVIVOURL(entity){
@ -826,7 +870,7 @@ function getNextFreeColor(entity){
function getNormalizedWidth(entity, sum){ function getNormalizedWidth(entity, sum){
var maxValueOfComparisonParameter = calcMaxOfComparisonParameter(labelToEntityRecord); var maxValueOfComparisonParameter = calcMaxOfComparisonParameter(URIToEntityRecord);
var normalizedWidth = 0; var normalizedWidth = 0;
normalizedWidth = Math.floor(225 * (sum / maxValueOfComparisonParameter)); normalizedWidth = Math.floor(225 * (sum / maxValueOfComparisonParameter));
@ -906,18 +950,19 @@ function generateCheckBoxes(label, checkedFlag, fontFlag){
function clearRenderedObjects(){ function clearRenderedObjects(){
$.each(labelToCheckedEntities, function(index, val){ $.each(URIToCheckedEntities, function(index, val){
if($(val).is(':checked')){ if($(val).is(':checked')){
$(val).attr("checked", false); $(val).attr("checked", false);
updateRowHighlighter(val); updateRowHighlighter(val);
removeUsedColor(labelToEntityRecord[$(val).attr("value")]); removeUsedColor(URIToEntityRecord[$(val).attr("value")]);
removeEntityUnChecked(renderedObjects, labelToEntityRecord[$(val).attr("value")]); removeEntityUnChecked(renderedObjects, URIToEntityRecord[$(val).attr("value")]);
removeLegendRow(val); removeLegendRow(val);
displayLineGraphs(); displayLineGraphs();
} }
}); });
labelToCheckedEntities = {}; URIToCheckedEntities = {};
checkIfColorLimitIsReached(); checkIfColorLimitIsReached();
updateCounter(); updateCounter();
@ -948,16 +993,18 @@ function displayLineGraphs(){
} }
} }
function removeCheckBoxFromGlobalSet(checkbox){ function removeCheckBoxFromGlobalSet(checkbox){
//remove checkbox object from the globals //remove checkbox object from the globals
var value = $(checkbox).attr("value"); var value = $(checkbox).attr("value");
if(labelToCheckedEntities[value]){ /*if (labelToCheckedEntities[value]) {
delete labelToCheckedEntities[value]; delete labelToCheckedEntities[value];
} }*/
}
if (URIToCheckedEntities[value]) {
delete URIToCheckedEntities[value];
}
}
/* /*
* function to create a table to be * function to create a table to be
@ -967,7 +1014,7 @@ function removeCheckBoxFromGlobalSet(checkbox){
function prepareTableForDataTablePagination(jsonData, dataTableParams){ function prepareTableForDataTablePagination(jsonData, dataTableParams){
resetStopWordCount(); resetStopWordCount();
var checkboxCount = 0;
var table = $('<table>'); var table = $('<table>');
table.attr('cellpadding', '0'); table.attr('cellpadding', '0');
table.attr('cellspacing', '0'); table.attr('cellspacing', '0');
@ -985,19 +1032,20 @@ function prepareTableForDataTablePagination(jsonData, dataTableParams){
var entityLabelTH = $('<th>'); var entityLabelTH = $('<th>');
entityLabelTH.html('Entity Name'); entityLabelTH.html('Entity Name');
var publicationCountTH = $('<th>'); var activityCountTH = $('<th>');
if ($("select.comparisonValues option:selected").text() === "by Publications") { if ($("select.comparisonValues option:selected").text() === "by Publications") {
publicationCountTH.html('Publication Count'); activityCountTH.html('Publication Count');
} else { } else {
publicationCountTH.html('Grant Count'); activityCountTH.html('Grant Count');
} }
activityCountTH.attr("id", "activity-count-column");
var entityTypeTH = $('<th>'); var entityTypeTH = $('<th>');
entityTypeTH.html('Entity Type'); entityTypeTH.html('Entity Type');
tr.append(checkboxTH); tr.append(checkboxTH);
tr.append(entityLabelTH); tr.append(entityLabelTH);
tr.append(publicationCountTH); tr.append(activityCountTH);
tr.append(entityTypeTH); tr.append(entityTypeTH);
thead.append(tr); thead.append(tr);
@ -1005,20 +1053,26 @@ function prepareTableForDataTablePagination(jsonData, dataTableParams){
table.append(thead); table.append(thead);
var tbody = $('<tbody>'); var tbody = $('<tbody>');
var checkboxCount = 0;
$.each(labelToEntityRecord, function(index, val){ $.each(URIToEntityRecord, function(index, val) {
var entityTypesWithoutStopWords = removeStopWords(val); var entityTypesWithoutStopWords = removeStopWords(val);
var row = $('<tr>'); var row = $('<tr>');
var checkboxTD = $('<td>'); var checkboxTD = $('<td>');
checkboxTD.html('<div class="disabled-checkbox-event-receiver">&nbsp;</div><input type="checkbox" class="' + entityCheckboxSelectorDOMClass + '" value="' + index + '"'+'/>'); checkboxTD.html('<div class="disabled-checkbox-event-receiver">&nbsp;</div><input type="checkbox" class="'
+ entityCheckboxSelectorDOMClass + '" value="'
+ val.entityURI + '"'+'/>');
var labelTD = $('<td>'); var labelTD = $('<td>');
labelTD.css("width", "100px"); labelTD.css("width", "100px");
labelTD.html(index); labelTD.html(val.label);
var publicationCountTD = $('<td>'); var publicationCountTD = $('<td>');
publicationCountTD.html(calcSumOfComparisonParameter(val));
var combinedCount = calcSumOfComparisonParameter(val);
publicationCountTD.html(combinedCount.knownYearCount + combinedCount.unknownYearCount);
var entityTypeTD = $('<td>'); var entityTypeTD = $('<td>');
entityTypeTD.html(entityTypesWithoutStopWords); entityTypeTD.html(entityTypesWithoutStopWords);
@ -1076,6 +1130,91 @@ function prepareTableForDataTablePagination(jsonData, dataTableParams){
} }
/*
* function to create a table to be
* used by jquery.dataTables. The JsonObject
* returned is used to populate the pagination table.
*/
function reloadDataTablePagination(preselectedEntityURIs, jsonData){
resetStopWordCount();
/*
* In case no entities are selected, we want that redraw should happen so that top entities are
* pre-selected.
* */
var shouldRedraw = preselectedEntityURIs.length ? false : true;
var currentDataTable = $('#datatable').dataTable();
currentDataTable.fnClearTable();
if ($("select.comparisonValues option:selected").text() === "by Publications") {
$("#activity-count-column").html('Publication Count');
} else {
$("#activity-count-column").html('Grant Count');
}
function addNewRowAfterReload(entity) {
var checkboxTD = '<div class="disabled-checkbox-event-receiver">&nbsp;</div><input type="checkbox" class="'
+ entityCheckboxSelectorDOMClass
+ '" value="'
+ entity.entityURI + '"' +'/>';
var labelTD = entity.label;
var combinedCount = calcSumOfComparisonParameter(entity);
var publicationCountTD = combinedCount.knownYearCount + combinedCount.unknownYearCount;
var entityTypeTD = removeStopWords(entity);
var newRow = [checkboxTD,
labelTD,
publicationCountTD,
entityTypeTD];
/*
* Dont redraw the table, so no sorting, no filtering.
* */
currentDataTable.fnAddData(newRow, shouldRedraw);
/*
* Dont redraw the table, so no sorting, no filtering.
* */
currentDataTable.fnDraw(shouldRedraw);
}
/*
* This will ensure that currently selected entities are added first in the table,
* to make sure that they are "visible" in the DOM. This so that our manual trigger
* for selecting this checkboxes on page load, actually works.
* */
$.each(preselectedEntityURIs, function(index, uri) {
if (URIToEntityRecord[uri]) {
addNewRowAfterReload(URIToEntityRecord[uri]);
}
});
$.each(URIToEntityRecord, function(index, val) {
/*
* Don't consider already added pre-selected entities.
* */
if ($.inArray(index, preselectedEntityURIs) < 0) {
addNewRowAfterReload(val);
}
});
/*
* We should change to the first page so that checkboxes are selectable.
* */
currentDataTable.fnPageChange('first');
}
function updateRowHighlighter(linkedCheckBox){ function updateRowHighlighter(linkedCheckBox){
linkedCheckBox.closest("tr").removeClass('datatablerowhighlight'); linkedCheckBox.closest("tr").removeClass('datatablerowhighlight');
} }
@ -1097,12 +1236,10 @@ function removeStopWords(val){
typeStringWithoutStopWords += ', '+ value; typeStringWithoutStopWords += ', '+ value;
} }
}); });
//console.log(stopWordsToCount["Person"],stopWordsToCount["Organization"]);
return typeStringWithoutStopWords.substring(1, typeStringWithoutStopWords.length); return typeStringWithoutStopWords.substring(1, typeStringWithoutStopWords.length);
} }
function setEntityLevel(entityLevel){ function setEntityLevel(entityLevel){
//$('#entitylevelheading').text(' - ' + toCamelCase(entityLevel) + ' Level').css('font-style', 'italic');
$('#entityleveltext').text(' ' + entityLevel.toLowerCase()).css('font-style', 'italic'); $('#entityleveltext').text(' ' + entityLevel.toLowerCase()).css('font-style', 'italic');
$('#entityHeader').text(entityLevel).css('font-weight', 'bold'); $('#entityHeader').text(entityLevel).css('font-weight', 'bold');
$('#headerText').css("color", "#2485ae"); $('#headerText').css("color", "#2485ae");
@ -1195,7 +1332,7 @@ function enableUncheckedEntities(){
function checkIfColorLimitIsReached(){ function checkIfColorLimitIsReached(){
if (getSize(labelToCheckedEntities) >= 10) { if (getSize(URIToCheckedEntities) >= 10) {
disableUncheckedEntities(); disableUncheckedEntities();
} else { } else {
enableUncheckedEntities(); enableUncheckedEntities();
@ -1207,15 +1344,17 @@ function setTickSizeOfAxes(){
var checkedLabelToEntityRecord = {}; var checkedLabelToEntityRecord = {};
var yearRange; var yearRange;
$.each(labelToCheckedEntities, function(index, val){ $.each(URIToCheckedEntities, function(index, val){
checkedLabelToEntityRecord[index] = labelToEntityRecord[index]; checkedLabelToEntityRecord[index] = URIToEntityRecord[index];
}); });
var normalizedYearRange = getNormalizedYearRange(); var normalizedYearRange = getNormalizedYearRange();
setLineWidthAndTickSize(normalizedYearRange.normalizedRange, FlotOptions); FlotOptions.xaxis.tickSize =
TickSize.getTickSize(normalizedYearRange.normalizedRange, 'x');
FlotOptions.series.lines.lineWidth = LineWidth.getLineWidth(FlotOptions.xaxis.tickSize);
FlotOptions.yaxis.tickSize = FlotOptions.yaxis.tickSize =
TickSize.getTickSize(calcMaxWithinComparisonParameter(checkedLabelToEntityRecord), 'y'); TickSize.getTickSize(calcMaxWithinComparisonParameter(checkedLabelToEntityRecord), 'y');
} }

View file

@ -95,3 +95,12 @@ function constructVisualizationURLForSparkline(dataString, visualizationOptions)
+ chartColor + parameterDifferentiator + chartColor + parameterDifferentiator
+ "chd=" + dataString + "chd=" + dataString
} }
/*
* In IE trim() is not supported.
* */
if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}

View file

@ -13,10 +13,13 @@
<select class="comparisonValues" style="margin-bottom: 20px;"> <select class="comparisonValues" style="margin-bottom: 20px;">
<#assign currentViewLink = "no view link">
<#list parameterOptions as parameter> <#list parameterOptions as parameter>
<#if currentParameter = parameter.name> <#if currentParameter = parameter.name>
<#assign selectedText = "selected='selected'"> <#assign selectedText = "selected='selected'">
<#assign currentViewLink = parameter.viewLink>
<#else> <#else>
@ -28,6 +31,9 @@
</select> </select>
<img id="copy-vis-viewlink-icon" title="Link to visualization" class="middle" src="${urls.images}/individual/uriIcon.gif" alt="uri icon" />
<span id="copy-vis-viewlink"><input type="text" size="21" value="${currentViewLink}" /></span>
</div> </div>
</div> </div>
@ -84,5 +90,9 @@
</p> </p>
</div> </div>
<p class="displayCounter">Legend</p>
<span style="background-color: #B7B7B7; width: 25px;" class="known-bar legend-bar">&nbsp;</span> <span id="legend-known-bar-text">Known ${currentParameterObject.name} year</span><br />
<span class="legend-bar unknown-legend-bar"><span style="width: 25px;" class="unknown-inner-bar">&nbsp;</span></span> <span id="legend-unknown-bar-text">Unknown ${currentParameterObject.name} year</span>
</div> </div>
</div> </div>

View file

@ -5,6 +5,12 @@ corresponding changes in the included Templates. -->
<#assign currentParameter = "grant"> <#assign currentParameter = "grant">
<script language="JavaScript" type="text/javascript">
var currentParameter = "${currentParameter}";
</script>
<#include "entityComparisonSetup.ftl"> <#include "entityComparisonSetup.ftl">
<#assign temporalGraphDownloadFileLink = '${temporalGraphDownloadCSVCommonURL}&vis=entity_grant_count'> <#assign temporalGraphDownloadFileLink = '${temporalGraphDownloadCSVCommonURL}&vis=entity_grant_count'>

View file

@ -5,6 +5,12 @@ corresponding changes in the included Templates. -->
<#assign currentParameter = "publication"> <#assign currentParameter = "publication">
<script language="JavaScript" type="text/javascript">
var currentParameter = "${currentParameter}";
</script>
<#include "entityComparisonSetup.ftl"> <#include "entityComparisonSetup.ftl">
<#assign temporalGraphDownloadFileLink = '${temporalGraphDownloadCSVCommonURL}&vis=entity_comparison'> <#assign temporalGraphDownloadFileLink = '${temporalGraphDownloadCSVCommonURL}&vis=entity_comparison'>

View file

@ -13,20 +13,27 @@
<#assign subOrganizationPublicationTemporalGraphCommonURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_comparison"> <#assign subOrganizationPublicationTemporalGraphCommonURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_comparison">
<#assign organizationPublicationTemporalGraphURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_comparison&uri=${organizationURI}"> <#assign organizationPublicationTemporalGraphURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_comparison&uri=${organizationURI}">
<#assign organizationPublicationTemporalGraphDataURL = "${urls.base}${dataVisualizationURLRoot}?vis=entity_comparison&uri=${organizationURI}&vis_mode=json">
<#assign organizationGrantTemporalGraphURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_grant_count&uri=${organizationURI}"> <#assign organizationGrantTemporalGraphURL = "${urls.base}${standardVisualizationURLRoot}?vis=entity_grant_count&uri=${organizationURI}">
<#assign organizationGrantTemporalGraphDataURL = "${urls.base}${dataVisualizationURLRoot}?vis=entity_grant_count&uri=${organizationURI}&vis_mode=json">
<#assign temporalGraphSmallIcon = '${urls.images}/visualization/temporal_vis_small_icon.jpg'> <#assign temporalGraphSmallIcon = '${urls.images}/visualization/temporal_vis_small_icon.jpg'>
<#assign temporalGraphDownloadCSVCommonURL = '${urls.base}${dataVisualizationURLRoot}?uri=${organizationURI}&labelField=label'> <#assign temporalGraphDownloadCSVCommonURL = '${urls.base}${dataVisualizationURLRoot}?uri=${organizationURI}&labelField=label'>
<#assign publicationParameter = { "name": "publication", <#assign publicationParameter = { "name": "publication",
"pluralName": "publications",
"dropDownText": "by Publications", "dropDownText": "by Publications",
"viewLink": "${organizationPublicationTemporalGraphURL}", "viewLink": "${organizationPublicationTemporalGraphURL}",
"dataLink": "${organizationPublicationTemporalGraphDataURL}",
"value": "Publications" }> "value": "Publications" }>
<#assign grantParameter = { "name": "grant", <#assign grantParameter = { "name": "grant",
"pluralName": "grants",
"dropDownText": "by Grants", "dropDownText": "by Grants",
"viewLink": "${organizationGrantTemporalGraphURL}", "viewLink": "${organizationGrantTemporalGraphURL}",
"dataLink": "${organizationGrantTemporalGraphDataURL}",
"value": "Grants" }> "value": "Grants" }>
<#assign parameterOptions = [publicationParameter, grantParameter]> <#assign parameterOptions = [publicationParameter, grantParameter]>
@ -42,6 +49,15 @@ we will default to using the stable version unless the request comes from IE 9 i
we will use rev 293 (dev build version) of the flot & excanvas files. we will use rev 293 (dev build version) of the flot & excanvas files.
--> -->
<script language="JavaScript" type="text/javascript">
var activitiesLabel = {
singular: 'activity',
plural: 'activities'
};
</script>
${scripts.add('<!--[if IE]><script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/flot/r293/excanvas.min.js"></script><![endif]-->', ${scripts.add('<!--[if IE]><script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/flot/r293/excanvas.min.js"></script><![endif]-->',
'<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/flot/r293/jquery.flot.min.js"></script>', '<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/flot/r293/jquery.flot.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/fliptext/jquery.mb.flipText.js"></script>', '<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/jquery_plugins/fliptext/jquery.mb.flipText.js"></script>',
@ -50,6 +66,7 @@ ${scripts.add('<!--[if IE]><script type="text/javascript" src="${urls.base}/js/v
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.dataTables.min.js"></script>', '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.dataTables.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/util.js"></script>', '<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/util.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/constants.js"></script>', '<script type="text/javascript" src="${urls.base}/js/visualization/entitycomparison/constants.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/visualization/visualization-helper-functions.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.notify.min.js"></script>')} '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.notify.min.js"></script>')}
<#-- CSS files --> <#-- CSS files -->

View file

@ -15,7 +15,6 @@ import org.apache.commons.logging.Log;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.rdf.model.Model;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
@ -27,7 +26,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.entitycomparison.EntityComparisonUtilityFunctions; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.entitycomparison.EntityComparisonUtilityFunctions;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Activity; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Activity;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.ConstructedModelTracker;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Entity; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Entity;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.JsonObject; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.JsonObject;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SubEntity; import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SubEntity;
@ -58,11 +56,11 @@ public class TemporalPublicationVisualizationRequestHandler implements
} }
System.out.println("current models in the system are"); // System.out.println("current models in the system are");
for (Map.Entry<String, Model> entry : ConstructedModelTracker.getAllModels().entrySet()) { // for (Map.Entry<String, Model> entry : ConstructedModelTracker.getAllModels().entrySet()) {
System.out.println(entry.getKey() + " -> " + entry.getValue().size()); // System.out.println(entry.getKey() + " -> " + entry.getValue().size());
} // }
//
return prepareStandaloneMarkupResponse(vitroRequest, entityURI); return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
} }
@ -71,7 +69,6 @@ public class TemporalPublicationVisualizationRequestHandler implements
String subjectEntityURI, EntityComparisonConstants.DataVisMode visMode) String subjectEntityURI, EntityComparisonConstants.DataVisMode visMode)
throws MalformedQueryParametersException { throws MalformedQueryParametersException {
Entity organizationEntity = SelectOnModelUtilities Entity organizationEntity = SelectOnModelUtilities
.getSubjectOrganizationHierarchy(dataset, subjectEntityURI); .getSubjectOrganizationHierarchy(dataset, subjectEntityURI);

View file

@ -205,7 +205,7 @@ public class SelectOnModelUtilities {
OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE,
dataset); dataset);
System.out.println("getting publications for " + subOrganization.getIndividualLabel()); // System.out.println("getting publications for " + subOrganization.getIndividualLabel());
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>(); Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL); fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL);
@ -352,7 +352,7 @@ public class SelectOnModelUtilities {
for (SubEntity subOrganization : organizationEntity.getSubEntities()) { for (SubEntity subOrganization : organizationEntity.getSubEntities()) {
System.out.println("constructing grants for " + subOrganization.getIndividualLabel() + " :: " + subOrganization.getIndividualURI()); // System.out.println("constructing grants for " + subOrganization.getIndividualLabel() + " :: " + subOrganization.getIndividualURI());
long before = System.currentTimeMillis(); long before = System.currentTimeMillis();
@ -362,7 +362,7 @@ public class SelectOnModelUtilities {
OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE,
dataset); dataset);
System.out.println("\t construct -> " + (System.currentTimeMillis() - before)); // System.out.println("\t construct -> " + (System.currentTimeMillis() - before));
before = System.currentTimeMillis(); before = System.currentTimeMillis();
@ -419,7 +419,7 @@ public class SelectOnModelUtilities {
subOrganization.setLastCachedAtDateTime(lastCachedAtForEntity); subOrganization.setLastCachedAtDateTime(lastCachedAtForEntity);
System.out.println("\t select -> " + (System.currentTimeMillis() - before)); // System.out.println("\t select -> " + (System.currentTimeMillis() - before));
} }
return allGrantURIToVO; return allGrantURIToVO;
} }