From 6f213a61fa15cfbbc30613ddfbe04fd2701413c5 Mon Sep 17 00:00:00 2001 From: tankchintan Date: Wed, 13 Jul 2011 22:39:28 +0000 Subject: [PATCH] 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. --- .../css/visualization/mapofscience/layout.css | 22 + .../mapofscience/vivo_scimap.jpg | Bin 0 -> 14468 bytes .../mapofscience/vivo_scimap_icon_v001.png | Bin 2450 -> 0 bytes .../mapofscience/DataTableWidget.js | 4 +- .../mapofscience/MarkerManager.js | 414 +++++++++--------- .../mapofscience/VisModeControllers.js | 14 +- .../individual-visualizationFoafPerson.ftl | 2 +- .../individual-visualizationMapOfScience.ftl | 2 +- .../mapOfScience/mapOfScienceSetup.ftl | 2 +- .../mapOfScience/mapOfScienceStandalone.ftl | 34 +- .../EntityPublicationCountRequestHandler.java | 318 +++++++------- .../EntityGrantCountRequestHandler.java | 295 ++++++------- ...pOfScienceVisualizationRequestHandler.java | 19 +- .../visutils/UtilityFunctions.java | 20 +- 14 files changed, 614 insertions(+), 532 deletions(-) create mode 100644 productMods/images/visualization/mapofscience/vivo_scimap.jpg delete mode 100644 productMods/images/visualization/mapofscience/vivo_scimap_icon_v001.png diff --git a/productMods/css/visualization/mapofscience/layout.css b/productMods/css/visualization/mapofscience/layout.css index 4a6960e1..1cf098fa 100644 --- a/productMods/css/visualization/mapofscience/layout.css +++ b/productMods/css/visualization/mapofscience/layout.css @@ -210,4 +210,26 @@ a.map-of-science-links { .paginatedtabs { 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; } \ No newline at end of file diff --git a/productMods/images/visualization/mapofscience/vivo_scimap.jpg b/productMods/images/visualization/mapofscience/vivo_scimap.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6a6161c9028e778fb0e64b395c92cc0f7b11a8da GIT binary patch literal 14468 zcmeG@XH-;4vps41k*( z&;$VR13XF+U?7Boe*mQj_;@e?L8uv%a2RUtI1d`~=mD66nebtv^m(u}g!k>B0PJ|% zv#@*)1cx^Ppdmg{T9X(-WP(R1gUw)tG9n1JUPc5z3Z2A=W&wR&Jv}pB6Ei&nf}V+) zfr*)s9uxsEXHZkRok35^H#mctg!K_dm~be}I4^GcI8d{v#(`3wJ`OZ$LIz43Jt><{ zdrTZ~f+e)bSjm0G?Eu2O5d_$}0Tj0ri1KQHv3FGC)h9FcK(kBOD}_dlzL1wd6zb5>yyT7=S`!`EYoC0YM=+`9Bj;0F9X-iUSlD zg+XJ{e0Ur`A4b>!5+yL$Ig)yO*2@B=lp{Cmb zzY$qRvT6BS)a?#=lkD%LvyJ7deBP12U)fq#&1va&&^UZ{+tnj?U%c-*S8%W9L$7ae z)b^tph4){!_L(^Pg+%W-mRVF@`>|gFpwUoUEKesqj?ajv!W=zGEYu)US&C18^Fe7u zgWH~!T?VQ_&CG;ETQ3TnviC7&liy9M@Sio%m{NgT4}>wi zJ|%!9=rr?NQuefr9!zwreZ6YcyN{wXTOISBjMT738SMC>{aoP21p`L26I!pNdwe|b za_@KN%{_0<)m(Y&V34x+>y0lu*oc>6=OVeFGX9bC5-vy?Q5tRGg6jBDH=+6I>{Zn8 z{MCD0D8vf{^Y6CS@m~iB%MK+~JIN9k2QA)?JBB~naKH5$7bINgf}2^rOVg85+|y~n zyWTX`ynGv-C0ZX{+ONqRMQXLioq*Ea9{4HH^JyM;w{pU$~a zd~{aP@cYAXgsO>4;BwiV~f8f%Ny&%0p!I9wq#qUP=nque+B zai=>p%k3#6Cs#K1gqSYt{Yfhy&+|#^muz(G;FO{L;AKanst7wO4X+Wc`kPMN!M5n!S=xgv1eDRj0whaJIT!z%K_1Z=5HFEX7&n}Cth)6v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ac)Ns2C8i< zR;H+V_DA;>)`0w;6&r>EO5)_SIMum1v7L`!GEZ)+S@E2xnN_oD^m6L9%^>a)$H#J{ z+a136@!aaau-U#4Xt?aJ7h}Us{2NpDWi=X>Sf*`{zg*bQc6MK>ZL;Y2(hFZY?;Mlb zoqlP1Y)oHk-Rm2SYmr^8VP4)(Y}_1Zu#7Fq`A2G*!v5HcoAr%!lGR* z^VcRPAAH8(z27{f zWj7qz8XYbad-7Fcyy{zMBJWz>GC_987q8<6V%~r2JuNl(d6vrxck_+7qV>cp-jNS3 zdhO0V9pAah)w-xS&*S>6((!7ia?#GW(9LUElnI=nEPOWM;4 zKGS@B?7i*1?L4xx(b?I%HM4i~`Jiu!W!~V>lcJ49MV=M*i#B9M${07_{&1NiDStF_ zrb3wDE`e2d9`Dw5Y8R+-66v`HxBF_7H8i`=xz}Gc%yvzF-}0(tKDEQyK*v=t>wsHc zLfTzpw@>xid7-iwL)T{*7^V^GIRynuoX+!cLls5r_EGa~)m$JtZ=|DU*mH+_zh6c3 zXm`LfMko9Sr0V|Ct{HxcU%xiSUEPwaVs64; IX>Q&B08c4~H2?qr literal 0 HcmV?d00001 diff --git a/productMods/images/visualization/mapofscience/vivo_scimap_icon_v001.png b/productMods/images/visualization/mapofscience/vivo_scimap_icon_v001.png deleted file mode 100644 index 8b02295649f676f694212d4e15c6495f73d6d908..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2450 zcmV;D32pX?P)pSD0-5|rrHt()o8sgrs1=#lB%xwBf*g8uN~ zLzD3+)4hB5lpZ~LV3h5xvaqxDMK52z%s6`Vs3%Y?nVXwyCQqImzK8W0zi81SGj-}z zgDa?@#K3_A?f2KOUmJ0i@H3PeK74pcESwrQU;(>YKK6=5tyR5*E#J0nn<*_VHJ2`3 zG7?axOP4NY@#4j1`t<46UnQ`b`7NT>e*gZxwXVwO(WCL}OfO#!L<3t}TU&JCzyWjn z_HAFKR;^lP!Ja*PHhd4zr%s)+-{;PqYXN%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Y>p5yu8${ zTetQTrua=8(gcpaZ{EDwY%(&L@Sgpo;=)y05=u$un92Un-R_V*BQ2~6N&NesQ$|L% zL?v?l>h9|R{6eawpxZ6nhaJ!wi&F+h0}T`O?Agj<#qa2Prqn)8~SO>+yweC6rH-MfX{>_^= zn`h6Sg`cfiv&Q=I@#DvBW-BNturcDaKq1F3{}WG)5OjZ}rlv*(48KBsBmwA2D=`90 zgL2)vbxpt`Sh%pT(0<3gu)5Q$l{qD2+;5HmTp|f$uUsk7wp=NX&?;RJ*d)EWsKS++s~j)U|5Y-w6rT88>qEW+s{ph*mFApu}fp()Qo zsV(B>;XGbBxw_SuMJ=mfaS!#~_LeYUheonxu@J1_KFe*XO2bD14GRDkw(xtefvfnv z4v5#n3OZ9LtPEa_#oDk3fu;N!4J;x7rwPHdI_RRj@+uHN4Pr$qEqvCU3Ax~5c7p)( z^4Uo1?%%)PIBz;D+7)obOByOV diff --git a/productMods/js/visualization/mapofscience/DataTableWidget.js b/productMods/js/visualization/mapofscience/DataTableWidget.js index d3294827..8d36a7b9 100644 --- a/productMods/js/visualization/mapofscience/DataTableWidget.js +++ b/productMods/js/visualization/mapofscience/DataTableWidget.js @@ -237,7 +237,7 @@ var DataTableWidget = Class.extend({ } me.currentSelectedFilter = SCIMAP_TYPE.SUBDISCIPLINE; $("a#csv").attr("href", entityMapOfScienceSubDisciplineCSVURL); - $("a#csv").html("Export All Sub-Displines"); + $("a#csv").html("Export All Sub-Disciplines"); } else { @@ -247,7 +247,7 @@ var DataTableWidget = Class.extend({ me.widget.fnSettings()._iDisplayLength = 13; } $("a#csv").attr("href", entityMapOfScienceDisciplineCSVURL); - $("a#csv").html("Export All Displines"); + $("a#csv").html("Export All Disciplines"); } diff --git a/productMods/js/visualization/mapofscience/MarkerManager.js b/productMods/js/visualization/mapofscience/MarkerManager.js index fbcd7f49..266f8004 100644 --- a/productMods/js/visualization/mapofscience/MarkerManager.js +++ b/productMods/js/visualization/mapofscience/MarkerManager.js @@ -1,207 +1,207 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ -/** - * The MarkerManager is more like a composite class of Marker. It manages - * markers by grouping the markers by keys. - */ -var MarkerManager = Class.extend({ - init: function() { - this.keyToMarker = {}; - }, - addMarker: function(key, marker) { - this.keyToMarker[key] = marker; - }, - length: function() { - var size = 0; - for (var key in this.keyToMarker) { - if (this.keyToMarker.hasOwnProperty(key)) size++; - } - return size; - }, - getMarker: function(key) { - return this.keyToMarker[key]; - }, - getMarkerArray: function() { - var array = []; - $.each(this.keyToMarker, function(i, e){ array.push(e); }); - return array; - }, - hasKey: function(key) { - return (this.keyToMarker.hasOwnProperty(key)); - }, - showMarkers: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.show(); - }); - }, - hideMarkers: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.hide(); - }); - }, - addMarkersToMap: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.addToMap(); - }); - }, - removeMarkersFromMap: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.removeFromMap(); - }); - } -}); - -/** - * Customized Discipline labels MarkerManager for Science map purpose. It is an abstract class - */ -var DisciplineLabelsMarkerManager = MarkerManager.extend({ - init: function(map) { - this._super(); - this.map = map; - this.initMarkers(map); - }, - initMarkers: function(map) { - me = this; - $.each(DISCIPLINES, function(id, discipline) { - var opts = { - map: map, - position: createNoWrapLatLng(discipline.labelLatitude, discipline.labelLongitude), - icon: getDisciplineLabelImageURL(id), - clickable: false - }; - me.addMarker(id, new Marker(opts)); - }); - }, - showMarkers: function() { - this._super(); - } -}); - -/** - * Customized MarkerManager for Science map purpose. It is an abstract class - */ -var ScimapMarkerManager = MarkerManager.extend({ - init: function(map, colorStrategy, sizeCoder) { - this._super(); - this.colorStrategy = colorStrategy; - this.sizeCoder = sizeCoder; - this.map = map; - this.maxValue = 1; - this.layer = {}; - }, - setSizeCoder: function(sizeCoder) { - this.sizeCoder = sizeCoder; - this.maxValue = sizeCoder.getMaxValue(); - }, - createMarker: function(key, density) { - var me = this; - var marker; - if (!me.hasKey(key)) { - var size = me.sizeCoder.getSize(density); - var color = me.colorStrategy.getColor(key); - var layer = me.layer; - var label = layer[key].label; - var latlng = createNoWrapLatLng(layer[key].latitude, layer[key].longitude); - marker = createScinodeMarker(me.map, label, density, size, color, latlng); - me.addMarker(key, marker); - } else { - marker = me.keyToMarker[key]; - marker.setValue(marker.getValue() + density); - marker.setSize(me.sizeCoder.getSize(marker.getValue())); - } - return marker; - }, - updateMarkerViews: function() { - var me = this; - for (var key in me.keyToMarker) { - var marker = me.keyToMarker[key]; - marker.setSize(me.sizeCodingFunc(marker.getValue())); - marker.setColor(me.colorStrategy.getColor(key)); - } - }, - display: function(numberOfMarkers) { - var markerArray = this.sortedMarkers; - if (!markerArray || !markerArray.length) { - markerArray = this.getMarkerArray(); - } - - $.each(markerArray, function() { - if (numberOfMarkers > 0) { - this.show(); - numberOfMarkers--; - } else { - this.hide(); - } - }); - }, - mouseIn: function(key) { - var marker = this.getMarker(key); - if (marker) { - marker.focus(); - } - }, - mouseInAll: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.focus(); - }); - }, - mouseOut: function(key) { - var marker = this.getMarker(key); - if (marker) { - marker.unfocus(); - } - }, - mouseOutAll: function() { - $.each(this.keyToMarker, function(i, marker) { - marker.unfocus(); - }); - }, - sort: function() { - this.sortedMarkers = this.getMarkerArray(); - this.sortedMarkers.sort(function(a, b) { - return b.getValue() -a.getValue(); - }); - } -}); - -var DisciplineMarkerManager = ScimapMarkerManager.extend({ - init: function(map, colorStrategy, sizeCoder) { - this._super(map, colorStrategy, sizeCoder); - this.layer = DISCIPLINES; - }, - createMarker: function(subdisciplineKey, density) { - var me = this; - var key = SUBDISCIPLINES[subdisciplineKey].discipline; - var marker = this._super(key, density); - var poly = marker.polygon; - - marker.setContent( - '

' - + poly.label +'
' - + addCommasToNumber(poly.value.toFixed(2)) + ' of publications (pubs.)
' - + (poly.value * 100 / this.maxValue).toFixed(2) + '% of activity
' - ); - return marker; - } -}); - -var SubdisciplineMarkerManager = ScimapMarkerManager.extend({ - init: function(map, colorStrategy, sizeCoder) { - this._super(map, colorStrategy, sizeCoder); - this.layer = SUBDISCIPLINES; - }, - createMarker: function(subdisciplineKey, density) { - var marker = this._super(subdisciplineKey, density); - var disciplineId = SUBDISCIPLINES[subdisciplineKey].discipline; - var disciplineLabel = DISCIPLINES[disciplineId].label; - var poly = marker.polygon; - /* Override the getContent for Subdiscipline */ - marker.setContent( - '
' - + poly.label + ' in ' + disciplineLabel +'
' - + addCommasToNumber(poly.value.toFixed(2)) + ' of publications (pubs.)
' - + (poly.value * 100 / this.maxValue).toFixed(2) + '% of activity
' - ); - - return marker; - } -}); +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ +/** + * The MarkerManager is more like a composite class of Marker. It manages + * markers by grouping the markers by keys. + */ +var MarkerManager = Class.extend({ + init: function() { + this.keyToMarker = {}; + }, + addMarker: function(key, marker) { + this.keyToMarker[key] = marker; + }, + length: function() { + var size = 0; + for (var key in this.keyToMarker) { + if (this.keyToMarker.hasOwnProperty(key)) size++; + } + return size; + }, + getMarker: function(key) { + return this.keyToMarker[key]; + }, + getMarkerArray: function() { + var array = []; + $.each(this.keyToMarker, function(i, e){ array.push(e); }); + return array; + }, + hasKey: function(key) { + return (this.keyToMarker.hasOwnProperty(key)); + }, + showMarkers: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.show(); + }); + }, + hideMarkers: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.hide(); + }); + }, + addMarkersToMap: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.addToMap(); + }); + }, + removeMarkersFromMap: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.removeFromMap(); + }); + } +}); + +/** + * Customized Discipline labels MarkerManager for Science map purpose. It is an abstract class + */ +var DisciplineLabelsMarkerManager = MarkerManager.extend({ + init: function(map) { + this._super(); + this.map = map; + this.initMarkers(map); + }, + initMarkers: function(map) { + me = this; + $.each(DISCIPLINES, function(id, discipline) { + var opts = { + map: map, + position: createNoWrapLatLng(discipline.labelLatitude, discipline.labelLongitude), + icon: getDisciplineLabelImageURL(id), + clickable: false + }; + me.addMarker(id, new Marker(opts)); + }); + }, + showMarkers: function() { + this._super(); + } +}); + +/** + * Customized MarkerManager for Science map purpose. It is an abstract class + */ +var ScimapMarkerManager = MarkerManager.extend({ + init: function(map, colorStrategy, sizeCoder) { + this._super(); + this.colorStrategy = colorStrategy; + this.sizeCoder = sizeCoder; + this.map = map; + this.maxValue = 1; + this.layer = {}; + }, + setSizeCoder: function(sizeCoder) { + this.sizeCoder = sizeCoder; + this.maxValue = sizeCoder.getMaxValue(); + }, + createMarker: function(key, density) { + var me = this; + var marker; + if (!me.hasKey(key)) { + var size = me.sizeCoder.getSize(density); + var color = me.colorStrategy.getColor(key); + var layer = me.layer; + var label = layer[key].label; + var latlng = createNoWrapLatLng(layer[key].latitude, layer[key].longitude); + marker = createScinodeMarker(me.map, label, density, size, color, latlng); + me.addMarker(key, marker); + } else { + marker = me.keyToMarker[key]; + marker.setValue(marker.getValue() + density); + marker.setSize(me.sizeCoder.getSize(marker.getValue())); + } + return marker; + }, + updateMarkerViews: function() { + var me = this; + for (var key in me.keyToMarker) { + var marker = me.keyToMarker[key]; + marker.setSize(me.sizeCodingFunc(marker.getValue())); + marker.setColor(me.colorStrategy.getColor(key)); + } + }, + display: function(numberOfMarkers) { + var markerArray = this.sortedMarkers; + if (!markerArray || !markerArray.length) { + markerArray = this.getMarkerArray(); + } + + $.each(markerArray, function() { + if (numberOfMarkers > 0) { + this.show(); + numberOfMarkers--; + } else { + this.hide(); + } + }); + }, + mouseIn: function(key) { + var marker = this.getMarker(key); + if (marker) { + marker.focus(); + } + }, + mouseInAll: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.focus(); + }); + }, + mouseOut: function(key) { + var marker = this.getMarker(key); + if (marker) { + marker.unfocus(); + } + }, + mouseOutAll: function() { + $.each(this.keyToMarker, function(i, marker) { + marker.unfocus(); + }); + }, + sort: function() { + this.sortedMarkers = this.getMarkerArray(); + this.sortedMarkers.sort(function(a, b) { + return b.getValue() -a.getValue(); + }); + } +}); + +var DisciplineMarkerManager = ScimapMarkerManager.extend({ + init: function(map, colorStrategy, sizeCoder) { + this._super(map, colorStrategy, sizeCoder); + this.layer = DISCIPLINES; + }, + createMarker: function(subdisciplineKey, density) { + var me = this; + var key = SUBDISCIPLINES[subdisciplineKey].discipline; + var marker = this._super(key, density); + var poly = marker.polygon; + + marker.setContent( + '
' + + poly.label +'
' + + addCommasToNumber(poly.value.toFixed(2)) + ' publications (pubs.)
' + + (poly.value * 100 / this.maxValue).toFixed(2) + '% activity
' + ); + return marker; + } +}); + +var SubdisciplineMarkerManager = ScimapMarkerManager.extend({ + init: function(map, colorStrategy, sizeCoder) { + this._super(map, colorStrategy, sizeCoder); + this.layer = SUBDISCIPLINES; + }, + createMarker: function(subdisciplineKey, density) { + var marker = this._super(subdisciplineKey, density); + var disciplineId = SUBDISCIPLINES[subdisciplineKey].discipline; + var disciplineLabel = DISCIPLINES[disciplineId].label; + var poly = marker.polygon; + /* Override the getContent for Subdiscipline */ + marker.setContent( + '
' + + poly.label + ' in ' + disciplineLabel +'
' + + addCommasToNumber(poly.value.toFixed(2)) + ' publications (pubs.)
' + + (poly.value * 100 / this.maxValue).toFixed(2) + '% activity
' + ); + + return marker; + } +}); diff --git a/productMods/js/visualization/mapofscience/VisModeControllers.js b/productMods/js/visualization/mapofscience/VisModeControllers.js index f2f1dd5a..2d9ab836 100644 --- a/productMods/js/visualization/mapofscience/VisModeControllers.js +++ b/productMods/js/visualization/mapofscience/VisModeControllers.js @@ -61,11 +61,11 @@ var EntityVisModeController = Class.extend({ if (me.isUnloaded) { if (sync) { downloader.downloadAndWait(url, function(data) { - me.loadJsonData(me, data[0]); + me.loadJsonData(me, data); }); } else { downloader.download(url, function(data) { - me.loadJsonData(me, data[0]); + me.loadJsonData(me, data); }); } } // end if @@ -74,12 +74,20 @@ var EntityVisModeController = Class.extend({ $("#" + responseContainerID).unblock(); + if (data.error) { + $("#map-of-science-response").hide(); + $("#error-container").show(); + return; + } + + data = data[0]; + $.each(me.widgets, function(i, widget) { widget.loadJsonData(data); }); me.isUnloaded = false; - me.initToolTipInfo(); + }, initToolTipInfo: function() { diff --git a/productMods/templates/freemarker/body/partials/individual/individual-visualizationFoafPerson.ftl b/productMods/templates/freemarker/body/partials/individual/individual-visualizationFoafPerson.ftl index a2cdeebc..60227a67 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-visualizationFoafPerson.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-visualizationFoafPerson.ftl @@ -18,7 +18,7 @@
<#if isAuthor> <#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 mapOfScienceVisUrl = individual.mapOfScienceUrl> diff --git a/productMods/templates/freemarker/body/partials/individual/individual-visualizationMapOfScience.ftl b/productMods/templates/freemarker/body/partials/individual/individual-visualizationMapOfScience.ftl index 96904745..a1b4473a 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-visualizationMapOfScience.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-visualizationMapOfScience.ftl @@ -3,5 +3,5 @@ <#-- Map Of Science visualization --> \ No newline at end of file diff --git a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl index 45b9e1d7..56276072 100644 --- a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl +++ b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceSetup.ftl @@ -25,7 +25,7 @@ -<#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 entityMapOfScienceDisciplineCSVURL = "${urls.base}${dataVisualizationURLRoot}?vis=${mapOfScienceVisParam}&uri=${entityURI}&output=csv&vis_mode=discipline"> diff --git a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl index 7c2f8a3d..1fcdb936 100644 --- a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl +++ b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl @@ -102,12 +102,25 @@ You can hover over a sub-discipline in the table below to show which overlaid ci

+<#-- In the table below, # of pubs. 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 -to impact more than one field and hence the publication score is distributed into number of fractions based on the weight scores -of the journal in the different fields.

+discipline). Sometimes this number will be fractional. This happens when a journal in which the publication was published is associated +with more than one (sub)discipline. In these cases, the publication score is fractionally mapped based on the weight scores +of the journal.

% activity 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. +

+ +The # of pubs. 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. + +

+The % activity column shows what proportion of the publications were mapped to each field. @@ -122,7 +135,20 @@ may need to be cleaned up before they are recognized. You may contact a VIVO sys concern. + +
+ +

${entityLabel}

+ +

Map of Science Visualization

+
+

This organization has neither sub-organizations nor people with publications in the system. + Please visit the full ${entityLabel} profile page for a more complete overview.

+
+
${headScripts.add('')} \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/entitycomparison/EntityPublicationCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/entitycomparison/EntityPublicationCountRequestHandler.java index 0a84b842..3af9f5c1 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/entitycomparison/EntityPublicationCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/entitycomparison/EntityPublicationCountRequestHandler.java @@ -35,7 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequ public class EntityPublicationCountRequestHandler implements VisualizationRequestHandler { - + @Override public ResponseValues generateStandardVisualization( VitroRequest vitroRequest, Log log, Dataset dataset) @@ -43,7 +43,7 @@ public class EntityPublicationCountRequestHandler implements String entityURI = vitroRequest .getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY); - + return generateStandardVisualizationForPublicationTemporalVis( vitroRequest, log, dataset, entityURI); } @@ -51,19 +51,17 @@ public class EntityPublicationCountRequestHandler implements private ResponseValues generateStandardVisualizationForPublicationTemporalVis( VitroRequest vitroRequest, Log log, Dataset dataset, String entityURI) throws MalformedQueryParametersException { - + if (StringUtils.isBlank(entityURI)) { - + entityURI = OrganizationUtilityFunctions - .getStaffProvidedOrComputedHighestLevelOrganization( - log, - dataset, - vitroRequest); - + .getStaffProvidedOrComputedHighestLevelOrganization(log, + dataset, vitroRequest); + } - + return prepareStandaloneMarkupResponse(vitroRequest, entityURI); - + } @Override @@ -72,46 +70,50 @@ public class EntityPublicationCountRequestHandler implements Dataset dataSource) throws MalformedQueryParametersException { return generateStandardVisualizationForPublicationTemporalVis( - vitroRequest, log, dataSource, parameters.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY)); - + vitroRequest, + log, + dataSource, + parameters + .get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY)); + } private Map getSubjectEntityAndGenerateDataResponse( VitroRequest vitroRequest, Log log, Dataset dataset, - String subjectEntityURI) - throws MalformedQueryParametersException { - - ModelConstructor constructQueryRunner = - new EntityPublicationCountConstructQueryRunner(subjectEntityURI, dataset, log); - + String subjectEntityURI) throws MalformedQueryParametersException { + + ModelConstructor constructQueryRunner = new EntityPublicationCountConstructQueryRunner( + subjectEntityURI, dataset, log); + Model constructedModel = constructQueryRunner.getConstructedModel(); - + QueryRunner queryManager = new EntityPublicationCountQueryRunner( subjectEntityURI, constructedModel, log); - + Entity entity = queryManager.getQueryResult(); - + if (entity.getEntityLabel().equals("no-label")) { - - return prepareStandaloneDataErrorResponse(vitroRequest, subjectEntityURI); - - } else { - - return getSubEntityTypesAndComputeDataResponse( - vitroRequest, log, dataset, - subjectEntityURI, entity); + + return prepareStandaloneDataErrorResponse(vitroRequest, + subjectEntityURI); + + } else { + + return getSubEntityTypesAndComputeDataResponse(vitroRequest, log, + dataset, subjectEntityURI, entity); } } - + private Map prepareStandaloneDataErrorResponse( VitroRequest vitroRequest, String subjectEntityURI) { Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); - fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - "{\"error\" : \"No Publications for this Organization found in VIVO.\"}"); + + fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, + "application/octet-stream"); + fileData + .put(DataVisualizationController.FILE_CONTENT_KEY, + "{\"error\" : \"No Publications for this Organization found in VIVO.\"}"); return fileData; } @@ -119,13 +121,12 @@ public class EntityPublicationCountRequestHandler implements VitroRequest vitroRequest, Log log, Dataset dataset, String subjectEntityURI, Entity entity) throws MalformedQueryParametersException { - - Map> subOrganizationTypesResult = - OrganizationUtilityFunctions.getSubEntityTypes( - log, dataset, subjectEntityURI); - - return prepareStandaloneDataResponse(vitroRequest, entity, entity.getSubEntities(), - subOrganizationTypesResult); + + Map> subOrganizationTypesResult = OrganizationUtilityFunctions + .getSubEntityTypes(log, dataset, subjectEntityURI); + + return prepareStandaloneDataResponse(vitroRequest, entity, entity + .getSubEntities(), subOrganizationTypesResult); } @Override @@ -135,154 +136,155 @@ public class EntityPublicationCountRequestHandler implements String entityURI = vitroRequest .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 - .equalsIgnoreCase(vitroRequest.getParameter( - VisualizationFrameworkConstants.VIS_MODE_KEY))) { - + .equalsIgnoreCase(vitroRequest + .getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) { + if (StringUtils.isNotBlank(entityURI)) { - - return getSubjectEntityAndGenerateDataResponse( - vitroRequest, - log, - dataset, - entityURI); + + return getSubjectEntityAndGenerateDataResponse(vitroRequest, + log, dataset, entityURI); } else { - + return getSubjectEntityAndGenerateDataResponse( - vitroRequest, - log, - dataset, - OrganizationUtilityFunctions - .getStaffProvidedOrComputedHighestLevelOrganization( - log, - dataset, - vitroRequest)); + vitroRequest, + log, + dataset, + OrganizationUtilityFunctions + .getStaffProvidedOrComputedHighestLevelOrganization( + log, dataset, vitroRequest)); } - + } else { /* * This provides csv download files for the content in the tables. - * */ - - ModelConstructor constructQueryRunner = - new EntityPublicationCountConstructQueryRunner(entityURI, dataset, log); - + */ + + ModelConstructor constructQueryRunner = new EntityPublicationCountConstructQueryRunner( + entityURI, dataset, log); + Model constructedModel = constructQueryRunner.getConstructedModel(); - + QueryRunner queryManager = new EntityPublicationCountQueryRunner( - entityURI, constructedModel, log); - + entityURI, constructedModel, log); + Entity entity = queryManager.getQueryResult(); - Map> subOrganizationTypesResult = - OrganizationUtilityFunctions.getSubEntityTypes( - log, dataset, entityURI); + Map> subOrganizationTypesResult = OrganizationUtilityFunctions + .getSubEntityTypes(log, dataset, entityURI); + + return prepareDataResponse(entity, entity.getSubEntities(), + subOrganizationTypesResult); - return prepareDataResponse(entity, entity.getSubEntities(), subOrganizationTypesResult); - } - + } - - + @Override public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log, 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 - * years is requested. + * Provides response when json file containing the publication count over + * the years is requested. * * @param entity * @param subentities * @param subOrganizationTypesResult */ - private Map prepareDataResponse(Entity entity, Set subentities, + private Map prepareDataResponse(Entity entity, + Set subentities, Map> subOrganizationTypesResult) { 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)) { entityLabel = "no-organization"; } - + String outputFileName = UtilityFunctions.slugify(entityLabel) + "_publications-per-year" + ".csv"; - - - Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_NAME_KEY, - outputFileName); - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); - fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - getEntityPublicationsPerYearCSVContent(subentities, subOrganizationTypesResult)); - return fileData; - } - - private Map prepareStandaloneDataResponse( - VitroRequest vitroRequest, - Entity entity, - Set subentities, - Map> subOrganizationTypesResult) { Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); + + fileData.put(DataVisualizationController.FILE_NAME_KEY, outputFileName); + fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, + "application/octet-stream"); fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - writePublicationsOverTimeJSON(vitroRequest, - entity.getSubEntities(), - subOrganizationTypesResult)); + getEntityPublicationsPerYearCSVContent(subentities, + subOrganizationTypesResult)); return fileData; } - - private TemplateResponseValues prepareStandaloneMarkupResponse(VitroRequest vreq, - String entityURI) { - String standaloneTemplate = "entityComparisonOnPublicationsStandalone.ftl"; - - String organizationLabel = OrganizationUtilityFunctions - .getEntityLabelFromDAO(vreq, - entityURI); - - Map body = new HashMap(); - body.put("title", organizationLabel + " - Temporal Graph Visualization"); - body.put("organizationURI", entityURI); - body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); - body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); - body.put("organizationLabel", organizationLabel); - - return new TemplateResponseValues(standaloneTemplate, body); + private Map prepareStandaloneDataResponse( + VitroRequest vitroRequest, Entity entity, + Set subentities, + Map> subOrganizationTypesResult) + throws MalformedQueryParametersException { + + Map fileData = new HashMap(); + + 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 organizationLabel = OrganizationUtilityFunctions + .getEntityLabelFromDAO(vreq, entityURI); + + Map body = new HashMap(); + body + .put("title", organizationLabel + + " - Temporal Graph Visualization"); + body.put("organizationURI", entityURI); + body.put("organizationLocalName", UtilityFunctions + .getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory() + .getDefaultNamespace()); + body.put("organizationLabel", organizationLabel); + + return new TemplateResponseValues(standaloneTemplate, body); } /** * Function to generate a json file for year <-> publication count mapping. - * @param vreq + * + * @param vreq * @param subentities - * @param subOrganizationTypesResult + * @param subOrganizationTypesResult + * @throws MalformedQueryParametersException */ - private String writePublicationsOverTimeJSON(VitroRequest vreq, - Set subentities, - Map> - subOrganizationTypesResult) { + private String writePublicationsOverTimeJSON(VitroRequest vreq, + Set subentities, + Map> subOrganizationTypesResult) + throws MalformedQueryParametersException { Gson json = new Gson(); Set subEntitiesJson = new HashSet(); for (SubEntity subentity : subentities) { - JsonObject entityJson = new JsonObject( - subentity.getIndividualLabel()); + JsonObject entityJson = new JsonObject(subentity + .getIndividualLabel()); List> yearPubCount = new ArrayList>(); @@ -291,24 +293,26 @@ public class EntityPublicationCountRequestHandler implements .entrySet()) { List currentPubYear = new ArrayList(); - if (pubEntry.getKey().equals(VOConstants.DEFAULT_PUBLICATION_YEAR)) { + if (pubEntry.getKey().equals( + VOConstants.DEFAULT_PUBLICATION_YEAR)) { currentPubYear.add(-1); } else { currentPubYear.add(Integer.parseInt(pubEntry.getKey())); } - + currentPubYear.add(pubEntry.getValue()); yearPubCount.add(currentPubYear); } - + entityJson.setYearToActivityCount(yearPubCount); entityJson.getOrganizationTypes().addAll( subOrganizationTypesResult.get(entityJson.getLabel())); - + entityJson.setEntityURI(subentity.getIndividualURI()); - - boolean isPerson = UtilityFunctions.isEntityAPerson(vreq, subentity.getIndividualURI()); - + + boolean isPerson = UtilityFunctions.isEntityAPerson(vreq, subentity + .getIndividualURI()); + if (isPerson) { entityJson.setVisMode("PERSON"); } else { @@ -320,28 +324,30 @@ public class EntityPublicationCountRequestHandler implements } private String getEntityPublicationsPerYearCSVContent( - Set subentities, - Map> subOrganizationTypesResult) { + Set subentities, + Map> subOrganizationTypesResult) { StringBuilder csvFileContent = new StringBuilder(); - + csvFileContent.append("Entity Name, Publication Count, Entity Type\n"); - + for (SubEntity subEntity : subentities) { - - csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity.getIndividualLabel())); + + csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity + .getIndividualLabel())); csvFileContent.append(", "); csvFileContent.append(subEntity.getActivities().size()); csvFileContent.append(", "); - + StringBuilder joinedTypes = new StringBuilder(); - + for (String subOrganizationType : subOrganizationTypesResult - .get(subEntity.getIndividualLabel())) { + .get(subEntity.getIndividualLabel())) { joinedTypes.append(subOrganizationType + "; "); } - - csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes.toString())); + + csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes + .toString())); csvFileContent.append("\n"); } return csvFileContent.toString(); @@ -353,4 +359,4 @@ public class EntityPublicationCountRequestHandler implements return null; } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/entitygrantcount/EntityGrantCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/entitygrantcount/EntityGrantCountRequestHandler.java index 0812070f..2cb90cc2 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/entitygrantcount/EntityGrantCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/entitygrantcount/EntityGrantCountRequestHandler.java @@ -34,18 +34,17 @@ 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.VisualizationRequestHandler; - public class EntityGrantCountRequestHandler implements VisualizationRequestHandler { - + @Override public ResponseValues generateStandardVisualization( VitroRequest vitroRequest, Log log, Dataset dataset) throws MalformedQueryParametersException { - + String entityURI = vitroRequest .getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY); - + return generateStandardVisualizationForGrantTemporalVis(vitroRequest, log, dataset, entityURI); } @@ -54,13 +53,11 @@ public class EntityGrantCountRequestHandler implements VitroRequest vitroRequest, Log log, Dataset dataset, String entityURI) throws MalformedQueryParametersException { if (StringUtils.isBlank(entityURI)) { - + entityURI = OrganizationUtilityFunctions - .getStaffProvidedOrComputedHighestLevelOrganization( - log, - dataset, - vitroRequest); - + .getStaffProvidedOrComputedHighestLevelOrganization(log, + dataset, vitroRequest); + } return prepareStandaloneMarkupResponse(vitroRequest, entityURI); } @@ -71,7 +68,11 @@ public class EntityGrantCountRequestHandler implements Dataset dataSource) throws MalformedQueryParametersException { return generateStandardVisualizationForGrantTemporalVis( - vitroRequest, log, dataSource, parameters.get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY)); + vitroRequest, + log, + dataSource, + parameters + .get(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY)); } @@ -82,89 +83,83 @@ public class EntityGrantCountRequestHandler implements String entityURI = vitroRequest .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 - .equalsIgnoreCase(vitroRequest - .getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) { - + .equalsIgnoreCase(vitroRequest + .getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) { + if (StringUtils.isNotBlank(entityURI)) { - - return getSubjectEntityAndGenerateDataResponse( - vitroRequest, - log, - dataset, - entityURI); + + return getSubjectEntityAndGenerateDataResponse(vitroRequest, + log, dataset, entityURI); } else { - + return getSubjectEntityAndGenerateDataResponse( - vitroRequest, - log, - dataset, - OrganizationUtilityFunctions - .getStaffProvidedOrComputedHighestLevelOrganization( - log, - dataset, - vitroRequest)); + vitroRequest, + log, + dataset, + OrganizationUtilityFunctions + .getStaffProvidedOrComputedHighestLevelOrganization( + log, dataset, vitroRequest)); } - + } else { /* * This provides csv download files for the content in the tables. - * */ - ModelConstructor constructQueryRunner = - new EntityGrantCountConstructQueryRunner(entityURI, dataset, log); + */ + ModelConstructor constructQueryRunner = new EntityGrantCountConstructQueryRunner( + entityURI, dataset, log); - Model constructedModel = constructQueryRunner.getConstructedModel(); - - QueryRunner queryManager = new EntityGrantCountQueryRunner( - entityURI, constructedModel, log); - - Entity entity = queryManager.getQueryResult(); - - - Map> subOrganizationTypesResult = - OrganizationUtilityFunctions.getSubEntityTypes( - log, dataset, entityURI); + Model constructedModel = constructQueryRunner.getConstructedModel(); + + QueryRunner queryManager = new EntityGrantCountQueryRunner( + entityURI, constructedModel, log); + + Entity entity = queryManager.getQueryResult(); + + Map> subOrganizationTypesResult = OrganizationUtilityFunctions + .getSubEntityTypes(log, dataset, entityURI); + + return prepareDataResponse(entity, entity.getSubEntities(), + subOrganizationTypesResult); - return prepareDataResponse(entity, entity.getSubEntities(), subOrganizationTypesResult); - } } - + @Override public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log, Dataset dataset) throws MalformedQueryParametersException { - - throw new UnsupportedOperationException("Entity Grant Count " + + throw new UnsupportedOperationException("Entity Grant Count " + "does not provide Ajax response."); } - + private Map getSubjectEntityAndGenerateDataResponse( VitroRequest vitroRequest, Log log, Dataset dataset, - String subjectEntityURI) - throws MalformedQueryParametersException { - - ModelConstructor constructQueryRunner = - new EntityGrantCountConstructQueryRunner(subjectEntityURI, dataset, log); - + String subjectEntityURI) throws MalformedQueryParametersException { + + ModelConstructor constructQueryRunner = new EntityGrantCountConstructQueryRunner( + subjectEntityURI, dataset, log); + Model constructedModel = constructQueryRunner.getConstructedModel(); - + QueryRunner queryManager = new EntityGrantCountQueryRunner( - subjectEntityURI, constructedModel, log); + subjectEntityURI, constructedModel, log); Entity entity = queryManager.getQueryResult(); - + if (entity.getEntityLabel().equals("no-label")) { - return prepareStandaloneDataErrorResponse(vitroRequest, subjectEntityURI); - } else { - - return getSubEntityTypesAndComputeDataResponse( - vitroRequest, log, dataset, - subjectEntityURI, entity); + return prepareStandaloneDataErrorResponse(vitroRequest, + subjectEntityURI); + } else { + + return getSubEntityTypesAndComputeDataResponse(vitroRequest, log, + dataset, subjectEntityURI, entity); } } @@ -172,41 +167,39 @@ public class EntityGrantCountRequestHandler implements VitroRequest vitroRequest, Log log, Dataset dataset, String subjectOrganization, Entity entity) throws MalformedQueryParametersException { - - Map> subOrganizationTypesResult = - OrganizationUtilityFunctions.getSubEntityTypes( - log, dataset, subjectOrganization); - - return prepareStandaloneDataResponse(vitroRequest, entity, subOrganizationTypesResult); + + Map> subOrganizationTypesResult = OrganizationUtilityFunctions + .getSubEntityTypes(log, dataset, subjectOrganization); + + return prepareStandaloneDataResponse(vitroRequest, entity, + subOrganizationTypesResult); } - - + private Map prepareStandaloneDataErrorResponse( VitroRequest vitroRequest, String subjectEntityURI) { Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); - fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - "{\"error\" : \"No Grants for this Organization found in VIVO.\"}"); + + fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, + "application/octet-stream"); + fileData + .put(DataVisualizationController.FILE_CONTENT_KEY, + "{\"error\" : \"No Grants for this Organization found in VIVO.\"}"); return fileData; } - - + private Map prepareStandaloneDataResponse( - VitroRequest vitroRequest, - Entity entity, - Map> subOrganizationTypesResult) { + VitroRequest vitroRequest, Entity entity, + Map> subOrganizationTypesResult) + throws MalformedQueryParametersException { Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); - fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - writeGrantsOverTimeJSON(vitroRequest, - entity.getSubEntities(), - subOrganizationTypesResult)); + + fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, + "application/octet-stream"); + fileData.put(DataVisualizationController.FILE_CONTENT_KEY, + writeGrantsOverTimeJSON(vitroRequest, entity.getSubEntities(), + subOrganizationTypesResult)); return fileData; } @@ -218,68 +211,75 @@ public class EntityGrantCountRequestHandler implements * @param subentities * @param subOrganizationTypesResult */ - private Map prepareDataResponse(Entity entity, Set subentities, + private Map prepareDataResponse(Entity entity, + Set subentities, Map> subOrganizationTypesResult) { 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)) { entityLabel = "no-organization"; } - + String outputFileName = UtilityFunctions.slugify(entityLabel) + "_grants-per-year" + ".csv"; - - + Map fileData = new HashMap(); - - fileData.put(DataVisualizationController.FILE_NAME_KEY, - outputFileName); - fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, - "application/octet-stream"); - fileData.put(DataVisualizationController.FILE_CONTENT_KEY, - getEntityGrantsPerYearCSVContent(subentities, subOrganizationTypesResult)); + + fileData.put(DataVisualizationController.FILE_NAME_KEY, outputFileName); + fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, + "application/octet-stream"); + fileData.put(DataVisualizationController.FILE_CONTENT_KEY, + getEntityGrantsPerYearCSVContent(subentities, + subOrganizationTypesResult)); return fileData; } - - private TemplateResponseValues prepareStandaloneMarkupResponse(VitroRequest vreq, - String entityURI) { + private TemplateResponseValues prepareStandaloneMarkupResponse( + VitroRequest vreq, String entityURI) { String standaloneTemplate = "entityComparisonOnGrantsStandalone.ftl"; - - String organizationLabel = OrganizationUtilityFunctions.getEntityLabelFromDAO(vreq, - entityURI); - + + String organizationLabel = OrganizationUtilityFunctions + .getEntityLabelFromDAO(vreq, entityURI); + Map body = new HashMap(); - body.put("title", organizationLabel + " - Temporal Graph Visualization"); + body + .put("title", organizationLabel + + " - Temporal Graph Visualization"); body.put("organizationURI", entityURI); - body.put("organizationLocalName", UtilityFunctions.getIndividualLocalName(entityURI, vreq)); - body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace()); + body.put("organizationLocalName", UtilityFunctions + .getIndividualLocalName(entityURI, vreq)); + body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory() + .getDefaultNamespace()); body.put("organizationLabel", organizationLabel); - + return new TemplateResponseValues(standaloneTemplate, body); } - + /** * Function to generate a json file for year <-> grant count mapping. - * @param vreq + * + * @param vreq * @param subentities - * @param subOrganizationTypesResult + * @param subOrganizationTypesResult + * @throws MalformedQueryParametersException */ - private String writeGrantsOverTimeJSON(VitroRequest vreq, - Set subentities, - Map> subOrganizationTypesResult) { + private String writeGrantsOverTimeJSON(VitroRequest vreq, + Set subentities, + Map> subOrganizationTypesResult) + throws MalformedQueryParametersException { Gson json = new Gson(); Set subEntitiesJson = new HashSet(); for (SubEntity subentity : subentities) { - JsonObject entityJson = new JsonObject( - subentity.getIndividualLabel()); + JsonObject entityJson = new JsonObject(subentity + .getIndividualLabel()); List> yearGrantCount = new ArrayList>(); @@ -288,13 +288,12 @@ public class EntityGrantCountRequestHandler implements .entrySet()) { List currentGrantYear = new ArrayList(); - if (grantEntry.getKey().equals( - VOConstants.DEFAULT_GRANT_YEAR)) { + if (grantEntry.getKey().equals(VOConstants.DEFAULT_GRANT_YEAR)) { currentGrantYear.add(-1); } else { currentGrantYear.add(Integer.parseInt(grantEntry.getKey())); } - + currentGrantYear.add(grantEntry.getValue()); yearGrantCount.add(currentGrantYear); } @@ -304,45 +303,47 @@ public class EntityGrantCountRequestHandler implements subOrganizationTypesResult.get(entityJson.getLabel())); entityJson.setEntityURI(subentity.getIndividualURI()); - - if (UtilityFunctions.isEntityAPerson(vreq, subentity.getIndividualURI())) { + + if (UtilityFunctions.isEntityAPerson(vreq, subentity + .getIndividualURI())) { entityJson.setVisMode("PERSON"); } else { entityJson.setVisMode("ORGANIZATION"); - } - + } + subEntitiesJson.add(entityJson); } - + return json.toJson(subEntitiesJson); } - private String getEntityGrantsPerYearCSVContent( - Set subentities, - Map> subOrganizationTypesResult) { + private String getEntityGrantsPerYearCSVContent(Set subentities, + Map> subOrganizationTypesResult) { StringBuilder csvFileContent = new StringBuilder(); - + csvFileContent.append("Entity Name, Grant Count, Entity Type\n"); - + for (SubEntity subEntity : subentities) { - - csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity.getIndividualLabel())); + + csvFileContent.append(StringEscapeUtils.escapeCsv(subEntity + .getIndividualLabel())); csvFileContent.append(", "); csvFileContent.append(subEntity.getActivities().size()); csvFileContent.append(", "); - + StringBuilder joinedTypes = new StringBuilder(); - + for (String subOrganizationType : subOrganizationTypesResult - .get(subEntity.getIndividualLabel())) { + .get(subEntity.getIndividualLabel())) { joinedTypes.append(subOrganizationType + "; "); } - - csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes.toString())); + + csvFileContent.append(StringEscapeUtils.escapeCsv(joinedTypes + .toString())); csvFileContent.append("\n"); - } + } return csvFileContent.toString(); } @@ -352,5 +353,5 @@ public class EntityGrantCountRequestHandler implements // TODO Auto-generated method stub return null; } - + } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java index 44e6bd38..f9f4e15e 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java @@ -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.valueobjects.Activity; 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.SubEntity; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.json.MapOfScience; @@ -261,13 +262,19 @@ public class MapOfScienceVisualizationRequestHandler implements } private Map prepareStandaloneDataErrorResponse() { - + + GenericQueryMap errorDataResponse = new GenericQueryMap(); + errorDataResponse.addEntry("error", "No Publications for this Entity found in VIVO."); + + Gson jsonErrorResponse = new Gson(); + Map fileData = new HashMap(); fileData.put(DataVisualizationController.FILE_CONTENT_TYPE_KEY, "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; } @@ -326,7 +333,8 @@ public class MapOfScienceVisualizationRequestHandler implements private Map prepareStandaloneDataResponse( VitroRequest vitroRequest, - Entity entity) { + Entity entity) + throws MalformedQueryParametersException { Map fileData = new HashMap(); @@ -362,9 +370,10 @@ public class MapOfScienceVisualizationRequestHandler implements * @param vreq * @param subentities * @param subOrganizationTypesResult + * @throws MalformedQueryParametersException */ private String writeMapOfScienceDataJSON(VitroRequest vreq, - Entity subjectEntity) { + Entity subjectEntity) throws MalformedQueryParametersException { Gson json = new Gson(); Set jsonContent = new HashSet(); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/visutils/UtilityFunctions.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/visutils/UtilityFunctions.java index 07f87b51..4e7c1bc7 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/visutils/UtilityFunctions.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/visutils/UtilityFunctions.java @@ -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.constants.VOConstants; 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.Collaborator; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap; @@ -251,11 +252,20 @@ public class UtilityFunctions { return collaboratorshipNetworkURL != null ? collaboratorshipNetworkURL : "" ; } - public static boolean isEntityAPerson(VitroRequest vreq, String individualURI) { - return vreq.getWebappDaoFactory() - .getIndividualDao() - .getIndividualByURI(individualURI) - .isVClass("http://xmlns.com/foaf/0.1/Person"); + public static boolean isEntityAPerson(VitroRequest vreq, String individualURI) + throws MalformedQueryParametersException { + Individual individualByURI = vreq.getWebappDaoFactory() + .getIndividualDao() + .getIndividualByURI(individualURI); + + if (individualByURI != null) { + + return individualByURI + .isVClass("http://xmlns.com/foaf/0.1/Person"); + } else { + throw new MalformedQueryParametersException("Individual with " + individualURI + " not found in the system."); + } + }