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.

This commit is contained in:
bkoniden 2011-02-03 18:42:32 +00:00
parent 7d2c2e787d
commit 970c686dc0
4 changed files with 30 additions and 9 deletions

View file

@ -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<Entity> {
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<Entity> {
this.entityURI = entityURI;
this.dataSource = dataSource;
this.log = log;
// this.log = log;
}
@ -145,7 +146,7 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
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> {
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<Entity> {
}
//TODO: return non-null value
log.info("Returning entity that contains the following set of subentities: "+entity.getSubEntities().toString());
return entity;
}

View file

@ -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");

View file

@ -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<Map<St
private String entityURI;
private DataSource dataSource;
private Log log;
private Log log = LogFactory.getLog(EntitySubOrganizationTypesQueryRunner.class.getName());
private static final String SPARQL_QUERY_SELECT_CLAUSE = ""
+ " (str(?organizationLabel) as ?"+QueryFieldLabels.ORGANIZATION_LABEL+") "
@ -56,7 +57,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
this.entityURI = entityURI;
this.dataSource = dataSource;
this.log = log;
// this.log = log;
}
private ResultSet executeQuery(String queryURI, DataSource dataSource) {
@ -82,8 +83,9 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
+ " rdfs:label ?organizationLabel . "
+ "{ "
+ "<"+ queryURI + "> 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<Map<St
// System.out.println("\n\nSub Organization Label Types Size --> " + 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 ;
}

View file

@ -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);
}