1. Fix for people directly not attached to an organizations not showing up, if the organization happens to be higher up in the hierarchy where it has other sub-organizations beneath it.

2. Made changes to the front-end to reflect new content in temporal vis.
This commit is contained in:
cdtank 2011-02-04 22:36:23 +00:00
parent 85789d5e02
commit a9214be4a2
6 changed files with 107 additions and 52 deletions

View file

@ -146,15 +146,18 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
if (subEntityLabelNode != null) {
subEntity.setIndividualLabel(subEntityLabelNode.toString());
}
// entity.addSubEntity(subEntity);
entity.addSubEntity(subEntity);
subEntity.addPublications(biboDocument);
}
RDFNode personURLNode = solution.get(QueryFieldLabels.PERSON_URL);
if(personURLNode != null){
SubEntity person ;
if(personURLToVO.containsKey(personURLNode.toString())) {
if (personURLNode != null) {
SubEntity person;
if (personURLToVO.containsKey(personURLNode.toString())) {
person = personURLToVO.get(personURLNode.toString());
} else {
person = new SubEntity(personURLNode.toString());
@ -166,7 +169,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
person.setIndividualLabel(personLabelNode.toString());
}
// entity.addSubEntity(person);
/*
* This makes sure that either,
* 1. the parent organization is a department-like organization with no organizations
* beneath it, or
* 2. the parent organizations has both sub-organizations and people directly
* attached to that organizations e.g. president of a university.
* */
if (subEntityURLNode == null) {
entity.addSubEntity(person);
}
person.addPublications(biboDocument);
}
@ -174,16 +189,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
entity.addPublications(biboDocument);
}
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);
}
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0){
/*
if (subentityURLToVO.size() != 0) {
entity.addSubEntitities(subentityURLToVO.values());
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() != 0) {
entity.addSubEntitities(personURLToVO.values());
} else*/ if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0) {
entity = new Entity(this.entityURI, "no-label");
}
//TODO: return non-null value

View file

@ -97,7 +97,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
+ "}";
// System.out.println("\n\nEntity SubOrganizationTypes query is: "+ sparqlQuery);
System.out.println("\n\nEntity SubOrganizationTypes query is:\n "+ sparqlQuery);
log.debug("\nThe sparql query is :\n" + sparqlQuery);
return sparqlQuery;
@ -106,8 +106,9 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
private Map<String, Set<String>> createJavaValueObjects(ResultSet resultSet) {
Map<String, Set<String>> subOrganizationLabelToTypes = new HashMap<String, Set<String>>();
Map<String, Set<String>> personLabelToTypes = new HashMap<String, Set<String>>();
/*Map<String, Set<String>> subOrganizationLabelToTypes = new HashMap<String, Set<String>>();
Map<String, Set<String>> personLabelToTypes = new HashMap<String, Set<String>>();*/
Map<String, Set<String>> subEntityLabelToTypes = new HashMap<String, Set<String>>();
while(resultSet.hasNext()){
@ -115,34 +116,50 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
RDFNode subOrganizationLabel = solution.get(QueryFieldLabels.SUBORGANIZATION_LABEL);
if(subOrganizationLabel != null){
if(subOrganizationLabelToTypes.containsKey(subOrganizationLabel.toString())){
RDFNode subOrganizationType = solution.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
if(subOrganizationType != null){
subOrganizationLabelToTypes.get(subOrganizationLabel.toString()).add(subOrganizationType.toString());
if (subOrganizationLabel != null) {
if (subEntityLabelToTypes.containsKey(subOrganizationLabel.toString())) {
RDFNode subOrganizationType = solution
.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
if (subOrganizationType != null) {
subEntityLabelToTypes.get(
subOrganizationLabel.toString()).add(
subOrganizationType.toString());
}
}else{
RDFNode subOrganizationType = solution.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
if(subOrganizationType != null){
subOrganizationLabelToTypes.put(subOrganizationLabel.toString(), new HashSet<String>());
subOrganizationLabelToTypes.get(subOrganizationLabel.toString()).add(subOrganizationType.toString());
} else {
RDFNode subOrganizationType = solution
.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
if (subOrganizationType != null) {
subEntityLabelToTypes.put(
subOrganizationLabel.toString(),
new HashSet<String>());
subEntityLabelToTypes.get(
subOrganizationLabel.toString()).add(
subOrganizationType.toString());
}
}
}
RDFNode personLabel = solution.get(QueryFieldLabels.PERSON_LABEL);
if(personLabel != null){
if(personLabelToTypes.containsKey(personLabel.toString())){
RDFNode personType = solution.get(QueryFieldLabels.PERSON_TYPE_LABEL);
if(personType != null && ! personType.toString().startsWith("http")){
personLabelToTypes.get(personLabel.toString()).add(personType.toString());
if (personLabel != null) {
if (subEntityLabelToTypes.containsKey(personLabel.toString())) {
RDFNode personType = solution
.get(QueryFieldLabels.PERSON_TYPE_LABEL);
if (personType != null
&& !personType.toString().startsWith("http")) {
subEntityLabelToTypes.get(personLabel.toString()).add(
personType.toString());
}
}else{
RDFNode personType = solution.get(QueryFieldLabels.PERSON_TYPE_LABEL);
if(personType != null && ! personType.toString().startsWith("http")){
personLabelToTypes.put(personLabel.toString(), new HashSet<String>());
personLabelToTypes.get(personLabel.toString()).add(personType.toString());
} else {
RDFNode personType = solution
.get(QueryFieldLabels.PERSON_TYPE_LABEL);
if (personType != null
&& !personType.toString().startsWith("http")) {
subEntityLabelToTypes.put(personLabel.toString(),
new HashSet<String>());
subEntityLabelToTypes.get(personLabel.toString()).add(
personType.toString());
}
}
}
@ -151,10 +168,10 @@ 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());
log.info("Sub Organization Label Types Size : " + subEntityLabelToTypes.size());
return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
return subEntityLabelToTypes;
//return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
}
public Map<String, Set<String>> getQueryResult() throws MalformedQueryParametersException {

View file

@ -1,6 +1,7 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.LinkedHashSet;
@ -48,6 +49,11 @@ public class Entity extends Individual{
this.children.add(subEntity);
}
public void addSubEntitities(Collection<SubEntity> subEntities) {
this.children.addAll(subEntities);
}
public void addGrants(Grant grant) {
this.grants.add(grant);