From 970c686dc0216443ae6d94499f1266946a8faa8f Mon Sep 17 00:00:00 2001 From: bkoniden Date: Thu, 3 Feb 2011 18:42:32 +0000 Subject: [PATCH] NIHVIVO-1986 -- The blank screen problem is resolved for present. But the more general problems NIHVIVO-1659 and NIHVIVO-1686 have to be addressed for a complete solution. --- .../EntityPublicationCountQueryRunner.java | 14 ++++++++++---- .../EntityPublicationCountRequestHandler.java | 7 ++++++- .../EntitySubOrganizationTypesQueryRunner.java | 11 ++++++++--- .../freemarker/valueobjects/SubEntity.java | 7 ++++++- 4 files changed, 30 insertions(+), 9 deletions(-) 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 5d0ce513..502fb4ae 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 @@ -7,6 +7,7 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.iri.IRI; import com.hp.hpl.jena.iri.IRIFactory; @@ -44,7 +45,7 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { private String entityURI; private DataSource dataSource; - private Log log; + private Log log = LogFactory.getLog(EntityPublicationCountQueryRunner.class.getName()); private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = "" + " (str(?Person) as ?personLit) " @@ -75,7 +76,7 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { this.entityURI = entityURI; this.dataSource = dataSource; - this.log = log; +// this.log = log; } @@ -145,7 +146,7 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { if (subEntityLabelNode != null) { subEntity.setIndividualLabel(subEntityLabelNode.toString()); } - entity.addSubEntity(subEntity); + // entity.addSubEntity(subEntity); subEntity.addPublications(biboDocument); } @@ -173,7 +174,11 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { entity.addPublications(biboDocument); } - if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){ + if(subentityURLToVO.size() != 0){ + for(SubEntity subEntity : subentityURLToVO.values()){ + entity.addSubEntity(subEntity); + } + } else if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){ for(SubEntity person : personURLToVO.values()){ entity.addSubEntity(person); } @@ -182,6 +187,7 @@ public class EntityPublicationCountQueryRunner implements QueryRunner { } //TODO: return non-null value + log.info("Returning entity that contains the following set of subentities: "+entity.getSubEntities().toString()); return entity; } 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 17345753..d6087749 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 @@ -12,6 +12,7 @@ import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import com.google.gson.Gson; import com.hp.hpl.jena.iri.IRI; @@ -44,6 +45,8 @@ import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.Visual public class EntityPublicationCountRequestHandler implements VisualizationRequestHandler { + private Log log = LogFactory.getLog(EntityPublicationCountRequestHandler.class.getName()); + @Override public ResponseValues generateStandardVisualization( VitroRequest vitroRequest, Log log, DataSource dataSource) @@ -316,10 +319,12 @@ public class EntityPublicationCountRequestHandler implements currentPubYear.add(pubEntry.getValue()); yearPubCount.add(currentPubYear); } + + log.info("entityJson.getLabel() : " + entityJson.getLabel() + " subOrganizationTypesResult " + subOrganizationTypesResult.toString()); entityJson.setYearToActivityCount(yearPubCount); entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel())); - + entityJson.setEntityURI(subentity.getIndividualURI()); boolean isPerson = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(subentity.getIndividualURI()).isVClass("http://xmlns.com/foaf/0.1/Person"); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java index eb0656ac..d7a7f3db 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java @@ -6,6 +6,7 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.iri.IRI; import com.hp.hpl.jena.iri.IRIFactory; @@ -39,7 +40,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner core:hasSubOrganization ?subOrganization . " - + "?subOrganization rdfs:label ?subOrganizationLabel ; rdf:type ?subOrganizationType . " + + "?subOrganization rdfs:label ?subOrganizationLabel ; rdf:type ?subOrganizationType ; core:organizationForPosition ?Position . " + "?subOrganizationType rdfs:label ?subOrganizationTypeLabel . " + + "?Position rdf:type core:Position ; core:positionForPerson ?Person ." + "}" + "UNION " + "{ " @@ -149,6 +151,9 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner " + subOrganizationLabelToTypes.size()); // System.out.println("\n\nPeople Label Types Size --> " + personLabelToTypes.size()); + log.info("Sub Organization Label Types Size : " + subOrganizationLabelToTypes.size()); + log.info("People Label Types Size : " + personLabelToTypes.size()); + return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ; } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/SubEntity.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/SubEntity.java index 29557e22..4a86259e 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/SubEntity.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/SubEntity.java @@ -57,7 +57,12 @@ public class SubEntity extends Individual { public int hashCode(){ return(41*(getIndividualLabel().hashCode() + 41*(getIndividualURI().hashCode()))); } - + + @Override + public String toString(){ + return this.getIndividualLabel(); + } + public void addPublications(BiboDocument biboDocument) { this.publications.add(biboDocument); }