public static boolean hasEdgeToClass(OrientGraph graph, OrientVertex vertex, String edgeName) throws Exception { boolean result = false; if(vertex.countEdges(Direction.IN, edgeName) > 0) { result = true; } return result; } }
@Override public double getGraphWeightSum() { long edges = 0; for (Vertex o : graph.getVertices()) { edges += ((OrientVertex) o).countEdges(Direction.OUT, SIMILAR); } return (double) edges; }
@Override public long count() { if (hasContainers.isEmpty()) { // NO CONDITIONS: USE THE FAST COUNT long counter = ((OrientVertex) vertex).countEdges(direction, labels); if (limit != Integer.MAX_VALUE && counter > limit) return limit; return counter; } // ITERATE EDGES TO MATCH CONDITIONS return super.count(); } }
/** * (Blueprints Extension) Counts the total items found. This method is more efficient than executing the query and browse the * returning Iterable. * * @return */ @Override public long count() { if (hasContainers.isEmpty()) { // NO CONDITIONS: USE THE FAST COUNT long counter = ((OrientVertex) vertex).countEdges(direction, labels); if (limit != Integer.MAX_VALUE && counter > limit) return limit; return counter; } // ITERATE EDGES TO MATCH CONDITIONS return super.count(); } }
} else { if(comment.countEdges(Direction.OUT, "HasComment") > 0) { error = "Comment has replied, cannot be deleted"; inputMap.put("responseCode", 400);
if(post.countEdges(Direction.OUT, "HasComment") > 0) { error = "Post has comment(s), cannot be deleted"; inputMap.put("responseCode", 400);
if(product.countEdges(Direction.OUT, "HasComment") > 0) { error = "Product has comment(s), cannot be deleted"; inputMap.put("responseCode", 400);