diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/VOConstants.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/VOConstants.java
index 2b32ea5d..792f54ac 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/VOConstants.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/VOConstants.java
@@ -15,6 +15,7 @@ import org.joda.time.format.ISODateTimeFormat;
*/
public class VOConstants {
+ public static final String DEFAULT_ACTIVITY_YEAR = "Unknown";
public static final String DEFAULT_PUBLICATION_YEAR = "Unknown";
public static final String DEFAULT_GRANT_YEAR = "Unknown";
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipGraphMLWriter.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipGraphMLWriter.java
index 87ca94f2..32bcb6e6 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipGraphMLWriter.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipGraphMLWriter.java
@@ -11,9 +11,11 @@ import java.util.Set;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.VisualizationFrameworkConstants;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.CoAuthorshipData;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Edge;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Node;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaborationComparator;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaborationData;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaboratorComparator;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaborator;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaboration;
public class CoAuthorshipGraphMLWriter {
@@ -27,12 +29,12 @@ public class CoAuthorshipGraphMLWriter {
private final String GRAPHML_FOOTER = "";
- public CoAuthorshipGraphMLWriter(CoAuthorshipData visVOContainer) {
+ public CoAuthorshipGraphMLWriter(CollaborationData visVOContainer) {
coAuthorshipGraphMLContent = createCoAuthorshipGraphMLContent(visVOContainer);
}
private StringBuilder createCoAuthorshipGraphMLContent(
- CoAuthorshipData coAuthorshipData) {
+ CollaborationData coAuthorshipData) {
StringBuilder graphMLContent = new StringBuilder();
@@ -60,61 +62,61 @@ public class CoAuthorshipGraphMLWriter {
return coAuthorshipGraphMLContent;
}
- private void generateGraphContent(CoAuthorshipData coAuthorshipData,
+ private void generateGraphContent(CollaborationData coAuthorshipData,
StringBuilder graphMLContent) {
graphMLContent.append("\n\n");
- if (coAuthorshipData.getNodes() != null & coAuthorshipData.getNodes().size() > 0) {
+ if (coAuthorshipData.getCollaborators() != null & coAuthorshipData.getCollaborators().size() > 0) {
generateNodeSectionContent(coAuthorshipData, graphMLContent);
}
- if (coAuthorshipData.getEdges() != null & coAuthorshipData.getEdges().size() > 0) {
+ if (coAuthorshipData.getCollaborations() != null & coAuthorshipData.getCollaborations().size() > 0) {
generateEdgeSectionContent(coAuthorshipData, graphMLContent);
}
graphMLContent.append("\n");
}
- private void generateEdgeSectionContent(CoAuthorshipData coAuthorshipData,
+ private void generateEdgeSectionContent(CollaborationData coAuthorshipData,
StringBuilder graphMLContent) {
graphMLContent.append("\n");
- Set edges = coAuthorshipData.getEdges();
+ Set edges = coAuthorshipData.getCollaborations();
- List orderedEdges = new ArrayList(edges);
+ List orderedEdges = new ArrayList(edges);
- Collections.sort(orderedEdges, new EdgeComparator());
+ Collections.sort(orderedEdges, new CollaborationComparator());
- for (Edge currentEdge : orderedEdges) {
+ for (Collaboration currentEdge : orderedEdges) {
/*
- * This method actually creates the XML code for a single edge. "graphMLContent"
+ * This method actually creates the XML code for a single Collaboration. "graphMLContent"
* is being side-effected.
* */
getEdgeContent(graphMLContent, currentEdge);
}
}
- private void getEdgeContent(StringBuilder graphMLContent, Edge currentEdge) {
+ private void getEdgeContent(StringBuilder graphMLContent, Collaboration currentEdge) {
graphMLContent.append("\n");
graphMLContent.append("\t"
- + currentEdge.getSourceNode().getNodeName()
+ + currentEdge.getSourceCollaborator().getCollaboratorName()
+ "\n");
graphMLContent.append("\t"
- + currentEdge.getTargetNode().getNodeName()
+ + currentEdge.getTargetCollaborator().getCollaboratorName()
+ "\n");
graphMLContent.append("\t"
- + currentEdge.getNumOfCoAuthoredWorks()
+ + currentEdge.getNumOfCollaborations()
+ "\n");
if (currentEdge.getEarliestCollaborationYearCount() != null) {
@@ -164,32 +166,32 @@ public class CoAuthorshipGraphMLWriter {
graphMLContent.append("\n");
}
- private void generateNodeSectionContent(CoAuthorshipData coAuthorshipData,
+ private void generateNodeSectionContent(CollaborationData coAuthorshipData,
StringBuilder graphMLContent) {
graphMLContent.append("\n");
- Node egoNode = coAuthorshipData.getEgoNode();
- Set authorNodes = coAuthorshipData.getNodes();
+ Collaborator egoNode = coAuthorshipData.getEgoCollaborator();
+ Set authorNodes = coAuthorshipData.getCollaborators();
/*
- * This method actually creates the XML code for a single node. "graphMLContent"
+ * This method actually creates the XML code for a single Collaborator. "graphMLContent"
* is being side-effected. The egoNode is added first because this is the "requirement"
* of the co-author vis. Ego should always come first.
*
* */
getNodeContent(graphMLContent, egoNode);
- List orderedAuthorNodes = new ArrayList(authorNodes);
+ List orderedAuthorNodes = new ArrayList(authorNodes);
orderedAuthorNodes.remove(egoNode);
- Collections.sort(orderedAuthorNodes, new NodeComparator());
+ Collections.sort(orderedAuthorNodes, new CollaboratorComparator());
- for (Node currNode : orderedAuthorNodes) {
+ for (Collaborator currNode : orderedAuthorNodes) {
/*
- * We have already printed the Ego Node info.
+ * We have already printed the Ego Collaborator info.
* */
if (currNode != egoNode) {
@@ -201,17 +203,17 @@ public class CoAuthorshipGraphMLWriter {
}
- private void getNodeContent(StringBuilder graphMLContent, Node node) {
+ private void getNodeContent(StringBuilder graphMLContent, Collaborator node) {
ParamMap individualProfileURLParams = new ParamMap(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY,
- node.getNodeURI());
+ node.getCollaboratorURI());
String profileURL = UrlBuilder.getUrl(VisualizationFrameworkConstants.INDIVIDUAL_URL_PREFIX,
individualProfileURLParams);
- graphMLContent.append("\n");
- graphMLContent.append("\t" + node.getNodeURI() + "\n");
- graphMLContent.append("\t" + node.getNodeName() + "\n");
+ graphMLContent.append("\n");
+ graphMLContent.append("\t" + node.getCollaboratorURI() + "\n");
+ graphMLContent.append("\t" + node.getCollaboratorName() + "\n");
if (profileURL != null) {
graphMLContent.append("\t" + profileURL + "\n");
@@ -219,10 +221,10 @@ public class CoAuthorshipGraphMLWriter {
graphMLContent.append("\t"
- + node.getNumOfAuthoredWorks()
+ + node.getNumOfActivities()
+ "\n");
- if (node.getEarliestPublicationYearCount() != null) {
+ if (node.getEarliestActivityYearCount() != null) {
/*
* There is no clean way of getting the map contents in java even though
@@ -230,7 +232,7 @@ public class CoAuthorshipGraphMLWriter {
* I am feeling dirty just about now.
* */
for (Map.Entry publicationInfo
- : node.getEarliestPublicationYearCount().entrySet()) {
+ : node.getEarliestActivityYearCount().entrySet()) {
graphMLContent.append("\t"
+ publicationInfo.getKey()
@@ -243,10 +245,10 @@ public class CoAuthorshipGraphMLWriter {
}
- if (node.getLatestPublicationYearCount() != null) {
+ if (node.getLatestActivityYearCount() != null) {
for (Map.Entry publicationInfo
- : node.getLatestPublicationYearCount().entrySet()) {
+ : node.getLatestActivityYearCount().entrySet()) {
graphMLContent.append("\t"
+ publicationInfo.getKey()
@@ -259,10 +261,10 @@ public class CoAuthorshipGraphMLWriter {
}
- if (node.getUnknownPublicationYearCount() != null) {
+ if (node.getUnknownActivityYearCount() != null) {
graphMLContent.append("\t"
- + node.getUnknownPublicationYearCount()
+ + node.getUnknownActivityYearCount()
+ "\n");
}
@@ -270,7 +272,7 @@ public class CoAuthorshipGraphMLWriter {
graphMLContent.append("\n");
}
- private void generateKeyDefinitionContent(CoAuthorshipData visVOContainer,
+ private void generateKeyDefinitionContent(CollaborationData visVOContainer,
StringBuilder graphMLContent) {
/*
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 c7b70b94..637e414b 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
@@ -29,10 +29,12 @@ import com.hp.hpl.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.BiboDocument;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.CoAuthorshipData;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Edge;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Node;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CoAuthorshipData;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaborationData;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaboratorComparator;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Activity;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaborator;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaboration;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.QueryRunner;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.UniqueIDGenerator;
@@ -43,7 +45,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.Unique
*
* @author cdtank
*/
-public class CoAuthorshipQueryRunner implements QueryRunner {
+public class CoAuthorshipQueryRunner implements QueryRunner {
private static final int MAX_AUTHORS_PER_PAPER_ALLOWED = 100;
@@ -71,18 +73,18 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
}
- private CoAuthorshipData createQueryResult(ResultSet resultSet) {
+ private CollaborationData createQueryResult(ResultSet resultSet) {
- Set nodes = new HashSet();
+ Set nodes = new HashSet();
- Map biboDocumentURLToVO = new HashMap();
- Map> biboDocumentURLToCoAuthors = new HashMap>();
- Map nodeURLToVO = new HashMap();
- Map edgeUniqueIdentifierToVO = new HashMap();
+ Map biboDocumentURLToVO = new HashMap();
+ Map> biboDocumentURLToCoAuthors = new HashMap>();
+ Map nodeURLToVO = new HashMap();
+ Map edgeUniqueIdentifierToVO = new HashMap();
- Node egoNode = null;
+ Collaborator egoNode = null;
- Set edges = new HashSet();
+ Set edges = new HashSet();
while (resultSet.hasNext()) {
QuerySolution solution = resultSet.nextSolution();
@@ -97,18 +99,18 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
} else {
- egoNode = new Node(egoAuthorURLNode.toString(), nodeIDGenerator);
+ egoNode = new Collaborator(egoAuthorURLNode.toString(), nodeIDGenerator);
nodes.add(egoNode);
nodeURLToVO.put(egoAuthorURLNode.toString(), egoNode);
RDFNode authorLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL);
if (authorLabelNode != null) {
- egoNode.setNodeName(authorLabelNode.toString());
+ egoNode.setCollaboratorName(authorLabelNode.toString());
}
}
RDFNode documentNode = solution.get(QueryFieldLabels.DOCUMENT_URL);
- BiboDocument biboDocument;
+ Activity biboDocument;
if (biboDocumentURLToVO.containsKey(documentNode.toString())) {
biboDocument = biboDocumentURLToVO.get(documentNode.toString());
@@ -117,11 +119,11 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
biboDocumentURLToVO.put(documentNode.toString(), biboDocument);
}
- egoNode.addAuthorDocument(biboDocument);
+ egoNode.addActivity(biboDocument);
/*
* After some discussion we concluded that for the purpose of this visualization
- * we do not want a co-author node or edge if the publication has only one
+ * we do not want a co-author node or Collaboration if the publication has only one
* author and that happens to be the ego.
* */
if (solution.get(QueryFieldLabels.AUTHOR_URL).toString().equalsIgnoreCase(
@@ -129,7 +131,7 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
continue;
}
- Node coAuthorNode;
+ Collaborator coAuthorNode;
RDFNode coAuthorURLNode = solution.get(QueryFieldLabels.CO_AUTHOR_URL);
if (nodeURLToVO.containsKey(coAuthorURLNode.toString())) {
@@ -138,46 +140,46 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
} else {
- coAuthorNode = new Node(coAuthorURLNode.toString(), nodeIDGenerator);
+ coAuthorNode = new Collaborator(coAuthorURLNode.toString(), nodeIDGenerator);
nodes.add(coAuthorNode);
nodeURLToVO.put(coAuthorURLNode.toString(), coAuthorNode);
RDFNode coAuthorLabelNode = solution.get(QueryFieldLabels.CO_AUTHOR_LABEL);
if (coAuthorLabelNode != null) {
- coAuthorNode.setNodeName(coAuthorLabelNode.toString());
+ coAuthorNode.setCollaboratorName(coAuthorLabelNode.toString());
}
}
- coAuthorNode.addAuthorDocument(biboDocument);
+ coAuthorNode.addActivity(biboDocument);
- Set coAuthorsForCurrentBiboDocument;
+ Set coAuthorsForCurrentBiboDocument;
- if (biboDocumentURLToCoAuthors.containsKey(biboDocument.getDocumentURL())) {
+ if (biboDocumentURLToCoAuthors.containsKey(biboDocument.getActivityURI())) {
coAuthorsForCurrentBiboDocument = biboDocumentURLToCoAuthors
- .get(biboDocument.getDocumentURL());
+ .get(biboDocument.getActivityURI());
} else {
- coAuthorsForCurrentBiboDocument = new HashSet();
- biboDocumentURLToCoAuthors.put(biboDocument.getDocumentURL(),
+ coAuthorsForCurrentBiboDocument = new HashSet();
+ biboDocumentURLToCoAuthors.put(biboDocument.getActivityURI(),
coAuthorsForCurrentBiboDocument);
}
coAuthorsForCurrentBiboDocument.add(coAuthorNode);
- Edge egoCoAuthorEdge = getExistingEdge(egoNode, coAuthorNode, edgeUniqueIdentifierToVO);
+ Collaboration egoCoAuthorEdge = getExistingEdge(egoNode, coAuthorNode, edgeUniqueIdentifierToVO);
/*
- * If "egoCoAuthorEdge" is null it means that no edge exists in between the egoNode
- * & current coAuthorNode. Else create a new edge, add it to the edges set & add
+ * If "egoCoAuthorEdge" is null it means that no Collaboration exists in between the egoNode
+ * & current coAuthorNode. Else create a new Collaboration, add it to the edges set & add
* the collaborator document to it.
* */
if (egoCoAuthorEdge != null) {
- egoCoAuthorEdge.addCollaboratorDocument(biboDocument);
+ egoCoAuthorEdge.addActivity(biboDocument);
} else {
- egoCoAuthorEdge = new Edge(egoNode, coAuthorNode, biboDocument, edgeIDGenerator);
+ egoCoAuthorEdge = new Collaboration(egoNode, coAuthorNode, biboDocument, edgeIDGenerator);
edges.add(egoCoAuthorEdge);
edgeUniqueIdentifierToVO.put(
- getEdgeUniqueIdentifier(egoNode.getNodeID(),
- coAuthorNode.getNodeID()),
+ getEdgeUniqueIdentifier(egoNode.getCollaboratorID(),
+ coAuthorNode.getCollaboratorID()),
egoCoAuthorEdge);
}
@@ -210,7 +212,7 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
* edges en masse for all the co-authors on all the publications considered so far. The
* other reason being we dont want to compare against 2 sets of edges (edges created before
* & co-author edges created during the course of this method) when we are creating a new
- * edge.
+ * Collaboration.
* */
createCoAuthorEdges(biboDocumentURLToVO,
biboDocumentURLToCoAuthors,
@@ -221,25 +223,25 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
return new CoAuthorshipData(egoNode, nodes, edges);
}
- private void removeLowQualityNodesAndEdges(Set nodes,
- Map biboDocumentURLToVO,
- Map> biboDocumentURLToCoAuthors,
- Set edges) {
+ private void removeLowQualityNodesAndEdges(Set nodes,
+ Map biboDocumentURLToVO,
+ Map> biboDocumentURLToCoAuthors,
+ Set edges) {
- Set nodesToBeRemoved = new HashSet();
- for (Map.Entry> currentBiboDocumentEntry
+ Set nodesToBeRemoved = new HashSet();
+ for (Map.Entry> currentBiboDocumentEntry
: biboDocumentURLToCoAuthors.entrySet()) {
if (currentBiboDocumentEntry.getValue().size() > MAX_AUTHORS_PER_PAPER_ALLOWED) {
- BiboDocument currentBiboDocument = biboDocumentURLToVO
+ Activity currentBiboDocument = biboDocumentURLToVO
.get(currentBiboDocumentEntry.getKey());
- Set edgesToBeRemoved = new HashSet();
+ Set edgesToBeRemoved = new HashSet();
- for (Edge currentEdge : edges) {
- Set currentCollaboratorDocuments =
- currentEdge.getCollaboratorDocuments();
+ for (Collaboration currentEdge : edges) {
+ Set currentCollaboratorDocuments =
+ currentEdge.getCollaborationActivities();
if (currentCollaboratorDocuments.contains(currentBiboDocument)) {
currentCollaboratorDocuments.remove(currentBiboDocument);
@@ -251,9 +253,9 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
edges.removeAll(edgesToBeRemoved);
- for (Node currentCoAuthor : currentBiboDocumentEntry.getValue()) {
- currentCoAuthor.getAuthorDocuments().remove(currentBiboDocument);
- if (currentCoAuthor.getAuthorDocuments().isEmpty()) {
+ for (Collaborator currentCoAuthor : currentBiboDocumentEntry.getValue()) {
+ currentCoAuthor.getCollaboratorActivities().remove(currentBiboDocument);
+ if (currentCoAuthor.getCollaboratorActivities().isEmpty()) {
nodesToBeRemoved.add(currentCoAuthor);
}
}
@@ -263,11 +265,11 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
}
private void createCoAuthorEdges(
- Map biboDocumentURLToVO,
- Map> biboDocumentURLToCoAuthors, Set edges,
- Map edgeUniqueIdentifierToVO) {
+ Map biboDocumentURLToVO,
+ Map> biboDocumentURLToCoAuthors, Set edges,
+ Map edgeUniqueIdentifierToVO) {
- for (Map.Entry> currentBiboDocumentEntry
+ for (Map.Entry> currentBiboDocumentEntry
: biboDocumentURLToCoAuthors.entrySet()) {
/*
@@ -283,42 +285,42 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
<= MAX_AUTHORS_PER_PAPER_ALLOWED) {
- Set newlyAddedEdges = new HashSet();
+ Set newlyAddedEdges = new HashSet();
/*
* In order to leverage the nested "for loop" for making edges between all the
* co-authors we need to create a list out of the set first.
* */
- List coAuthorNodes = new ArrayList(currentBiboDocumentEntry.getValue());
- Collections.sort(coAuthorNodes, new NodeComparator());
+ List coAuthorNodes = new ArrayList(currentBiboDocumentEntry.getValue());
+ Collections.sort(coAuthorNodes, new CollaboratorComparator());
int numOfCoAuthors = coAuthorNodes.size();
for (int ii = 0; ii < numOfCoAuthors - 1; ii++) {
for (int jj = ii + 1; jj < numOfCoAuthors; jj++) {
- Node coAuthor1 = coAuthorNodes.get(ii);
- Node coAuthor2 = coAuthorNodes.get(jj);
+ Collaborator coAuthor1 = coAuthorNodes.get(ii);
+ Collaborator coAuthor2 = coAuthorNodes.get(jj);
- Edge coAuthor1_2Edge = getExistingEdge(coAuthor1,
+ Collaboration coAuthor1_2Edge = getExistingEdge(coAuthor1,
coAuthor2,
edgeUniqueIdentifierToVO);
- BiboDocument currentBiboDocument = biboDocumentURLToVO
+ Activity currentBiboDocument = biboDocumentURLToVO
.get(currentBiboDocumentEntry
.getKey());
if (coAuthor1_2Edge != null) {
- coAuthor1_2Edge.addCollaboratorDocument(currentBiboDocument);
+ coAuthor1_2Edge.addActivity(currentBiboDocument);
} else {
- coAuthor1_2Edge = new Edge(coAuthor1,
+ coAuthor1_2Edge = new Collaboration(coAuthor1,
coAuthor2,
currentBiboDocument,
edgeIDGenerator);
newlyAddedEdges.add(coAuthor1_2Edge);
edgeUniqueIdentifierToVO.put(
- getEdgeUniqueIdentifier(coAuthor1.getNodeID(),
- coAuthor2.getNodeID()),
+ getEdgeUniqueIdentifier(coAuthor1.getCollaboratorID(),
+ coAuthor2.getCollaboratorID()),
coAuthor1_2Edge);
}
}
@@ -329,13 +331,13 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
}
}
- private Edge getExistingEdge(
- Node collaboratingNode1,
- Node collaboratingNode2,
- Map edgeUniqueIdentifierToVO) {
+ private Collaboration getExistingEdge(
+ Collaborator collaboratingNode1,
+ Collaborator collaboratingNode2,
+ Map edgeUniqueIdentifierToVO) {
- String edgeUniqueIdentifier = getEdgeUniqueIdentifier(collaboratingNode1.getNodeID(),
- collaboratingNode2.getNodeID());
+ String edgeUniqueIdentifier = getEdgeUniqueIdentifier(collaboratingNode1.getCollaboratorID(),
+ collaboratingNode2.getCollaboratorID());
return edgeUniqueIdentifierToVO.get(edgeUniqueIdentifier);
@@ -353,27 +355,15 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
}
-// public Map getCollegeURLToVO() {
-// return collegeURLToVO;
-// }
+ private Activity createDocumentVO(QuerySolution solution, String documentURL) {
- private BiboDocument createDocumentVO(QuerySolution solution, String documentURL) {
-
- BiboDocument biboDocument = new BiboDocument(documentURL);
+ Activity biboDocument = new Activity(documentURL);
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
if (publicationDateNode != null) {
- biboDocument.setPublicationDate(publicationDateNode.toString());
+ biboDocument.setActivityDate(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;
}
@@ -420,7 +410,7 @@ public class CoAuthorshipQueryRunner implements QueryRunner {
}
- public CoAuthorshipData getQueryResult()
+ public CollaborationData getQueryResult()
throws MalformedQueryParametersException {
if (StringUtils.isNotBlank(this.egoURI)) {
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipRequestHandler.java
index 7cb30a4e..76e25023 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipRequestHandler.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipRequestHandler.java
@@ -21,8 +21,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.DataVisualizationController;
import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.VisualizationFrameworkConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.CoAuthorshipData;
-import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Node;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.collaborationutils.CollaborationData;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaborator;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.QueryRunner;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.UtilityFunctions;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.VisualizationRequestHandler;
@@ -58,10 +58,10 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
VisualizationFrameworkConstants
.VIS_MODE_KEY);
- QueryRunner queryManager =
+ QueryRunner queryManager =
new CoAuthorshipQueryRunner(egoURI, Dataset, log);
- CoAuthorshipData authorNodesAndEdges =
+ CollaborationData authorNodesAndEdges =
queryManager.getQueryResult();
/*
@@ -133,42 +133,40 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
- private String getCoauthorsListCSVContent(CoAuthorshipData coAuthorshipData) {
+ private String getCoauthorsListCSVContent(CollaborationData coAuthorshipData) {
StringBuilder csvFileContent = new StringBuilder();
csvFileContent.append("Co-author, Count\n");
//for (Entry currentEntry : coAuthorsToCount.entrySet()) {
- for (Node currNode : coAuthorshipData.getNodes()) {
+ for (Collaborator currNode : coAuthorshipData.getCollaborators()) {
/*
* We have already printed the Ego Node info.
* */
- if (currNode != coAuthorshipData.getEgoNode()) {
+ if (currNode != coAuthorshipData.getEgoCollaborator()) {
- csvFileContent.append(StringEscapeUtils.escapeCsv(currNode.getNodeName()));
+ csvFileContent.append(StringEscapeUtils.escapeCsv(currNode.getCollaboratorName()));
csvFileContent.append(",");
- csvFileContent.append(currNode.getNumOfAuthoredWorks());
+ csvFileContent.append(currNode.getNumOfActivities());
csvFileContent.append("\n");
}
-
-
}
return csvFileContent.toString();
}
- private String getCoauthorsPerYearCSVContent(Map> yearToCoauthors) {
+ private String getCoauthorsPerYearCSVContent(Map> yearToCoauthors) {
StringBuilder csvFileContent = new StringBuilder();
csvFileContent.append("Year, Count, Co-author(s)\n");
- for (Entry> currentEntry : yearToCoauthors.entrySet()) {
+ for (Entry> currentEntry : yearToCoauthors.entrySet()) {
csvFileContent.append(StringEscapeUtils.escapeCsv(currentEntry.getKey()));
csvFileContent.append(",");
csvFileContent.append(currentEntry.getValue().size());
@@ -181,13 +179,13 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
}
- private String getCoauthorNamesAsString(Set coAuthors) {
+ private String getCoauthorNamesAsString(Set coAuthors) {
StringBuilder coAuthorsMerged = new StringBuilder();
String coAuthorSeparator = "; ";
- for (Node currCoAuthor : coAuthors) {
- coAuthorsMerged.append(currCoAuthor.getNodeName() + coAuthorSeparator);
+ for (Collaborator currCoAuthor : coAuthors) {
+ coAuthorsMerged.append(currCoAuthor.getCollaboratorName() + coAuthorSeparator);
}
return StringUtils.removeEnd(coAuthorsMerged.toString(), coAuthorSeparator);
@@ -199,18 +197,18 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
* @param authorNodesAndEdges
* @param response
*/
- private Map prepareCoauthorsCountPerYearDataResponse(CoAuthorshipData authorNodesAndEdges) {
+ private Map prepareCoauthorsCountPerYearDataResponse(CollaborationData authorNodesAndEdges) {
String outputFileName;
- Map> yearToCoauthors = new TreeMap>();
+ Map> yearToCoauthors = new TreeMap>();
- if (authorNodesAndEdges.getNodes() != null && authorNodesAndEdges.getNodes().size() > 0) {
+ if (authorNodesAndEdges.getCollaborators() != null && authorNodesAndEdges.getCollaborators().size() > 0) {
outputFileName = UtilityFunctions.slugify(authorNodesAndEdges
- .getEgoNode().getNodeName())
+ .getEgoCollaborator().getCollaboratorName())
+ "_co-authors-per-year" + ".csv";
- yearToCoauthors = UtilityFunctions.getPublicationYearToCoAuthors(authorNodesAndEdges);
+ yearToCoauthors = UtilityFunctions.getActivityYearToCollaborators(authorNodesAndEdges);
} else {
@@ -234,13 +232,13 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
* @param authorNodesAndEdges
* @param response
*/
- private Map prepareCoauthorsListDataResponse(CoAuthorshipData coAuthorshipData) {
+ private Map prepareCoauthorsListDataResponse(CollaborationData coAuthorshipData) {
String outputFileName = "";
- if (coAuthorshipData.getNodes() != null && coAuthorshipData.getNodes().size() > 0) {
+ if (coAuthorshipData.getCollaborators() != null && coAuthorshipData.getCollaborators().size() > 0) {
- outputFileName = UtilityFunctions.slugify(coAuthorshipData.getEgoNode().getNodeName())
+ outputFileName = UtilityFunctions.slugify(coAuthorshipData.getEgoCollaborator().getCollaboratorName())
+ "_co-authors" + ".csv";
} else {
outputFileName = "no_co-authors" + ".csv";
@@ -263,7 +261,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
* @param authorNodesAndEdges
* @param response
*/
- private Map prepareNetworkStreamDataResponse(CoAuthorshipData authorNodesAndEdges) {
+ private Map prepareNetworkStreamDataResponse(CollaborationData authorNodesAndEdges) {
CoAuthorshipGraphMLWriter coAuthorshipGraphMLWriter =
new CoAuthorshipGraphMLWriter(authorNodesAndEdges);
@@ -278,13 +276,13 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
}
- private Map prepareNetworkDownloadDataResponse(CoAuthorshipData authorNodesAndEdges) {
+ private Map prepareNetworkDownloadDataResponse(CollaborationData authorNodesAndEdges) {
String outputFileName = "";
- if (authorNodesAndEdges.getNodes() != null && authorNodesAndEdges.getNodes().size() > 0) {
+ if (authorNodesAndEdges.getCollaborators() != null && authorNodesAndEdges.getCollaborators().size() > 0) {
- outputFileName = UtilityFunctions.slugify(authorNodesAndEdges.getEgoNode().getNodeName())
+ outputFileName = UtilityFunctions.slugify(authorNodesAndEdges.getEgoCollaborator().getCollaboratorName())
+ "_co-author-network.graphml" + ".xml";
} else {
@@ -316,7 +314,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
*/
private TemplateResponseValues prepareStandaloneResponse(
String egoURI,
- CoAuthorshipData coAuthorshipVO,
+ CollaborationData coAuthorshipVO,
VitroRequest vitroRequest) {
Portal portal = vitroRequest.getPortal();
@@ -324,13 +322,13 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
String title = "";
Map body = new HashMap();
- if (coAuthorshipVO.getNodes() != null && coAuthorshipVO.getNodes().size() > 0) {
- title = coAuthorshipVO.getEgoNode().getNodeName() + " - ";
- body.put("numOfAuthors", coAuthorshipVO.getNodes().size());
+ if (coAuthorshipVO.getCollaborators() != null && coAuthorshipVO.getCollaborators().size() > 0) {
+ title = coAuthorshipVO.getEgoCollaborator().getCollaboratorName() + " - ";
+ body.put("numOfAuthors", coAuthorshipVO.getCollaborators().size());
}
- if (coAuthorshipVO.getEdges() != null && coAuthorshipVO.getEdges().size() > 0) {
- body.put("numOfCoAuthorShips", coAuthorshipVO.getEdges().size());
+ if (coAuthorshipVO.getCollaborations() != null && coAuthorshipVO.getCollaborations().size() > 0) {
+ body.put("numOfCoAuthorShips", coAuthorshipVO.getCollaborations().size());
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java
index f3578432..84465b01 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java
@@ -17,7 +17,7 @@ import org.apache.commons.logging.Log;
import edu.cornell.mannlib.vitro.webapp.controller.visualization.freemarker.VisualizationFrameworkConstants;
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.freemarker.valueobjects.Node;
+import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.Collaborator;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.SparklineData;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects.YearToEntityCountDataElement;
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.UtilityFunctions;
@@ -36,7 +36,7 @@ public class CoAuthorshipVisCodeGenerator {
* */
private static final String DEFAULT_VISCONTAINER_DIV_ID = "unique_coauthors_vis_container";
- private Map> yearToUniqueCoauthors;
+ private Map> yearToUniqueCoauthors;
private Log log;
@@ -47,7 +47,7 @@ public class CoAuthorshipVisCodeGenerator {
public CoAuthorshipVisCodeGenerator(String individualURI,
String visMode,
String visContainer,
- Map> yearToUniqueCoauthors,
+ Map> yearToUniqueCoauthors,
Log log) {
this.individualURI = individualURI;
@@ -123,7 +123,7 @@ public class CoAuthorshipVisCodeGenerator {
sparklineData.setNumOfYearsToBeRendered(numOfYearsToBeRendered);
int uniqueCoAuthorCounter = 0;
- Set allCoAuthorsWithKnownAuthorshipYears = new HashSet();
+ Set allCoAuthorsWithKnownAuthorshipYears = new HashSet();
List yearToUniqueCoauthorsCountDataTable = new ArrayList();
for (int publicationYear = minPubYearConsidered;
@@ -131,7 +131,7 @@ public class CoAuthorshipVisCodeGenerator {
publicationYear++) {
String publicationYearAsString = String.valueOf(publicationYear);
- Set currentCoAuthors = yearToUniqueCoauthors.get(publicationYearAsString);
+ Set currentCoAuthors = yearToUniqueCoauthors.get(publicationYearAsString);
Integer currentUniqueCoAuthors = null;
@@ -164,7 +164,7 @@ public class CoAuthorshipVisCodeGenerator {
* with known & unknown year. We do not want to repeat the count for this collaborator when we present
* it in the front-end.
* */
- Set totalUniqueCoInvestigators = new HashSet(allCoAuthorsWithKnownAuthorshipYears);
+ Set totalUniqueCoInvestigators = new HashSet(allCoAuthorsWithKnownAuthorshipYears);
/*
* Total publications will also consider publications that have no year associated with
@@ -226,7 +226,7 @@ public class CoAuthorshipVisCodeGenerator {
Map yearToUniqueCoauthorsCount = new HashMap();
- for (Map.Entry> currentYearToCoAuthors : yearToUniqueCoauthors.entrySet()) {
+ for (Map.Entry> currentYearToCoAuthors : yearToUniqueCoauthors.entrySet()) {
yearToUniqueCoauthorsCount.put(currentYearToCoAuthors.getKey(),
currentYearToCoAuthors.getValue().size());
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/CoAuthorshipData.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/collaborationutils/CoAuthorshipData.java
similarity index 80%
rename from src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/CoAuthorshipData.java
rename to src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/collaborationutils/CoAuthorshipData.java
index 720856ed..dc1ea505 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/valueobjects/CoAuthorshipData.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/collaborationutils/CoAuthorshipData.java
@@ -1,229 +1,187 @@
-/* $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.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class CoAuthorshipData {
-
- private Set nodes;
- private Set edges;
- private Node egoNode;
- private Set