From f6429af187cba3570fc4805b28274b9f89f8d6a7 Mon Sep 17 00:00:00 2001 From: cdtank Date: Wed, 19 Jan 2011 20:23:22 +0000 Subject: [PATCH] 1. Made changes so that publication related visualization queries respect the 1.2 ontology's date proeprties & also pre-1.2 onotology data. It first attempts to get date using new property, failing which it sees if date is present in old property & proceeds accordingly. 2. Refactored code for temporal graph vis. Fixed couple of bugs in it. --- .../entitycomparison/constants.js | 10 +- .../js/visualization/entitycomparison/util.js | 169 +++++++++--------- .../entityComparisonStandaloneActivator.ftl | 14 +- .../constants/QueryFieldLabels.java | 1 + .../coauthorship/CoAuthorshipQueryRunner.java | 32 ++-- .../EntityPublicationCountQueryRunner.java | 40 ++--- .../EntityPublicationCountRequestHandler.java | 7 +- .../PersonPublicationCountQueryRunner.java | 45 +++-- .../freemarker/valueobjects/BiboDocument.java | 65 +++---- .../freemarker/visutils/UtilityFunctions.java | 11 +- 10 files changed, 180 insertions(+), 214 deletions(-) diff --git a/productMods/js/visualization/entitycomparison/constants.js b/productMods/js/visualization/entitycomparison/constants.js index bf1cd930..ccfe9cda 100644 --- a/productMods/js/visualization/entitycomparison/constants.js +++ b/productMods/js/visualization/entitycomparison/constants.js @@ -30,11 +30,13 @@ var colorConstantQueue = [ DARK_BLUE, DARK_TURQUOISE, var freeColors = colorConstantQueue.slice(); +var globalDateObject = new Date(); + var year = { - min: 1998, - max: 2018, - globalMin: 1995, - globalMax: 2025 + min: globalDateObject.getFullYear() - 10, + max: globalDateObject.getFullYear(), + globalMin: globalDateObject.getFullYear() - 10, + globalMax: globalDateObject.getFullYear() }; var colors = {}; diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js index d41e4cb3..1093e7f8 100644 --- a/productMods/js/visualization/entitycomparison/util.js +++ b/productMods/js/visualization/entitycomparison/util.js @@ -284,9 +284,7 @@ function unStuffZerosFromLineGraphs(jsonObject, year) { calcZeroLessMinAndMax(jsonObject, year); var currentMinYear = year.globalMin, currentMaxYear = year.globalMax; - $ - .each( - jsonObject, + $.each(jsonObject, function(key, val) { var i = 0; for (i = 0; i < val.data.length; i++) { @@ -335,19 +333,21 @@ function unStuffZerosFromLineGraph(jsonObject) { * @returns jsonObject with stuffed data points. */ function stuffZerosIntoLineGraphs(jsonObject, year) { - + calcZeroLessMinAndMax(jsonObject, year); var arrayOfMinAndMaxYears = [ year.globalMin, year.globalMax ]; - $ - .each( - jsonObject, + $.each(jsonObject, function(key, val) { var position = arrayOfMinAndMaxYears[0], i = 0; + + //console.log(key, val, position, (arrayOfMinAndMaxYears[1] - arrayOfMinAndMaxYears[0]) + 1); for (i = 0; i < (arrayOfMinAndMaxYears[1] - arrayOfMinAndMaxYears[0]) + 1; i++) { + //console.log("val.data[i]", val.data[i]); + if (val.data[i]) { if (val.data[i][0] != position @@ -362,6 +362,8 @@ function stuffZerosIntoLineGraphs(jsonObject, year) { position++; } }); + + //console.log("after stuffing", jsonObject); } /** * During runtime, when the user checks/unchecks a checkbox, the zeroes have to @@ -375,36 +377,27 @@ function stuffZerosIntoLineGraphs(jsonObject, year) { */ function calcZeroLessMinAndMax(jsonObject, year) { - var globalMinYear = 5000, globalMaxYear = 0, minYear, maxYear, i = 0; + var validYearsInData = new Array(); $.each(jsonObject, function(key, val) { for (i = 0; i < val.data.length; i++) { - if (val.data[i][1] != 0) { - minYear = val.data[i][0]; - break; - } - } - - for (i = val.data.length - 1; i >= 0; i--) { - if (val.data[i][1] != 0 && val.data[i][0] != -1) { - maxYear = val.data[i][0]; - break; - } - - } - if (globalMinYear > minYear) { - globalMinYear = minYear; - } - if (globalMaxYear < maxYear) { - globalMaxYear = maxYear; + /* + * TO make sure that, + * 1. Not to consider years that dont have any counts attached to it. + * 2. Not to consider unknown years indicated by "-1". + * */ + if (val.data[i][1] != 0 && val.data[i][0] != -1) { + validYearsInData.push(val.data[i][0]); + } } - + }); - year.globalMin = globalMinYear; - year.globalMax = globalMaxYear; + year.globalMin = Math.min.apply(Math, validYearsInData); + year.globalMax = Math.max.apply(Math, validYearsInData); + } /** @@ -416,86 +409,85 @@ function calcZeroLessMinAndMax(jsonObject, year) { * @returns [minYear, maxYear] */ function calcMinandMaxYears(jsonObject, year) { - var minYear = 5000, maxYear = 0; + + var validYearsInData = new Array(); + $.each(jsonObject, function(key, val) { - if (minYear > val.data[0][0]) { - minYear = val.data[0][0]; - } - if (maxYear < val.data[val.data.length - 1][0] - && val.data[val.data.length - 1][0] != -1){ - maxYear = val.data[val.data.length - 1][0]; - }else { - if(val.data.length != 1){ - maxYear = val.data[val.data.length - 2][0]; + + for (i = 0; i < val.data.length; i++) { + + /* + * TO make sure that, + * 1. Not to consider years that dont have any counts attached to it. + * 2. Not to consider unknown years indicated by "-1". + * */ + if (val.data[i][1] != 0 && val.data[i][0] != -1) { + validYearsInData.push(val.data[i][0]); } } + }); - - year.min = minYear; - year.max = maxYear; + + + year.min = Math.min.apply(Math, validYearsInData); + year.max = Math.max.apply(Math, validYearsInData); + } /** - * y is an an object with two properties label and data. data is of the form - * [year,value] This function returns the max of all values. - * - * @param {Object} - * jsonObject + * This function returns the max from the counts of all the entities. Mainly used to + * normalize the width of bar below the line graph, also known as legend row. + * @returns maxCount */ -function calcMaxOfComparisonParameter(jsonObject) { - var sum = 0, i = 0, maxCount = 0; +function calcMaxOfComparisonParameter(allEntities) { - $.each(jsonObject, function(key, val) { - for (i = 0; i < val.data.length; i++) - sum += val.data[i][1]; + var validCountsInData = new Array(); + + $.each(allEntities, function(key, currentEntity) { + validCountsInData.push(calcSumOfComparisonParameter(currentEntity)); + }); - if (maxCount < sum) - maxCount = sum; - - sum = 0; - }); - -// console.log('returning max value' + maxCount); - return maxCount; + return Math.max.apply(Math, validCountsInData); } function calcMaxWithinComparisonParameter(jsonObject){ - var value = 0, i = 0, maxCount = 0; - + var validCountsInData = new Array(); + $.each(jsonObject, function(key, val) { - for (i = 0; i < val.data.length; i++){ - value = val.data[i][1]; - // console.log(val.data[i][1]); - - if (maxCount < value){ - maxCount = value; + + for (i = 0; i < val.data.length; i++) { + + /* + * TO make sure that, + * 1. Not to consider years that dont have any counts attached to it. + * 2. Not to consider unknown years indicated by "-1". + * */ + if (val.data[i][1] != 0 && val.data[i][0] != -1) { + validCountsInData.push(val.data[i][1]); } } + }); - //console.log('max value: ' + maxCount); - return maxCount; + return Math.max.apply(Math, validCountsInData); } /** - * x is an object and it has two properties label and data. data is a two - * dimensional array of the form [year, value] This function returns the sum of - * all the values. - * - * @param {Object} - * jsonObject + * This is used to find out the sum of all the counts of a particular entity. This is + * especially useful to render the bars below the line graph where it doesnt matter if + * a count has any associated year to it or not. * @returns sum{values}. */ -function calcSumOfComparisonParameter(jsonObject) { +function calcSumOfComparisonParameter(entity) { - var sum = 0, i = 0; - for (i = 0; i < jsonObject.data.length; i++) { - sum += jsonObject.data[i][1]; - } + var sum = 0; + + $.each(entity.data, function(index, data){ + sum += this[1]; + }); - // sum += jsonObject.publicationCount; return sum; } @@ -715,7 +707,9 @@ function setOptionsForPagination(object, itemsPerPage, numberOfDisplayEntries, * * @jsonRecords the set of entities from which the unknowns have to be removed. */ + function removeUnknowns(jsonRecords) { + var i = 0, j = 0; while (j < jsonRecords.length) { @@ -731,9 +725,11 @@ function removeUnknowns(jsonRecords) { } j++; } + } function insertBackUnknowns(jsonRecords) { + var i = 0, j = 0; while (j < jsonRecords.length) { @@ -853,7 +849,6 @@ function clearRenderedObjects(){ removeEntityUnChecked(renderedObjects, labelToEntityRecord[$(val).attr("value")]); removeLegendRow(val); displayLineGraphs(); - //console.log(index); } }); @@ -907,6 +902,7 @@ function prepareTableForDataTablePagination(jsonData){ table.attr('border', '0'); table.attr('id', 'datatable'); table.css('font-size', '0.9em'); + table.css('width', '100%'); var thead = $(''); var tr = $(''); @@ -1114,7 +1110,7 @@ function checkIfColorLimitIsReached(){ // console.log(getSize(labelToCheckedEntities)); - if(getSize(labelToCheckedEntities) >= 10){ + if (getSize(labelToCheckedEntities) >= 10) { disableUncheckedEntities(); } else { enableUncheckedEntities(); @@ -1130,8 +1126,9 @@ function setTickSizeOfAxes(){ checkedLabelToEntityRecord[index] = labelToEntityRecord[index]; }); - calcMinandMaxYears(checkedLabelToEntityRecord, year); - yearRange = (year.max - year.min); + //calcMinandMaxYears(checkedLabelToEntityRecord, year); + //yearRange = (year.max - year.min); + yearRange = (year.globalMax - year.globalMin); setLineWidthAndTickSize(yearRange, FlotOptions); setTickSizeOfYAxis(calcMaxWithinComparisonParameter(checkedLabelToEntityRecord), FlotOptions); diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonStandaloneActivator.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonStandaloneActivator.ftl index 2c53a2e6..92582527 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonStandaloneActivator.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonStandaloneActivator.ftl @@ -140,10 +140,14 @@ var organizationLabel = '${organizationLabel}'; updateCounter(); } }); + + //console.log("parse jaon", jQuery.parseJSON(jsonString)); //parse the json object and pass it to loadData jsonObject.prepare(jQuery.parseJSON(jsonString)); + //console.log(jsonObject); + function performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox) { removeUsedColor(entity); @@ -198,14 +202,6 @@ var organizationLabel = '${organizationLabel}'; prepareTableForDataTablePagination(jsonData); setEntityLevel(); - /* - calcMinandMaxYears(labelToEntityRecord, year); - yearRange = (year.max - year.min); - - setLineWidthAndTickSize(yearRange, FlotOptions); - setTickSizeOfYAxis(calcMaxOfComparisonParameter(labelToEntityRecord), FlotOptions); - */ - $(".disabled-checkbox-event-receiver").live("click", function () { if ($(this).next().is(':disabled')) { @@ -252,7 +248,7 @@ var organizationLabel = '${organizationLabel}'; */ $.each($("input.if_clicked_on_school"), function(index, checkbox) { - if (index > 2) { + if (index > 0) { return false; } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java index e842a20a..c898b09a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java @@ -24,6 +24,7 @@ public class QueryFieldLabels { public static final String DOCUMENT_BLURB = "documentBlurbLit"; public static final String DOCUMENT_DESCRIPTION = "documentDescriptionLit"; public static final String DOCUMENT_PUBLICATION_YEAR = "publicationYearLit"; + public static final String DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY = "publicationYearOldLit"; public static final String DOCUMENT_PUBLICATION_YEAR_MONTH = "publicationYearMonthLit"; public static final String DOCUMENT_PUBLICATION_DATE = "publicationDateLit"; diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipQueryRunner.java index e81dbd05..bc440500 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipQueryRunner.java @@ -376,21 +376,18 @@ public class CoAuthorshipQueryRunner implements QueryRunner { biboDocument.setDocumentMoniker(documentMonikerNode.toString()); } - RDFNode publicationYearNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR); - if (publicationYearNode != null) { - biboDocument.setPublicationYear(publicationYearNode.toString()); - } - - RDFNode publicationYearMonthNode = solution.get(QueryFieldLabels - .DOCUMENT_PUBLICATION_YEAR_MONTH); - if (publicationYearMonthNode != null) { - biboDocument.setPublicationYearMonth(publicationYearMonthNode.toString()); - } - RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); if (publicationDateNode != null) { biboDocument.setPublicationDate(publicationDateNode.toString()); } + + /* + * This is being used so that date in the data from pre-1.2 ontology can be captured. + * */ + RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY); + if (publicationYearUsing_1_1_PropertyNode != null) { + biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString()); + } return biboDocument; } @@ -418,11 +415,8 @@ public class CoAuthorshipQueryRunner implements QueryRunner { + " (str(?documentLabel) as ?" + QueryFieldLabels.DOCUMENT_LABEL + ") " + " (str(?documentMoniker) as ?" + QueryFieldLabels.DOCUMENT_MONIKER + ") " + " (str(?documentBlurb) as ?" + QueryFieldLabels.DOCUMENT_BLURB + ") " - + " (str(?publicationYear) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR + ") " - + " (str(?publicationYearMonth) as ?" - + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_MONTH + ") " - + " (str(?publicationDate) as ?" - + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") " + + " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") " + + " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") " + "WHERE { " + "<" + queryURI + "> rdf:type foaf:Person ;" + " rdfs:label ?authorLabel ;" @@ -433,9 +427,9 @@ public class CoAuthorshipQueryRunner implements QueryRunner { + "?document core:informationResourceInAuthorship ?coAuthorshipNode . " + "?coAuthorshipNode core:linkedAuthor ?coAuthorPerson . " + "?coAuthorPerson rdfs:label ?coAuthorPersonLabel . " - + "OPTIONAL { ?document core:year ?publicationYear } . " - + "OPTIONAL { ?document core:yearMonth ?publicationYearMonth } . " - + "OPTIONAL { ?document core:date ?publicationDate } . " + + "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . " + + " ?dateTimeValue core:dateTime ?publicationDate } ." + + "OPTIONAL { ?document core:year ?publicationYearUsing_1_1_property } ." + "OPTIONAL { ?document vitro:moniker ?documentMoniker } . " + "OPTIONAL { ?document vitro:blurb ?documentBlurb } . " + "OPTIONAL { ?document vitro:description ?documentDescription } " diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java index 9031049e..7446e662 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java @@ -52,18 +52,17 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { + " (str(?SecondaryPositionLabel) as ?SecondaryPositionLabelLit)" + " (str(?Document) as ?documentLit) " + " (str(?DocumentLabel) as ?documentLabelLit) " - + " (str(?publicationYear) as ?publicationYearLit) " - + " (str(?publicationYearMonth) as ?publicationYearMonthLit) " - + " (str(?publicationDate) as ?publicationDateLit) " + + " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") " + + " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") " + " (str(?StartYear) as ?StartYearLit)"; private static final String SPARQL_QUERY_COMMON_WHERE_CLAUSE = "" + "?Document rdf:type bibo:Document ;" + " rdfs:label ?DocumentLabel ." - + "OPTIONAL { ?Document core:year ?publicationYear } ." - + "OPTIONAL { ?Document core:yearMonth ?publicationYearMonth } ." - + "OPTIONAL { ?Document core:date ?publicationDate } ." + + "OPTIONAL { ?Document core:dateTimeValue ?dateTimeValue . " + + " ?dateTimeValue core:dateTime ?publicationDate } ." + + "OPTIONAL { ?Document core:year ?publicationYearUsing_1_1_property } ." + "OPTIONAL { ?SecondaryPosition core:startYear ?StartYear } ."; private static String ENTITY_LABEL; @@ -114,26 +113,17 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { biboDocument.setDocumentLabel(documentLabelNode.toString()); } - RDFNode publicationYearNode = solution - .get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR); - if (publicationYearNode != null) { - biboDocument.setPublicationYear(publicationYearNode - .toString()); - } - - RDFNode publicationYearMonthNode = solution - .get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_MONTH); - if (publicationYearMonthNode != null) { - biboDocument - .setPublicationYearMonth(publicationYearMonthNode - .toString()); - } - - RDFNode publicationDateNode = solution - .get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); + RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); if (publicationDateNode != null) { - biboDocument.setPublicationDate(publicationDateNode - .toString()); + biboDocument.setPublicationDate(publicationDateNode.toString()); + } + + /* + * This is being used so that date in the data from pre-1.2 ontology can be captured. + * */ + RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY); + if (publicationYearUsing_1_1_PropertyNode != null) { + biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString()); } } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java index 89c66cc2..ac0f0f74 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountRequestHandler.java @@ -198,11 +198,12 @@ 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 + } else { currentPubYear.add(Integer.parseInt(pubEntry.getKey())); + } + currentPubYear.add(pubEntry.getValue()); yearPubCount.add(currentPubYear); } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountQueryRunner.java index 957a0ec0..4ab328df 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountQueryRunner.java @@ -52,21 +52,20 @@ public class PersonPublicationCountQueryRunner implements QueryRunner= VOConstants.NUM_CHARS_IN_YEAR_FORMAT - && isValidPublicationYear(publicationYearMonth.substring( - 0, - VOConstants.NUM_CHARS_IN_YEAR_FORMAT))) { + if (publicationDate != null) { - return publicationYearMonth.substring(0, VOConstants.NUM_CHARS_IN_YEAR_FORMAT); + DateTimeFormatter dateTimeFormat = ISODateTimeFormat.dateHourMinuteSecond(); + try { + DateTime dateTime = dateTimeFormat.parseDateTime(publicationDate); + return String.valueOf(dateTime.getYear()); + } catch (Exception e) { + return publicationYear != null ? publicationYear : VOConstants.DEFAULT_PUBLICATION_YEAR; + } + + } else { + + /* + * If all else fails return default unknown year identifier if publicationYear is + * not mentioned. + * */ + return publicationYear != null ? publicationYear : VOConstants.DEFAULT_PUBLICATION_YEAR; } - - if (publicationDate != null - && publicationDate.length() >= VOConstants.NUM_CHARS_IN_YEAR_FORMAT - && isValidPublicationYear(publicationDate - .substring(0, - VOConstants.NUM_CHARS_IN_YEAR_FORMAT))) { - - return publicationDate.substring(0, VOConstants.NUM_CHARS_IN_YEAR_FORMAT); - } - - /* - * If all else fails return default unknown year identifier - * */ - return VOConstants.DEFAULT_PUBLICATION_YEAR; } /* * This publicationYear value is directly from the data supported by the ontology. * If this is empty only then use the parsedPublicationYear. + * + * @Deprecated Use getParsedPublicationYear() instead. * */ + @Deprecated public String getPublicationYear() { if (publicationYear != null && isValidPublicationYear(publicationYear)) { return publicationYear; @@ -152,14 +151,6 @@ public class BiboDocument extends Individual { this.publicationYear = publicationYear; } - public String getPublicationYearMonth() { - return publicationYearMonth; - } - - public void setPublicationYearMonth(String publicationYearMonth) { - this.publicationYearMonth = publicationYearMonth; - } - public String getPublicationDate() { return publicationDate; } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/visutils/UtilityFunctions.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/visutils/UtilityFunctions.java index 55851059..aa08d94b 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/visutils/UtilityFunctions.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/visutils/UtilityFunctions.java @@ -53,14 +53,11 @@ public class UtilityFunctions { * 1. We will be using getPub... multiple times & this will save us duplication of code * 2. If we change the logic of validity of a pub year we would not have to make * changes all throughout the codebase. - * 3. We are asking for a publication year & we should get a proper one or NOT at all. + * 3. We are asking for a publicationDate which is captured using the vivo 1.2 ontology + * & if not saved then we are being nice & checking if date is saved using core:year if so + * we use that else we return UNKOWN_YEAR. * */ - String publicationYear; - if (curr.getPublicationYear() != null) { - publicationYear = curr.getPublicationYear(); - } else { - publicationYear = curr.getParsedPublicationYear(); - } + String publicationYear = curr.getParsedPublicationYear(); if (yearToPublicationCount.containsKey(publicationYear)) { yearToPublicationCount.put(publicationYear,