diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipGraphMLWriter.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipGraphMLWriter.java index dd7c4647..e2d6695d 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipGraphMLWriter.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipGraphMLWriter.java @@ -107,6 +107,11 @@ public class CoAuthorshipGraphMLWriter { private void getEdgeContent(StringBuilder graphMLContent, Edge currentEdge) { + /* + System.out.print("EDGE_ID:" + currentEdge.getEdgeID() + "|"); + System.out.print("EDGE_SOURCE:" + currentEdge.getSourceNode().getNodeURL() + "|"); + System.out.println("EDGE_TARGET:" + currentEdge.getTargetNode().getNodeURL()); + */ graphMLContent.append("\n"); graphMLContent.append("\t" + node.getNodeURL() + "\n"); // graphMLContent.append("\t" + node.getNodeName() + "\n"); +// System.out.println("NODE_NAME:" + node.getNodeURL()); graphMLContent.append("\t" + node.getNodeName() + "\n"); if (profileURL != null) { diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java index be3fc699..2636f9ab 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java @@ -3,6 +3,7 @@ package edu.cornell.mannlib.vitro.webapp.visualization.coauthorship; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -104,6 +105,7 @@ public class QueryHandler { } } + RDFNode documentNode = solution.get(QueryFieldLabels.DOCUMENT_URL); BiboDocument biboDocument; @@ -144,7 +146,11 @@ public class QueryHandler { coAuthorNode.setNodeName(coAuthorLabelNode.toString()); } } - + /* + System.out.print("PERSON_URL:" + egoAuthorURLNode.toString() + "|"); + System.out.print("DOCUMENT_URL:" + documentNode.toString() + "|"); + System.out.println("CO_AUTHOR_URL:" + coAuthorURLNode.toString()); + */ coAuthorNode.addAuthorDocument(biboDocument); Set coAuthorsForCurrentBiboDocument; @@ -193,19 +199,13 @@ public class QueryHandler { edges); -/* System.out.println(collegeURLToVO); - System.out.println("------------------------------------------------------------"); - System.out.println(departmentURLToVO); - System.out.println("------------------------------------------------------------"); - System.out.println(employeeURLToVO); - System.out.println("------------------------------------------------------------"); -*/ return new VisVOContainer(egoNode, nodes, edges); } private void createCoAuthorEdges( Map biboDocumentURLToVO, Map> biboDocumentURLToCoAuthors, Set edges) { + for (Map.Entry> currentBiboDocumentEntry : biboDocumentURLToCoAuthors.entrySet()) { /* * If there was only one co-author (other than ego) then we dont have to create any edges. so @@ -214,10 +214,11 @@ public class QueryHandler { if (currentBiboDocumentEntry.getValue().size() > 1) { /* - * In order to leverage the nested "for loop" for making edges between all the co=authors + * 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()); int numOfCoAuthors = coAuthorNodes.size(); @@ -375,10 +376,10 @@ public class QueryHandler { + "OPTIONAL { ?document vitro:moniker ?documentMoniker } . " + "OPTIONAL { ?document vitro:blurb ?documentBlurb } . " + "OPTIONAL { ?document vitro:description ?documentDescription } " -// + "FILTER (<" + queryURI + "> != ?coAuthorPerson ) . " - + "}"; + + "} " + + "ORDER BY ?document ?coAuthorPerson"; -// System.out.println(sparqlQuery); + System.out.println("COAUTHORSHIP QUERY - " + sparqlQuery); return sparqlQuery; } diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/VisualizationRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/VisualizationRequestHandler.java index ea60d2d0..72588056 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/VisualizationRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/VisualizationRequestHandler.java @@ -196,21 +196,6 @@ public class VisualizationRequestHandler { } } -/* - private Map getUniqueCoauthorsCountPerYear( - edu.cornell.mannlib.vitro.webapp.visualization.coauthorship.VisVOContainer coAuthorshipVO) { - Map yearToUniqueCoauthorCount = new TreeMap(); - - Map> yearToUniqueCoauthors = getUniqueCoAuthorsPerYear(coAuthorshipVO); - - for (Entry> currentEntry : yearToUniqueCoauthors.entrySet()) { - - yearToUniqueCoauthorCount.put(currentEntry.getKey(), currentEntry.getValue().size()); - - } - return yearToUniqueCoauthorCount; - } - */ private Map> getUniqueCoAuthorsPerYear(edu.cornell.mannlib.vitro.webapp.visualization.coauthorship.VisVOContainer authorNodesAndEdges) {