1. Changed icon for map of science.
2. Bug fixes for map of science edge cases. 3. Included a default error message when there are no publications to be found. 4. Improved text for map of sience info.
This commit is contained in:
parent
431036c1b0
commit
6f213a61fa
14 changed files with 614 additions and 532 deletions
|
@ -211,3 +211,25 @@ a.map-of-science-links {
|
||||||
.paginatedtabs {
|
.paginatedtabs {
|
||||||
font-size: 0.81em;
|
font-size: 0.81em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------> */
|
||||||
|
/* SPECIAL STYLES FOR THE error */
|
||||||
|
/* --------------------------------------------------------------> */
|
||||||
|
#error-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#noPublications-header {
|
||||||
|
font-size: 1.375em;
|
||||||
|
color: #2485ae;
|
||||||
|
line-height: 1.3em;
|
||||||
|
padding-top:15px;
|
||||||
|
padding-bottom:10px;
|
||||||
|
}
|
||||||
|
#noPublications-span {
|
||||||
|
font-size:22px;
|
||||||
|
}
|
||||||
|
#noPublications-span a {
|
||||||
|
color: #84a655;
|
||||||
|
font-size:16px;
|
||||||
|
}
|
BIN
productMods/images/visualization/mapofscience/vivo_scimap.jpg
Normal file
BIN
productMods/images/visualization/mapofscience/vivo_scimap.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
|
@ -237,7 +237,7 @@ var DataTableWidget = Class.extend({
|
||||||
}
|
}
|
||||||
me.currentSelectedFilter = SCIMAP_TYPE.SUBDISCIPLINE;
|
me.currentSelectedFilter = SCIMAP_TYPE.SUBDISCIPLINE;
|
||||||
$("a#csv").attr("href", entityMapOfScienceSubDisciplineCSVURL);
|
$("a#csv").attr("href", entityMapOfScienceSubDisciplineCSVURL);
|
||||||
$("a#csv").html("Export All Sub-Displines");
|
$("a#csv").html("Export All Sub-Disciplines");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ var DataTableWidget = Class.extend({
|
||||||
me.widget.fnSettings()._iDisplayLength = 13;
|
me.widget.fnSettings()._iDisplayLength = 13;
|
||||||
}
|
}
|
||||||
$("a#csv").attr("href", entityMapOfScienceDisciplineCSVURL);
|
$("a#csv").attr("href", entityMapOfScienceDisciplineCSVURL);
|
||||||
$("a#csv").html("Export All Displines");
|
$("a#csv").html("Export All Disciplines");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,8 +177,8 @@ var DisciplineMarkerManager = ScimapMarkerManager.extend({
|
||||||
marker.setContent(
|
marker.setContent(
|
||||||
'<div style="font-size: 80%; padding: 5px; text-align: left;"><b>'
|
'<div style="font-size: 80%; padding: 5px; text-align: left;"><b>'
|
||||||
+ poly.label +'</b><br />'
|
+ poly.label +'</b><br />'
|
||||||
+ addCommasToNumber(poly.value.toFixed(2)) + ' of publications (pubs.)<br />'
|
+ addCommasToNumber(poly.value.toFixed(2)) + ' publications (pubs.)<br />'
|
||||||
+ (poly.value * 100 / this.maxValue).toFixed(2) + '% of activity</div>'
|
+ (poly.value * 100 / this.maxValue).toFixed(2) + '% activity</div>'
|
||||||
);
|
);
|
||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
@ -198,8 +198,8 @@ var SubdisciplineMarkerManager = ScimapMarkerManager.extend({
|
||||||
marker.setContent(
|
marker.setContent(
|
||||||
'<div style="font-size: 80%; padding: 5px; text-align: left;"><b>'
|
'<div style="font-size: 80%; padding: 5px; text-align: left;"><b>'
|
||||||
+ poly.label + '</b> in ' + disciplineLabel +'<br />'
|
+ poly.label + '</b> in ' + disciplineLabel +'<br />'
|
||||||
+ addCommasToNumber(poly.value.toFixed(2)) + ' of publications (pubs.)<br />'
|
+ addCommasToNumber(poly.value.toFixed(2)) + ' publications (pubs.)<br />'
|
||||||
+ (poly.value * 100 / this.maxValue).toFixed(2) + '% of activity</div>'
|
+ (poly.value * 100 / this.maxValue).toFixed(2) + '% activity</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
return marker;
|
return marker;
|
||||||
|
|
|
@ -61,11 +61,11 @@ var EntityVisModeController = Class.extend({
|
||||||
if (me.isUnloaded) {
|
if (me.isUnloaded) {
|
||||||
if (sync) {
|
if (sync) {
|
||||||
downloader.downloadAndWait(url, function(data) {
|
downloader.downloadAndWait(url, function(data) {
|
||||||
me.loadJsonData(me, data[0]);
|
me.loadJsonData(me, data);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
downloader.download(url, function(data) {
|
downloader.download(url, function(data) {
|
||||||
me.loadJsonData(me, data[0]);
|
me.loadJsonData(me, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
@ -74,12 +74,20 @@ var EntityVisModeController = Class.extend({
|
||||||
|
|
||||||
$("#" + responseContainerID).unblock();
|
$("#" + responseContainerID).unblock();
|
||||||
|
|
||||||
|
if (data.error) {
|
||||||
|
$("#map-of-science-response").hide();
|
||||||
|
$("#error-container").show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = data[0];
|
||||||
|
|
||||||
$.each(me.widgets, function(i, widget) {
|
$.each(me.widgets, function(i, widget) {
|
||||||
widget.loadJsonData(data);
|
widget.loadJsonData(data);
|
||||||
});
|
});
|
||||||
me.isUnloaded = false;
|
me.isUnloaded = false;
|
||||||
|
|
||||||
me.initToolTipInfo();
|
me.initToolTipInfo();
|
||||||
|
|
||||||
},
|
},
|
||||||
initToolTipInfo: function() {
|
initToolTipInfo: function() {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<section id="visualization" role="region">
|
<section id="visualization" role="region">
|
||||||
<#if isAuthor>
|
<#if isAuthor>
|
||||||
<#assign coAuthorIcon = "${urls.images}/visualization/co_author_icon.png">
|
<#assign coAuthorIcon = "${urls.images}/visualization/co_author_icon.png">
|
||||||
<#assign mapOfScienceIcon = "${urls.images}/visualization/mapofscience/vivo_scimap_icon_v001.png">
|
<#assign mapOfScienceIcon = "${urls.images}/visualization/mapofscience/vivo_scimap.jpg">
|
||||||
<#assign coAuthorVisUrl = individual.coAuthorVisUrl>
|
<#assign coAuthorVisUrl = individual.coAuthorVisUrl>
|
||||||
<#assign mapOfScienceVisUrl = individual.mapOfScienceUrl>
|
<#assign mapOfScienceVisUrl = individual.mapOfScienceUrl>
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
<#-- Map Of Science visualization -->
|
<#-- Map Of Science visualization -->
|
||||||
|
|
||||||
<div id="map-of-science">
|
<div id="map-of-science">
|
||||||
<h3><img src="${urls.images}/visualization/mapofscience/vivo_scimap_icon_v001.png" width="25px" height="25px" /><a href="${individual.mapOfScienceUrl}">Map of Science</a></h3>
|
<h3><img src="${urls.images}/visualization/mapofscience/vivo_scimap.jpg" width="25px" height="25px" /><a href="${individual.mapOfScienceUrl}">Map of Science</a></h3>
|
||||||
</div>
|
</div>
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#assign mapOfScienceIcon = '${urls.images}/visualization/mapofscience/vivo_scimap_icon_v001.png'>
|
<#assign mapOfScienceIcon = '${urls.images}/visualization/mapofscience/vivo_scimap.jpg'>
|
||||||
|
|
||||||
<#assign entityMapOfScienceDataURL = "${urls.base}${dataVisualizationURLRoot}?vis=${mapOfScienceVisParam}&uri=${entityURI}&output=json">
|
<#assign entityMapOfScienceDataURL = "${urls.base}${dataVisualizationURLRoot}?vis=${mapOfScienceVisParam}&uri=${entityURI}&output=json">
|
||||||
<#assign entityMapOfScienceDisciplineCSVURL = "${urls.base}${dataVisualizationURLRoot}?vis=${mapOfScienceVisParam}&uri=${entityURI}&output=csv&vis_mode=discipline">
|
<#assign entityMapOfScienceDisciplineCSVURL = "${urls.base}${dataVisualizationURLRoot}?vis=${mapOfScienceVisParam}&uri=${entityURI}&output=csv&vis_mode=discipline">
|
||||||
|
|
|
@ -102,12 +102,25 @@ You can hover over a sub-discipline in the table below to show which overlaid ci
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
|
<#--
|
||||||
In the table below, <b># of pubs.</b> column indicates number of publications that fall under a particular field (sub-discipline or
|
In the table below, <b># of pubs.</b> column indicates number of publications that fall under a particular field (sub-discipline or
|
||||||
discipline). Sometimes this number will be fractional. This happens when a journal in which the publication was published happens
|
discipline). Sometimes this number will be fractional. This happens when a journal in which the publication was published is associated
|
||||||
to impact more than one field and hence the publication score is distributed into number of fractions based on the weight scores
|
with more than one (sub)discipline. In these cases, the publication score is fractionally mapped based on the weight scores
|
||||||
of the journal in the different fields.<br /><br />
|
of the journal.<br /><br />
|
||||||
|
|
||||||
<b>% activity</b> column indicates the percentage of publications that fall under a particular field.
|
<b>% activity</b> column indicates the percentage of publications that fall under a particular field.
|
||||||
|
-->
|
||||||
|
|
||||||
|
The table below summarizes this institution's body of publications as plotted on the map of science.
|
||||||
|
Each row corresponds to a field (discipline or sub-discipline) on the map.
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
The <b># of pubs.</b> column shows how many of the publications were mapped to each field.
|
||||||
|
This count can be fractional because some publication venues are associated with more than one field.
|
||||||
|
Each publication in such a venue contributes fractionally to all associated fields according to a weighting scheme.
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
The <b>% activity</b> column shows what proportion of the publications were mapped to each field.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -122,7 +135,20 @@ may need to be cleaned up before they are recognized. You may contact a VIVO sys
|
||||||
concern.</div>
|
concern.</div>
|
||||||
|
|
||||||
<div id="searchInfoTooltipText" style="display:none;">
|
<div id="searchInfoTooltipText" style="display:none;">
|
||||||
This search box is used to filter the table rows based on the sub-discipline (or discipline) label found in the first column.
|
<!-- Search for specific sub-discipline (or discipline) label in the first column of the table. -->
|
||||||
|
List only map of science areas whose names contain this text.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="error-container">
|
||||||
|
|
||||||
|
<h1 id="noPublications-header">${entityLabel}</h1>
|
||||||
|
|
||||||
|
<h3 id="alternative-vis-info">Map of Science Visualization</h3>
|
||||||
|
<div id="error-body">
|
||||||
|
<p>This organization has neither sub-organizations nor people with publications in the system.
|
||||||
|
Please visit the full ${entityLabel} <a href="${entityVivoProfileURL}">profile page</a> for a more complete overview.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${headScripts.add('<script type="text/javascript" src="${urls.base}/js/jquery_plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>')}
|
${headScripts.add('<script type="text/javascript" src="${urls.base}/js/jquery_plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>')}
|
|
@ -55,10 +55,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
if (StringUtils.isBlank(entityURI)) {
|
if (StringUtils.isBlank(entityURI)) {
|
||||||
|
|
||||||
entityURI = OrganizationUtilityFunctions
|
entityURI = OrganizationUtilityFunctions
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(log,
|
||||||
log,
|
dataset, vitroRequest);
|
||||||
dataset,
|
|
||||||
vitroRequest);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,17 +70,20 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
Dataset dataSource) throws MalformedQueryParametersException {
|
Dataset dataSource) throws MalformedQueryParametersException {
|
||||||
|
|
||||||
return generateStandardVisualizationForPublicationTemporalVis(
|
return generateStandardVisualizationForPublicationTemporalVis(
|
||||||
vitroRequest, log, dataSource, parameters.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY));
|
vitroRequest,
|
||||||
|
log,
|
||||||
|
dataSource,
|
||||||
|
parameters
|
||||||
|
.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
||||||
VitroRequest vitroRequest, Log log, Dataset dataset,
|
VitroRequest vitroRequest, Log log, Dataset dataset,
|
||||||
String subjectEntityURI)
|
String subjectEntityURI) throws MalformedQueryParametersException {
|
||||||
throws MalformedQueryParametersException {
|
|
||||||
|
|
||||||
ModelConstructor constructQueryRunner =
|
ModelConstructor constructQueryRunner = new EntityPublicationCountConstructQueryRunner(
|
||||||
new EntityPublicationCountConstructQueryRunner(subjectEntityURI, dataset, log);
|
subjectEntityURI, dataset, log);
|
||||||
|
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
|
||||||
|
@ -93,13 +94,13 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
if (entity.getEntityLabel().equals("no-label")) {
|
if (entity.getEntityLabel().equals("no-label")) {
|
||||||
|
|
||||||
return prepareStandaloneDataErrorResponse(vitroRequest, subjectEntityURI);
|
return prepareStandaloneDataErrorResponse(vitroRequest,
|
||||||
|
subjectEntityURI);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return getSubEntityTypesAndComputeDataResponse(
|
return getSubEntityTypesAndComputeDataResponse(vitroRequest, log,
|
||||||
vitroRequest, log, dataset,
|
dataset, subjectEntityURI, entity);
|
||||||
subjectEntityURI, entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData
|
||||||
|
.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
"{\"error\" : \"No Publications for this Organization found in VIVO.\"}");
|
"{\"error\" : \"No Publications for this Organization found in VIVO.\"}");
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
@ -120,12 +122,11 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
String subjectEntityURI, Entity entity)
|
String subjectEntityURI, Entity entity)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult =
|
Map<String, Set<String>> subOrganizationTypesResult = OrganizationUtilityFunctions
|
||||||
OrganizationUtilityFunctions.getSubEntityTypes(
|
.getSubEntityTypes(log, dataset, subjectEntityURI);
|
||||||
log, dataset, subjectEntityURI);
|
|
||||||
|
|
||||||
return prepareStandaloneDataResponse(vitroRequest, entity, entity.getSubEntities(),
|
return prepareStandaloneDataResponse(vitroRequest, entity, entity
|
||||||
subOrganizationTypesResult);
|
.getSubEntities(), subOrganizationTypesResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,19 +138,17 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This will provide the data in json format mainly used for standalone tmeporal vis.
|
* This will provide the data in json format mainly used for standalone
|
||||||
* */
|
* tmeporal vis.
|
||||||
|
*/
|
||||||
if (VisualizationFrameworkConstants.JSON_OUTPUT_FORMAT
|
if (VisualizationFrameworkConstants.JSON_OUTPUT_FORMAT
|
||||||
.equalsIgnoreCase(vitroRequest.getParameter(
|
.equalsIgnoreCase(vitroRequest
|
||||||
VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(entityURI)) {
|
if (StringUtils.isNotBlank(entityURI)) {
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(vitroRequest,
|
||||||
vitroRequest,
|
log, dataset, entityURI);
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
entityURI);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(
|
||||||
|
@ -158,18 +157,16 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
dataset,
|
dataset,
|
||||||
OrganizationUtilityFunctions
|
OrganizationUtilityFunctions
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(
|
||||||
log,
|
log, dataset, vitroRequest));
|
||||||
dataset,
|
|
||||||
vitroRequest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* This provides csv download files for the content in the tables.
|
* This provides csv download files for the content in the tables.
|
||||||
* */
|
*/
|
||||||
|
|
||||||
ModelConstructor constructQueryRunner =
|
ModelConstructor constructQueryRunner = new EntityPublicationCountConstructQueryRunner(
|
||||||
new EntityPublicationCountConstructQueryRunner(entityURI, dataset, log);
|
entityURI, dataset, log);
|
||||||
|
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
|
||||||
|
@ -178,39 +175,41 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult =
|
Map<String, Set<String>> subOrganizationTypesResult = OrganizationUtilityFunctions
|
||||||
OrganizationUtilityFunctions.getSubEntityTypes(
|
.getSubEntityTypes(log, dataset, entityURI);
|
||||||
log, dataset, entityURI);
|
|
||||||
|
|
||||||
return prepareDataResponse(entity, entity.getSubEntities(), subOrganizationTypesResult);
|
return prepareDataResponse(entity, entity.getSubEntities(),
|
||||||
|
subOrganizationTypesResult);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||||
Dataset dataset) throws MalformedQueryParametersException {
|
Dataset dataset) throws MalformedQueryParametersException {
|
||||||
throw new UnsupportedOperationException("Entity Pub Count does not provide Ajax Response.");
|
throw new UnsupportedOperationException(
|
||||||
|
"Entity Pub Count does not provide Ajax Response.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides response when json file containing the publication count over the
|
* Provides response when json file containing the publication count over
|
||||||
* years is requested.
|
* the years is requested.
|
||||||
*
|
*
|
||||||
* @param entity
|
* @param entity
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
*/
|
*/
|
||||||
private Map<String, String> prepareDataResponse(Entity entity, Set<SubEntity> subentities,
|
private Map<String, String> prepareDataResponse(Entity entity,
|
||||||
|
Set<SubEntity> subentities,
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
String entityLabel = entity.getEntityLabel();
|
String entityLabel = entity.getEntityLabel();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To make sure that null/empty records for entity names do not cause any mischief.
|
* To make sure that null/empty records for entity names do not cause
|
||||||
* */
|
* any mischief.
|
||||||
|
*/
|
||||||
if (StringUtils.isBlank(entityLabel)) {
|
if (StringUtils.isBlank(entityLabel)) {
|
||||||
entityLabel = "no-organization";
|
entityLabel = "no-organization";
|
||||||
}
|
}
|
||||||
|
@ -218,49 +217,50 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
String outputFileName = UtilityFunctions.slugify(entityLabel)
|
String outputFileName = UtilityFunctions.slugify(entityLabel)
|
||||||
+ "_publications-per-year" + ".csv";
|
+ "_publications-per-year" + ".csv";
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_NAME_KEY,
|
fileData.put(DataVisualizationController.FILE_NAME_KEY, outputFileName);
|
||||||
outputFileName);
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
getEntityPublicationsPerYearCSVContent(subentities, subOrganizationTypesResult));
|
getEntityPublicationsPerYearCSVContent(subentities,
|
||||||
return fileData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, String> prepareStandaloneDataResponse(
|
|
||||||
VitroRequest vitroRequest,
|
|
||||||
Entity entity,
|
|
||||||
Set<SubEntity> subentities,
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
|
||||||
"application/octet-stream");
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
|
||||||
writePublicationsOverTimeJSON(vitroRequest,
|
|
||||||
entity.getSubEntities(),
|
|
||||||
subOrganizationTypesResult));
|
subOrganizationTypesResult));
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TemplateResponseValues prepareStandaloneMarkupResponse(VitroRequest vreq,
|
private Map<String, String> prepareStandaloneDataResponse(
|
||||||
String entityURI) {
|
VitroRequest vitroRequest, Entity entity,
|
||||||
|
Set<SubEntity> subentities,
|
||||||
|
Map<String, Set<String>> subOrganizationTypesResult)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
|
"application/octet-stream");
|
||||||
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
|
writePublicationsOverTimeJSON(vitroRequest, entity
|
||||||
|
.getSubEntities(), subOrganizationTypesResult));
|
||||||
|
return fileData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TemplateResponseValues prepareStandaloneMarkupResponse(
|
||||||
|
VitroRequest vreq, String entityURI) {
|
||||||
|
|
||||||
String standaloneTemplate = "entityComparisonOnPublicationsStandalone.ftl";
|
String standaloneTemplate = "entityComparisonOnPublicationsStandalone.ftl";
|
||||||
|
|
||||||
String organizationLabel = OrganizationUtilityFunctions
|
String organizationLabel = OrganizationUtilityFunctions
|
||||||
.getEntityLabelFromDAO(vreq,
|
.getEntityLabelFromDAO(vreq, entityURI);
|
||||||
entityURI);
|
|
||||||
|
|
||||||
Map<String, Object> body = new HashMap<String, Object>();
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
body.put("title", organizationLabel + " - Temporal Graph Visualization");
|
body
|
||||||
|
.put("title", organizationLabel
|
||||||
|
+ " - Temporal Graph Visualization");
|
||||||
body.put("organizationURI", entityURI);
|
body.put("organizationURI", entityURI);
|
||||||
body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq));
|
body.put("organizationLocalName", UtilityFunctions
|
||||||
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace());
|
.getIndividualLocalName(entityURI, vreq));
|
||||||
|
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory()
|
||||||
|
.getDefaultNamespace());
|
||||||
body.put("organizationLabel", organizationLabel);
|
body.put("organizationLabel", organizationLabel);
|
||||||
|
|
||||||
return new TemplateResponseValues(standaloneTemplate, body);
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
|
@ -268,21 +268,23 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to generate a json file for year <-> publication count mapping.
|
* Function to generate a json file for year <-> publication count mapping.
|
||||||
|
*
|
||||||
* @param vreq
|
* @param vreq
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
|
* @throws MalformedQueryParametersException
|
||||||
*/
|
*/
|
||||||
private String writePublicationsOverTimeJSON(VitroRequest vreq,
|
private String writePublicationsOverTimeJSON(VitroRequest vreq,
|
||||||
Set<SubEntity> subentities,
|
Set<SubEntity> subentities,
|
||||||
Map<String, Set<String>>
|
Map<String, Set<String>> subOrganizationTypesResult)
|
||||||
subOrganizationTypesResult) {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Gson json = new Gson();
|
Gson json = new Gson();
|
||||||
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
||||||
|
|
||||||
for (SubEntity subentity : subentities) {
|
for (SubEntity subentity : subentities) {
|
||||||
JsonObject entityJson = new JsonObject(
|
JsonObject entityJson = new JsonObject(subentity
|
||||||
subentity.getIndividualLabel());
|
.getIndividualLabel());
|
||||||
|
|
||||||
List<List<Integer>> yearPubCount = new ArrayList<List<Integer>>();
|
List<List<Integer>> yearPubCount = new ArrayList<List<Integer>>();
|
||||||
|
|
||||||
|
@ -291,7 +293,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
|
|
||||||
List<Integer> currentPubYear = new ArrayList<Integer>();
|
List<Integer> currentPubYear = new ArrayList<Integer>();
|
||||||
if (pubEntry.getKey().equals(VOConstants.DEFAULT_PUBLICATION_YEAR)) {
|
if (pubEntry.getKey().equals(
|
||||||
|
VOConstants.DEFAULT_PUBLICATION_YEAR)) {
|
||||||
currentPubYear.add(-1);
|
currentPubYear.add(-1);
|
||||||
} else {
|
} else {
|
||||||
currentPubYear.add(Integer.parseInt(pubEntry.getKey()));
|
currentPubYear.add(Integer.parseInt(pubEntry.getKey()));
|
||||||
|
@ -307,7 +310,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
entityJson.setEntityURI(subentity.getIndividualURI());
|
entityJson.setEntityURI(subentity.getIndividualURI());
|
||||||
|
|
||||||
boolean isPerson = UtilityFunctions.isEntityAPerson(vreq, subentity.getIndividualURI());
|
boolean isPerson = UtilityFunctions.isEntityAPerson(vreq, subentity
|
||||||
|
.getIndividualURI());
|
||||||
|
|
||||||
if (isPerson) {
|
if (isPerson) {
|
||||||
entityJson.setVisMode("PERSON");
|
entityJson.setVisMode("PERSON");
|
||||||
|
@ -329,7 +333,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
for (SubEntity subEntity : subentities) {
|
for (SubEntity subEntity : subentities) {
|
||||||
|
|
||||||
csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity.getIndividualLabel()));
|
csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity
|
||||||
|
.getIndividualLabel()));
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
csvFileContent.append(subEntity.getActivities().size());
|
csvFileContent.append(subEntity.getActivities().size());
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
|
@ -341,7 +346,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
joinedTypes.append(subOrganizationType + "; ");
|
joinedTypes.append(subOrganizationType + "; ");
|
||||||
}
|
}
|
||||||
|
|
||||||
csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes.toString()));
|
csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes
|
||||||
|
.toString()));
|
||||||
csvFileContent.append("\n");
|
csvFileContent.append("\n");
|
||||||
}
|
}
|
||||||
return csvFileContent.toString();
|
return csvFileContent.toString();
|
||||||
|
|
|
@ -34,7 +34,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
||||||
|
|
||||||
|
|
||||||
public class EntityGrantCountRequestHandler implements
|
public class EntityGrantCountRequestHandler implements
|
||||||
VisualizationRequestHandler {
|
VisualizationRequestHandler {
|
||||||
|
|
||||||
|
@ -56,10 +55,8 @@ public class EntityGrantCountRequestHandler implements
|
||||||
if (StringUtils.isBlank(entityURI)) {
|
if (StringUtils.isBlank(entityURI)) {
|
||||||
|
|
||||||
entityURI = OrganizationUtilityFunctions
|
entityURI = OrganizationUtilityFunctions
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(log,
|
||||||
log,
|
dataset, vitroRequest);
|
||||||
dataset,
|
|
||||||
vitroRequest);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
||||||
|
@ -71,7 +68,11 @@ public class EntityGrantCountRequestHandler implements
|
||||||
Dataset dataSource) throws MalformedQueryParametersException {
|
Dataset dataSource) throws MalformedQueryParametersException {
|
||||||
|
|
||||||
return generateStandardVisualizationForGrantTemporalVis(
|
return generateStandardVisualizationForGrantTemporalVis(
|
||||||
vitroRequest, log, dataSource, parameters.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY));
|
vitroRequest,
|
||||||
|
log,
|
||||||
|
dataSource,
|
||||||
|
parameters
|
||||||
|
.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,19 +85,17 @@ public class EntityGrantCountRequestHandler implements
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This will provide the data in json format mainly used for standalone temporal vis.
|
* This will provide the data in json format mainly used for standalone
|
||||||
* */
|
* temporal vis.
|
||||||
|
*/
|
||||||
if (VisualizationFrameworkConstants.JSON_OUTPUT_FORMAT
|
if (VisualizationFrameworkConstants.JSON_OUTPUT_FORMAT
|
||||||
.equalsIgnoreCase(vitroRequest
|
.equalsIgnoreCase(vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(entityURI)) {
|
if (StringUtils.isNotBlank(entityURI)) {
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(vitroRequest,
|
||||||
vitroRequest,
|
log, dataset, entityURI);
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
entityURI);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(
|
||||||
|
@ -105,17 +104,15 @@ public class EntityGrantCountRequestHandler implements
|
||||||
dataset,
|
dataset,
|
||||||
OrganizationUtilityFunctions
|
OrganizationUtilityFunctions
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(
|
||||||
log,
|
log, dataset, vitroRequest));
|
||||||
dataset,
|
|
||||||
vitroRequest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* This provides csv download files for the content in the tables.
|
* This provides csv download files for the content in the tables.
|
||||||
* */
|
*/
|
||||||
ModelConstructor constructQueryRunner =
|
ModelConstructor constructQueryRunner = new EntityGrantCountConstructQueryRunner(
|
||||||
new EntityGrantCountConstructQueryRunner(entityURI, dataset, log);
|
entityURI, dataset, log);
|
||||||
|
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
|
||||||
|
@ -124,12 +121,11 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
|
Map<String, Set<String>> subOrganizationTypesResult = OrganizationUtilityFunctions
|
||||||
|
.getSubEntityTypes(log, dataset, entityURI);
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult =
|
return prepareDataResponse(entity, entity.getSubEntities(),
|
||||||
OrganizationUtilityFunctions.getSubEntityTypes(
|
subOrganizationTypesResult);
|
||||||
log, dataset, entityURI);
|
|
||||||
|
|
||||||
return prepareDataResponse(entity, entity.getSubEntities(), subOrganizationTypesResult);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,11 +141,10 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
||||||
VitroRequest vitroRequest, Log log, Dataset dataset,
|
VitroRequest vitroRequest, Log log, Dataset dataset,
|
||||||
String subjectEntityURI)
|
String subjectEntityURI) throws MalformedQueryParametersException {
|
||||||
throws MalformedQueryParametersException {
|
|
||||||
|
|
||||||
ModelConstructor constructQueryRunner =
|
ModelConstructor constructQueryRunner = new EntityGrantCountConstructQueryRunner(
|
||||||
new EntityGrantCountConstructQueryRunner(subjectEntityURI, dataset, log);
|
subjectEntityURI, dataset, log);
|
||||||
|
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
|
||||||
|
@ -159,12 +154,12 @@ public class EntityGrantCountRequestHandler implements
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
if (entity.getEntityLabel().equals("no-label")) {
|
if (entity.getEntityLabel().equals("no-label")) {
|
||||||
return prepareStandaloneDataErrorResponse(vitroRequest, subjectEntityURI);
|
return prepareStandaloneDataErrorResponse(vitroRequest,
|
||||||
|
subjectEntityURI);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return getSubEntityTypesAndComputeDataResponse(
|
return getSubEntityTypesAndComputeDataResponse(vitroRequest, log,
|
||||||
vitroRequest, log, dataset,
|
dataset, subjectEntityURI, entity);
|
||||||
subjectEntityURI, entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,14 +168,13 @@ public class EntityGrantCountRequestHandler implements
|
||||||
String subjectOrganization, Entity entity)
|
String subjectOrganization, Entity entity)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult =
|
Map<String, Set<String>> subOrganizationTypesResult = OrganizationUtilityFunctions
|
||||||
OrganizationUtilityFunctions.getSubEntityTypes(
|
.getSubEntityTypes(log, dataset, subjectOrganization);
|
||||||
log, dataset, subjectOrganization);
|
|
||||||
|
|
||||||
return prepareStandaloneDataResponse(vitroRequest, entity, subOrganizationTypesResult);
|
return prepareStandaloneDataResponse(vitroRequest, entity,
|
||||||
|
subOrganizationTypesResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<String, String> prepareStandaloneDataErrorResponse(
|
private Map<String, String> prepareStandaloneDataErrorResponse(
|
||||||
VitroRequest vitroRequest, String subjectEntityURI) {
|
VitroRequest vitroRequest, String subjectEntityURI) {
|
||||||
|
|
||||||
|
@ -188,24 +182,23 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData
|
||||||
|
.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
"{\"error\" : \"No Grants for this Organization found in VIVO.\"}");
|
"{\"error\" : \"No Grants for this Organization found in VIVO.\"}");
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<String, String> prepareStandaloneDataResponse(
|
private Map<String, String> prepareStandaloneDataResponse(
|
||||||
VitroRequest vitroRequest,
|
VitroRequest vitroRequest, Entity entity,
|
||||||
Entity entity,
|
Map<String, Set<String>> subOrganizationTypesResult)
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
writeGrantsOverTimeJSON(vitroRequest,
|
writeGrantsOverTimeJSON(vitroRequest, entity.getSubEntities(),
|
||||||
entity.getSubEntities(),
|
|
||||||
subOrganizationTypesResult));
|
subOrganizationTypesResult));
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
@ -218,14 +211,16 @@ public class EntityGrantCountRequestHandler implements
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
*/
|
*/
|
||||||
private Map<String, String> prepareDataResponse(Entity entity, Set<SubEntity> subentities,
|
private Map<String, String> prepareDataResponse(Entity entity,
|
||||||
|
Set<SubEntity> subentities,
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
String entityLabel = entity.getEntityLabel();
|
String entityLabel = entity.getEntityLabel();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To make sure that null/empty records for entity names do not cause any mischief.
|
* To make sure that null/empty records for entity names do not cause
|
||||||
* */
|
* any mischief.
|
||||||
|
*/
|
||||||
if (StringUtils.isBlank(entityLabel)) {
|
if (StringUtils.isBlank(entityLabel)) {
|
||||||
entityLabel = "no-organization";
|
entityLabel = "no-organization";
|
||||||
}
|
}
|
||||||
|
@ -233,32 +228,34 @@ public class EntityGrantCountRequestHandler implements
|
||||||
String outputFileName = UtilityFunctions.slugify(entityLabel)
|
String outputFileName = UtilityFunctions.slugify(entityLabel)
|
||||||
+ "_grants-per-year" + ".csv";
|
+ "_grants-per-year" + ".csv";
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_NAME_KEY,
|
fileData.put(DataVisualizationController.FILE_NAME_KEY, outputFileName);
|
||||||
outputFileName);
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
getEntityGrantsPerYearCSVContent(subentities, subOrganizationTypesResult));
|
getEntityGrantsPerYearCSVContent(subentities,
|
||||||
|
subOrganizationTypesResult));
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TemplateResponseValues prepareStandaloneMarkupResponse(
|
||||||
private TemplateResponseValues prepareStandaloneMarkupResponse(VitroRequest vreq,
|
VitroRequest vreq, String entityURI) {
|
||||||
String entityURI) {
|
|
||||||
|
|
||||||
String standaloneTemplate = "entityComparisonOnGrantsStandalone.ftl";
|
String standaloneTemplate = "entityComparisonOnGrantsStandalone.ftl";
|
||||||
|
|
||||||
String organizationLabel = OrganizationUtilityFunctions.getEntityLabelFromDAO(vreq,
|
String organizationLabel = OrganizationUtilityFunctions
|
||||||
entityURI);
|
.getEntityLabelFromDAO(vreq, entityURI);
|
||||||
|
|
||||||
Map<String, Object> body = new HashMap<String, Object>();
|
Map<String, Object> body = new HashMap<String, Object>();
|
||||||
body.put("title", organizationLabel + " - Temporal Graph Visualization");
|
body
|
||||||
|
.put("title", organizationLabel
|
||||||
|
+ " - Temporal Graph Visualization");
|
||||||
body.put("organizationURI", entityURI);
|
body.put("organizationURI", entityURI);
|
||||||
body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq));
|
body.put("organizationLocalName", UtilityFunctions
|
||||||
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace());
|
.getIndividualLocalName(entityURI, vreq));
|
||||||
|
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory()
|
||||||
|
.getDefaultNamespace());
|
||||||
body.put("organizationLabel", organizationLabel);
|
body.put("organizationLabel", organizationLabel);
|
||||||
|
|
||||||
return new TemplateResponseValues(standaloneTemplate, body);
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
|
@ -266,20 +263,23 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to generate a json file for year <-> grant count mapping.
|
* Function to generate a json file for year <-> grant count mapping.
|
||||||
|
*
|
||||||
* @param vreq
|
* @param vreq
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
|
* @throws MalformedQueryParametersException
|
||||||
*/
|
*/
|
||||||
private String writeGrantsOverTimeJSON(VitroRequest vreq,
|
private String writeGrantsOverTimeJSON(VitroRequest vreq,
|
||||||
Set<SubEntity> subentities,
|
Set<SubEntity> subentities,
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
Map<String, Set<String>> subOrganizationTypesResult)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Gson json = new Gson();
|
Gson json = new Gson();
|
||||||
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
Set<JsonObject> subEntitiesJson = new HashSet<JsonObject>();
|
||||||
|
|
||||||
for (SubEntity subentity : subentities) {
|
for (SubEntity subentity : subentities) {
|
||||||
JsonObject entityJson = new JsonObject(
|
JsonObject entityJson = new JsonObject(subentity
|
||||||
subentity.getIndividualLabel());
|
.getIndividualLabel());
|
||||||
|
|
||||||
List<List<Integer>> yearGrantCount = new ArrayList<List<Integer>>();
|
List<List<Integer>> yearGrantCount = new ArrayList<List<Integer>>();
|
||||||
|
|
||||||
|
@ -288,8 +288,7 @@ public class EntityGrantCountRequestHandler implements
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
|
|
||||||
List<Integer> currentGrantYear = new ArrayList<Integer>();
|
List<Integer> currentGrantYear = new ArrayList<Integer>();
|
||||||
if (grantEntry.getKey().equals(
|
if (grantEntry.getKey().equals(VOConstants.DEFAULT_GRANT_YEAR)) {
|
||||||
VOConstants.DEFAULT_GRANT_YEAR)) {
|
|
||||||
currentGrantYear.add(-1);
|
currentGrantYear.add(-1);
|
||||||
} else {
|
} else {
|
||||||
currentGrantYear.add(Integer.parseInt(grantEntry.getKey()));
|
currentGrantYear.add(Integer.parseInt(grantEntry.getKey()));
|
||||||
|
@ -305,7 +304,8 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
entityJson.setEntityURI(subentity.getIndividualURI());
|
entityJson.setEntityURI(subentity.getIndividualURI());
|
||||||
|
|
||||||
if (UtilityFunctions.isEntityAPerson(vreq, subentity.getIndividualURI())) {
|
if (UtilityFunctions.isEntityAPerson(vreq, subentity
|
||||||
|
.getIndividualURI())) {
|
||||||
entityJson.setVisMode("PERSON");
|
entityJson.setVisMode("PERSON");
|
||||||
} else {
|
} else {
|
||||||
entityJson.setVisMode("ORGANIZATION");
|
entityJson.setVisMode("ORGANIZATION");
|
||||||
|
@ -318,8 +318,7 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEntityGrantsPerYearCSVContent(
|
private String getEntityGrantsPerYearCSVContent(Set<SubEntity> subentities,
|
||||||
Set<SubEntity> subentities,
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult) {
|
Map<String, Set<String>> subOrganizationTypesResult) {
|
||||||
|
|
||||||
StringBuilder csvFileContent = new StringBuilder();
|
StringBuilder csvFileContent = new StringBuilder();
|
||||||
|
@ -328,7 +327,8 @@ public class EntityGrantCountRequestHandler implements
|
||||||
|
|
||||||
for (SubEntity subEntity : subentities) {
|
for (SubEntity subEntity : subentities) {
|
||||||
|
|
||||||
csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity.getIndividualLabel()));
|
csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity
|
||||||
|
.getIndividualLabel()));
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
csvFileContent.append(subEntity.getActivities().size());
|
csvFileContent.append(subEntity.getActivities().size());
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
|
@ -340,7 +340,8 @@ public class EntityGrantCountRequestHandler implements
|
||||||
joinedTypes.append(subOrganizationType + "; ");
|
joinedTypes.append(subOrganizationType + "; ");
|
||||||
}
|
}
|
||||||
|
|
||||||
csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes.toString()));
|
csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes
|
||||||
|
.toString()));
|
||||||
csvFileContent.append("\n");
|
csvFileContent.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.entitycomparison.Organizat
|
||||||
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.valueobjects.Activity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Entity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Entity;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.MapOfScienceActivity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.MapOfScienceActivity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SubEntity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SubEntity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.json.MapOfScience;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.json.MapOfScience;
|
||||||
|
@ -262,12 +263,18 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
|
|
||||||
private Map<String, String> prepareStandaloneDataErrorResponse() {
|
private Map<String, String> prepareStandaloneDataErrorResponse() {
|
||||||
|
|
||||||
|
GenericQueryMap errorDataResponse = new GenericQueryMap();
|
||||||
|
errorDataResponse.addEntry("error", "No Publications for this Entity found in VIVO.");
|
||||||
|
|
||||||
|
Gson jsonErrorResponse = new Gson();
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
|
||||||
"{\"error\" : \"No Publications for this Entity found in VIVO.\"}");
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY, jsonErrorResponse.toJson(errorDataResponse));
|
||||||
|
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +333,8 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
|
|
||||||
private Map<String, String> prepareStandaloneDataResponse(
|
private Map<String, String> prepareStandaloneDataResponse(
|
||||||
VitroRequest vitroRequest,
|
VitroRequest vitroRequest,
|
||||||
Entity entity) {
|
Entity entity)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, String> fileData = new HashMap<String, String>();
|
Map<String, String> fileData = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -362,9 +370,10 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
* @param vreq
|
* @param vreq
|
||||||
* @param subentities
|
* @param subentities
|
||||||
* @param subOrganizationTypesResult
|
* @param subOrganizationTypesResult
|
||||||
|
* @throws MalformedQueryParametersException
|
||||||
*/
|
*/
|
||||||
private String writeMapOfScienceDataJSON(VitroRequest vreq,
|
private String writeMapOfScienceDataJSON(VitroRequest vreq,
|
||||||
Entity subjectEntity) {
|
Entity subjectEntity) throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Gson json = new Gson();
|
Gson json = new Gson();
|
||||||
Set jsonContent = new HashSet();
|
Set jsonContent = new HashSet();
|
||||||
|
|
|
@ -29,6 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaborationData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaborationData;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaborator;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaborator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap;
|
||||||
|
@ -251,11 +252,20 @@ public class UtilityFunctions {
|
||||||
return collaboratorshipNetworkURL != null ? collaboratorshipNetworkURL : "" ;
|
return collaboratorshipNetworkURL != null ? collaboratorshipNetworkURL : "" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEntityAPerson(VitroRequest vreq, String individualURI) {
|
public static boolean isEntityAPerson(VitroRequest vreq, String individualURI)
|
||||||
return vreq.getWebappDaoFactory()
|
throws MalformedQueryParametersException {
|
||||||
|
Individual individualByURI = vreq.getWebappDaoFactory()
|
||||||
.getIndividualDao()
|
.getIndividualDao()
|
||||||
.getIndividualByURI(individualURI)
|
.getIndividualByURI(individualURI);
|
||||||
|
|
||||||
|
if (individualByURI != null) {
|
||||||
|
|
||||||
|
return individualByURI
|
||||||
.isVClass("http://xmlns.com/foaf/0.1/Person");
|
.isVClass("http://xmlns.com/foaf/0.1/Person");
|
||||||
|
} else {
|
||||||
|
throw new MalformedQueryParametersException("Individual with " + individualURI + " not found in the system.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue