diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryHandler.java index 246bc4ce..53f1309c 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryHandler.java @@ -44,7 +44,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UniqueIDGenerator */ public class CoAuthorshipQueryHandler implements QueryHandler { - private static final int MAX_AUTHORS_PER_PAPER_ALLOWED = 101; + private static final int MAX_AUTHORS_PER_PAPER_ALLOWED = 100; protected static final Syntax SYNTAX = Syntax.syntaxARQ; @@ -108,7 +108,6 @@ public class CoAuthorshipQueryHandler implements QueryHandler> currentBiboDocumentEntry + : biboDocumentURLToCoAuthors.entrySet()) { + + if (currentBiboDocumentEntry.getValue().size() > MAX_AUTHORS_PER_PAPER_ALLOWED) { + + BiboDocument currentBiboDocument = biboDocumentURLToVO + .get(currentBiboDocumentEntry.getKey()); + + Set edgesToBeRemoved = new HashSet(); + + for (Edge currentEdge : edges) { + Set currentCollaboratorDocuments = + currentEdge.getCollaboratorDocuments(); + + if (currentCollaboratorDocuments.contains(currentBiboDocument)) { + currentCollaboratorDocuments.remove(currentBiboDocument); + if (currentCollaboratorDocuments.isEmpty()) { + edgesToBeRemoved.add(currentEdge); + } + } + } + + edges.removeAll(edgesToBeRemoved); + + } + } + /* * We need to create edges between 2 co-authors. E.g. On a paper there were 3 authors * ego, A & B then we have already created edges like, @@ -230,7 +261,8 @@ public class CoAuthorshipQueryHandler implements QueryHandler 1 - && currentBiboDocumentEntry.getValue().size() < MAX_AUTHORS_PER_PAPER_ALLOWED) { + && currentBiboDocumentEntry.getValue().size() + <= MAX_AUTHORS_PER_PAPER_ALLOWED) { Set newlyAddedEdges = new HashSet(); diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java index 19e5c3d9..c08f3eb1 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java @@ -92,7 +92,11 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler { } catch (MalformedQueryParametersException e) { try { - handleMalformedParameters(e.getMessage(), vitroRequest, request, response, log); + handleMalformedParameters(e.getMessage(), + vitroRequest, + request, + response, + log); } catch (ServletException e1) { log.error(e1.getStackTrace()); } catch (IOException e1) { @@ -141,7 +145,11 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler { } catch (MalformedQueryParametersException e) { try { - handleMalformedParameters(e.getMessage(), vitroRequest, request, response, log); + handleMalformedParameters(e.getMessage(), + vitroRequest, + request, + response, + log); } catch (ServletException e1) { log.error(e1.getStackTrace()); } catch (IOException e1) {