diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SourceVertices.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SourceVertices.java index f73d0d1c0b..1687e78d3d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SourceVertices.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SourceVertices.java @@ -61,7 +61,7 @@ public List sourcesVertices(HugeGraph g) { } iter = g.vertices(sourceIds.toArray()); E.checkArgument(iter.hasNext(), - "Not exist source vertexes with ids %s", + "Not exist source vertices with ids %s", this.ids); } else { ConditionQuery query = new ConditionQuery(HugeType.VERTEX); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java index a8105d462c..89e40f6f7b 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java @@ -90,8 +90,8 @@ public User authenticate(final Map credentials) /** * Verify if a user is legal - * @param username - * @param password + * @param username the username for authentication + * @param password the password for authentication * @return String No permission if return ROLE_NONE else return a role */ public String authenticate(final String username, final String password) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java index 15dc48aa9d..0053982f8d 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Query.java @@ -214,7 +214,7 @@ public void checkCapacity(long count) throws LimitExceedException { query = query.substring(0, MAX_CHARS) + "..."; } throw new LimitExceedException( - "Too many records(must <=%s) for the query: %s", + "Too many records(must <= %s) for the query: %s", this.capacity, query); } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java index c54265d565..5b60b1d8cf 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java @@ -94,8 +94,8 @@ public class GraphTransaction extends IndexableTransaction { private final GraphIndexTransaction indexTx; - private Map addedVertexes; - private Map removedVertexes; + private Map addedVertices; + private Map removedVertices; private Map addedEdges; private Map removedEdges; @@ -104,7 +104,7 @@ public class GraphTransaction extends IndexableTransaction { * These are used to rollback state * NOTE: props updates will be put into mutation directly(due to difficult) */ - private Map updatedVertexes; + private Map updatedVertices; private Map updatedEdges; private Set> updatedProps; // Oldest props @@ -112,7 +112,7 @@ public class GraphTransaction extends IndexableTransaction { private final boolean checkVertexExist; - private final int vertexesCapacity; + private final int verticesCapacity; private final int edgesCapacity; public GraphTransaction(HugeGraph graph, BackendStore store) { @@ -124,7 +124,7 @@ public GraphTransaction(HugeGraph graph, BackendStore store) { final HugeConfig conf = graph.configuration(); this.checkVertexExist = conf.get( CoreOptions.VERTEX_CHECK_CUSTOMIZED_ID_EXIST); - this.vertexesCapacity = conf.get(CoreOptions.VERTEX_TX_CAPACITY); + this.verticesCapacity = conf.get(CoreOptions.VERTEX_TX_CAPACITY); this.edgesCapacity = conf.get(CoreOptions.EDGE_TX_CAPACITY); this.locksTable = new LockUtil.LocksTable(graph.name()); } @@ -144,9 +144,9 @@ protected void reset() { super.reset(); // Clear mutation - this.addedVertexes = InsertionOrderUtil.newMap(); - this.removedVertexes = InsertionOrderUtil.newMap(); - this.updatedVertexes = InsertionOrderUtil.newMap(); + this.addedVertices = InsertionOrderUtil.newMap(); + this.removedVertices = InsertionOrderUtil.newMap(); + this.updatedVertices = InsertionOrderUtil.newMap(); this.addedEdges = InsertionOrderUtil.newMap(); this.removedEdges = InsertionOrderUtil.newMap(); @@ -169,9 +169,9 @@ protected void beforeWrite() { } protected final int verticesInTxSize() { - return this.addedVertexes.size() + - this.removedVertexes.size() + - this.updatedVertexes.size(); + return this.addedVertices.size() + + this.removedVertices.size() + + this.updatedVertices.size(); } protected final int edgesInTxSize() { @@ -181,19 +181,19 @@ protected final int edgesInTxSize() { } protected final Collection verticesInTxUpdated() { - int size = this.addedVertexes.size() + this.updatedVertexes.size(); + int size = this.addedVertices.size() + this.updatedVertices.size(); List vertices = new ArrayList<>(size); - vertices.addAll(this.addedVertexes.values()); - vertices.addAll(this.updatedVertexes.values()); + vertices.addAll(this.addedVertices.values()); + vertices.addAll(this.updatedVertices.values()); return vertices; } protected final Collection verticesInTxRemoved() { - return new ArrayList<>(this.removedVertexes.values()); + return new ArrayList<>(this.removedVertices.values()); } protected final boolean removingEdgeOwner(HugeEdge edge) { - for (HugeVertex vertex : this.removedVertexes.values()) { + for (HugeVertex vertex : this.removedVertices.values()) { if (edge.belongToVertex(vertex)) { return true; } @@ -205,23 +205,23 @@ protected final boolean removingEdgeOwner(HugeEdge edge) { @Override protected BackendMutation prepareCommit() { // Serialize and add updates into super.deletions - if (this.removedVertexes.size() > 0 || this.removedEdges.size() > 0) { - this.prepareDeletions(this.removedVertexes, this.removedEdges); + if (this.removedVertices.size() > 0 || this.removedEdges.size() > 0) { + this.prepareDeletions(this.removedVertices, this.removedEdges); } // Serialize and add updates into super.additions - if (this.addedVertexes.size() > 0 || this.addedEdges.size() > 0) { - this.prepareAdditions(this.addedVertexes, this.addedEdges); + if (this.addedVertices.size() > 0 || this.addedEdges.size() > 0) { + this.prepareAdditions(this.addedVertices, this.addedEdges); } return this.mutation(); } - protected void prepareAdditions(Map addedVertexes, + protected void prepareAdditions(Map addedVertices, Map addedEdges) { if (this.checkVertexExist) { - this.checkVertexExistIfCustomizedId(addedVertexes); + this.checkVertexExistIfCustomizedId(addedVertices); } // Do vertex update - for (HugeVertex v : addedVertexes.values()) { + for (HugeVertex v : addedVertices.values()) { assert !v.removed(); v.committed(); // Add vertex entry @@ -248,10 +248,10 @@ protected void prepareAdditions(Map addedVertexes, } } - protected void prepareDeletions(Map removedVertexes, + protected void prepareDeletions(Map removedVertices, Map removedEdges) { // Remove related edges of each vertex - for (HugeVertex v : removedVertexes.values()) { + for (HugeVertex v : removedVertices.values()) { // Query all edges of the vertex and remove them Query query = constructEdgesQuery(v.id(), Directions.BOTH); Iterator vedges = this.queryEdgesFromBackend(query); @@ -263,8 +263,8 @@ protected void prepareDeletions(Map removedVertexes, } } - // Remove vertexes - for (HugeVertex v : removedVertexes.values()) { + // Remove vertices + for (HugeVertex v : removedVertices.values()) { /* * If the backend stores vertex together with edges, it's edges * would be removed after removing vertex. Otherwise, if the @@ -345,8 +345,8 @@ public HugeVertex addVertex(Object... keyValues) { public HugeVertex addVertex(HugeVertex vertex) { this.checkOwnerThread(); - // Override vertexes in local `removedVertexes` - this.removedVertexes.remove(vertex.id()); + // Override vertices in local `removedVertices` + this.removedVertices.remove(vertex.id()); try { this.locksTable.lockReads(LockUtil.VERTEX_LABEL_DELETE, vertex.schemaLabel().id()); @@ -360,7 +360,7 @@ public HugeVertex addVertex(HugeVertex vertex) { * unconcerned with add vertex */ this.beforeWrite(); - this.addedVertexes.put(vertex.id(), vertex); + this.addedVertices.put(vertex.id(), vertex); this.afterWrite(); } catch (Throwable e){ this.locksTable.unlock(); @@ -408,11 +408,11 @@ public void removeVertex(HugeVertex vertex) { this.beforeWrite(); - // Override vertexes in local `addedVertexes` - this.addedVertexes.remove(vertex.id()); + // Override vertices in local `addedVertices` + this.addedVertices.remove(vertex.id()); // Collect the removed vertex - this.removedVertexes.put(vertex.id(), vertex); + this.removedVertices.put(vertex.id(), vertex); this.afterWrite(); } @@ -440,11 +440,11 @@ public Iterator queryVertices(Object... vertexIds) { for (Object vertexId : vertexIds) { HugeVertex vertex; Id id = HugeVertex.getIdValue(vertexId); - if (id == null || this.removedVertexes.containsKey(id)) { + if (id == null || this.removedVertices.containsKey(id)) { // The record has been deleted continue; - } else if ((vertex = this.addedVertexes.get(id)) != null || - (vertex = this.updatedVertexes.get(id)) != null) { + } else if ((vertex = this.addedVertices.get(id)) != null || + (vertex = this.updatedVertices.get(id)) != null) { // Found from local tx vertices.put(vertex.id(), vertex); } else { @@ -645,7 +645,7 @@ public Iterator queryEdges(Query query) { @SuppressWarnings("unchecked") Iterator r = (Iterator) joinTxEdges(query, results, - this.removedVertexes); + this.removedVertices); return r; } @@ -681,12 +681,12 @@ public void addVertexProperty(HugeVertexProperty prop) { return; } // Check is updating property of added/removed vertex - E.checkArgument(!this.addedVertexes.containsKey(vertex.id()) || - this.updatedVertexes.containsKey(vertex.id()), + E.checkArgument(!this.addedVertices.containsKey(vertex.id()) || + this.updatedVertices.containsKey(vertex.id()), "Can't update property '%s' for adding-state vertex", prop.key()); E.checkArgument(!vertex.removed() && - !this.removedVertexes.containsKey(vertex.id()), + !this.removedVertices.containsKey(vertex.id()), "Can't update property '%s' for removing-state vertex", prop.key()); // Check is updating primary key @@ -736,11 +736,11 @@ public void removeVertexProperty(HugeVertexProperty prop) { return; } // Check is updating property of added/removed vertex - E.checkArgument(!this.addedVertexes.containsKey(vertex.id()) || - this.updatedVertexes.containsKey(vertex.id()), + E.checkArgument(!this.addedVertices.containsKey(vertex.id()) || + this.updatedVertices.containsKey(vertex.id()), "Can't remove property '%s' for adding-state vertex", prop.key()); - E.checkArgument(!this.removedVertexes.containsKey(vertex.id()), + E.checkArgument(!this.removedVertices.containsKey(vertex.id()), "Can't remove property '%s' for removing-state vertex", prop.key()); @@ -1232,12 +1232,12 @@ private Iterator joinTxVertices(Query query, assert query.resultType().isVertex(); return this.joinTxRecords(query, vertices, (q, v) -> q.test(v) ? v : null, - this.addedVertexes, this.removedVertexes, - this.updatedVertexes); + this.addedVertices, this.removedVertices, + this.updatedVertices); } private Iterator joinTxEdges(Query query, Iterator edges, - Map removingVertexes) { + Map removingVertices) { assert query.resultType().isEdge(); final BiFunction matchTxEdges = (q, e) -> { assert q.resultType() == HugeType.EDGE; @@ -1246,12 +1246,12 @@ private Iterator joinTxEdges(Query query, Iterator edges, edges = this.joinTxRecords(query, edges, matchTxEdges, this.addedEdges, this.removedEdges, this.updatedEdges); - if (removingVertexes.isEmpty()) { + if (removingVertices.isEmpty()) { return edges; } // Filter edges that belong to deleted vertex return new FilterIterator(edges, edge -> { - for (HugeVertex v : removingVertexes.values()) { + for (HugeVertex v : removingVertices.values()) { if (edge.belongToVertex(v)) { return false; } @@ -1308,10 +1308,10 @@ private Iterator joinTxRecords( } private void checkTxVerticesCapacity() throws LimitExceedException { - if (this.verticesInTxSize() >= this.vertexesCapacity) { + if (this.verticesInTxSize() >= this.verticesCapacity) { throw new LimitExceedException( "Vertices size has reached tx capacity %d", - this.vertexesCapacity); + this.verticesCapacity); } } @@ -1324,7 +1324,7 @@ private void checkTxEdgesCapacity() throws LimitExceedException { } private void propertyUpdated(HugeVertex vertex, HugeProperty property) { - this.updatedVertexes.put(vertex.id(), vertex); + this.updatedVertices.put(vertex.id(), vertex); if (property != null) { this.updatedProps.add(property); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeFeatures.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeFeatures.java index 52cb03ddef..3ca3cfe395 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeFeatures.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeFeatures.java @@ -147,6 +147,7 @@ public boolean supportsUserSuppliedIds() { return false; } + @Override public boolean willAllowId(Object id) { if(!this.supportsUserSuppliedIds()) { return false; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/StringEncoding.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/StringEncoding.java index d2184e63d2..efd5d5bb01 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/StringEncoding.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/StringEncoding.java @@ -41,8 +41,9 @@ public static int writeAsciiString(byte[] array, int c = attribute.charAt(i); assert c <= 127; byte b = (byte) c; - if (++i == len) + if (++i == len) { b |= 0x80; // End marker + } array[startPos++] = b; } while (i < len); @@ -54,8 +55,9 @@ public static String readAsciiString(byte[] array, int startPos) { int c = 0; do { c = 0xFF & array[startPos++]; - if (c != 0x80) + if (c != 0x80) { sb.append((char) (c & 0x7F)); + } } while ((c & 0x80) <= 0); return sb.toString(); } diff --git a/hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java b/hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java index 74391e861a..2dd69fbb6e 100644 --- a/hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java +++ b/hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example1.java @@ -258,20 +258,20 @@ public static void loadData(final HugeGraph graph) { public static void testQuery(final HugeGraph graph) { // query all - GraphTraversal vertexes = graph.traversal().V(); - int size = vertexes.toList().size(); + GraphTraversal vertices = graph.traversal().V(); + int size = vertices.toList().size(); assert size == 12; System.out.println(">>>> query all vertices: size=" + size); // query by label - vertexes = graph.traversal().V().hasLabel("person"); - size = vertexes.toList().size(); + vertices = graph.traversal().V().hasLabel("person"); + size = vertices.toList().size(); assert size == 5; System.out.println(">>>> query all persons: size=" + size); // query vertex by primary-values - vertexes = graph.traversal().V().hasLabel("author").has("id", 1); - List vertexList = vertexes.toList(); + vertices = graph.traversal().V().hasLabel("author").has("id", 1); + List vertexList = vertices.toList(); assert vertexList.size() == 1; System.out.println(">>>> query vertices by primary-values: " + vertexList); @@ -280,20 +280,20 @@ public static void testQuery(final HugeGraph graph) { String authorId = String.format("%s:%s", author.id().asString(), "1"); // query vertex by id and query out edges - vertexes = graph.traversal().V(authorId); - GraphTraversal edgesOfVertex = vertexes.outE("created"); + vertices = graph.traversal().V(authorId); + GraphTraversal edgesOfVertex = vertices.outE("created"); List edgeList = edgesOfVertex.toList(); assert edgeList.size() == 1; System.out.println(">>>> query edges of vertex: " + edgeList); - vertexes = graph.traversal().V(authorId); - vertexList = vertexes.out("created").toList(); + vertices = graph.traversal().V(authorId); + vertexList = vertices.out("created").toList(); assert vertexList.size() == 1; System.out.println(">>>> query vertices of vertex: " + vertexList); // query edge by sort-values - vertexes = graph.traversal().V(authorId); - edgesOfVertex = vertexes.outE("write").has("time", "2017-4-28"); + vertices = graph.traversal().V(authorId); + edgesOfVertex = vertices.outE("write").has("time", "2017-4-28"); edgeList = edgesOfVertex.toList(); assert edgeList.size() == 2; System.out.println(">>>> query edges of vertex by sort-values: " + @@ -306,13 +306,11 @@ public static void testQuery(final HugeGraph graph) { q.key(HugeKeys.PROPERTIES, age.id()); if (graph.graphTransaction().store().features() .supportsQueryWithContainsKey()) { - Iterator vertices = graph.vertices(q); - assert vertices.hasNext(); - System.out.println(">>>> queryVertices(age): " + - vertices.hasNext()); - while (vertices.hasNext()) { - System.out.println(">>>> queryVertices(age): " + - vertices.next()); + Iterator iter = graph.vertices(q); + assert iter.hasNext(); + System.out.println(">>>> queryVertices(age): " + iter.hasNext()); + while (iter.hasNext()) { + System.out.println(">>>> queryVertices(age): " + iter.next()); } } @@ -361,40 +359,40 @@ public static void testQuery(final HugeGraph graph) { } // query by vertex label - vertexes = graph.traversal().V().hasLabel("book"); - size = vertexes.toList().size(); + vertices = graph.traversal().V().hasLabel("book"); + size = vertices.toList().size(); assert size == 5; System.out.println(">>>> query all books: size=" + size); // query by vertex label and key-name - vertexes = graph.traversal().V().hasLabel("person").has("age"); - size = vertexes.toList().size(); + vertices = graph.traversal().V().hasLabel("person").has("age"); + size = vertices.toList().size(); assert size == 5; System.out.println(">>>> query all persons with age: size=" + size); // query by vertex props - vertexes = graph.traversal().V().hasLabel("person") + vertices = graph.traversal().V().hasLabel("person") .has("city", "Taipei"); - vertexList = vertexes.toList(); + vertexList = vertices.toList(); assert vertexList.size() == 1; System.out.println(">>>> query all persons in Taipei: " + vertexList); - vertexes = graph.traversal().V().hasLabel("person").has("age", 19); - vertexList = vertexes.toList(); + vertices = graph.traversal().V().hasLabel("person").has("age", 19); + vertexList = vertices.toList(); assert vertexList.size() == 1; System.out.println(">>>> query all persons age==19: " + vertexList); - vertexes = graph.traversal().V().hasLabel("person") + vertices = graph.traversal().V().hasLabel("person") .has("age", P.lt(19)); - vertexList = vertexes.toList(); + vertexList = vertices.toList(); assert vertexList.size() == 1; assert vertexList.get(0).property("age").value().equals(3); System.out.println(">>>> query all persons age<19: " + vertexList); String addr = "Bay Area"; - vertexes = graph.traversal().V().hasLabel("author") + vertices = graph.traversal().V().hasLabel("author") .has("lived", Text.contains(addr)); - vertexList = vertexes.toList(); + vertexList = vertices.toList(); assert vertexList.size() == 1; System.out.println(String.format(">>>> query all authors lived %s: %s", addr, vertexList)); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java index 1db310927e..66db5ba9fb 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java @@ -2767,11 +2767,11 @@ private Edge initEdgeTransfer() { } private Vertex vertex(String label, String pkName, Object pkValue) { - List vertexes = graph().traversal().V() + List vertices = graph().traversal().V() .hasLabel(label) .has(pkName, pkValue).toList(); - Assert.assertEquals(1, vertexes.size()); - return vertexes.get(0); + Assert.assertEquals(1, vertices.size()); + return vertices.get(0); } private static void assertContains( diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RestoreCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RestoreCoreTest.java index f9313f481e..84dca4855d 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RestoreCoreTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RestoreCoreTest.java @@ -33,6 +33,7 @@ public class RestoreCoreTest extends BaseCoreTest { @After + @Override public void teardown() throws Exception { super.teardown(); graph().mode(GraphMode.NONE); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java index f02be1f7ef..5f330cda75 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java @@ -639,17 +639,17 @@ public void testQueryAll() { init10Vertices(); // Query all - List vertexes = graph.traversal().V().toList(); + List vertices = graph.traversal().V().toList(); - Assert.assertEquals(10, vertexes.size()); + Assert.assertEquals(10, vertices.size()); - assertContains(vertexes, + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); - assertContains(vertexes, T.label, "language", "name", "java"); + assertContains(vertices, T.label, "language", "name", "java"); - assertContains(vertexes, T.label, "book", "name", "java-1"); + assertContains(vertices, T.label, "book", "name", "java-1"); } @Test @@ -658,17 +658,17 @@ public void testQueryAllWithGraphAPI() { init10Vertices(); // Query all - List vertexes = ImmutableList.copyOf(graph.vertices()); + List vertices = ImmutableList.copyOf(graph.vertices()); - Assert.assertEquals(10, vertexes.size()); + Assert.assertEquals(10, vertices.size()); - assertContains(vertexes, + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); - assertContains(vertexes, T.label, "language", "name", "java"); + assertContains(vertices, T.label, "language", "name", "java"); - assertContains(vertexes, T.label, "book", "name", "java-1"); + assertContains(vertices, T.label, "book", "name", "java-1"); } @Test @@ -677,9 +677,9 @@ public void testQueryAllWithLimit() { init10Vertices(); // Query all with limit - List vertexes = graph.traversal().V().limit(3).toList(); + List vertices = graph.traversal().V().limit(3).toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); } @Test @@ -700,9 +700,9 @@ public void testQueryAllWithLimit0() { init10Vertices(); // Query all with limit 0 - List vertexes = graph.traversal().V().limit(0).toList(); + List vertices = graph.traversal().V().limit(0).toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -711,8 +711,8 @@ public void testQueryAllWithNoLimit() { init10Vertices(); // Query all with limit -1 (mean no-limit) - List vertexes = graph.traversal().V().limit(-1).toList(); - Assert.assertEquals(10, vertexes.size()); + List vertices = graph.traversal().V().limit(-1).toList(); + Assert.assertEquals(10, vertices.size()); } @Test @@ -734,11 +734,11 @@ public void testQueryAllWithOffset() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().range(8, 100).toList(); - Assert.assertEquals(2, vertexes.size()); + List vertices = graph.traversal().V().range(8, 100).toList(); + Assert.assertEquals(2, vertices.size()); - List vertexes2 = graph.traversal().V().range(8, -1).toList(); - Assert.assertEquals(vertexes, vertexes2); + List vertices2 = graph.traversal().V().range(8, -1).toList(); + Assert.assertEquals(vertices, vertices2); } @Test @@ -746,23 +746,23 @@ public void testQueryAllWithOffsetAndLimit() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().range(8, 9).toList(); - Assert.assertEquals(1, vertexes.size()); + List vertices = graph.traversal().V().range(8, 9).toList(); + Assert.assertEquals(1, vertices.size()); - vertexes = graph.traversal().V().range(0, 4).toList(); - Assert.assertEquals(4, vertexes.size()); + vertices = graph.traversal().V().range(0, 4).toList(); + Assert.assertEquals(4, vertices.size()); - vertexes = graph.traversal().V().range(-2, 4).toList(); - Assert.assertEquals(4, vertexes.size()); + vertices = graph.traversal().V().range(-2, 4).toList(); + Assert.assertEquals(4, vertices.size()); - vertexes = graph.traversal().V().range(10, -1).toList(); - Assert.assertEquals(0, vertexes.size()); + vertices = graph.traversal().V().range(10, -1).toList(); + Assert.assertEquals(0, vertices.size()); - vertexes = graph.traversal().V().range(0, -1).toList(); - Assert.assertEquals(10, vertexes.size()); + vertices = graph.traversal().V().range(0, -1).toList(); + Assert.assertEquals(10, vertices.size()); - vertexes = graph.traversal().V().range(-2, -1).toList(); - Assert.assertEquals(10, vertexes.size()); + vertices = graph.traversal().V().range(-2, -1).toList(); + Assert.assertEquals(10, vertices.size()); } @Test @@ -770,26 +770,26 @@ public void testQueryAllWithOffsetAndLimitWithMultiTimes() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .range(1, 6) .range(4, 8) .toList(); // [4, 6) - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .range(1, -1) .range(6, 8) .toList(); // [6, 8) - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .range(1, 6) .range(6, 8) .toList(); // [6, 6) - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -823,13 +823,13 @@ public void testQueryAllWithIllegalOffsetOrLimit() { public void testSplicingId() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().toList(); + List vertices = graph.traversal().V().toList(); String bookId = graph.vertexLabel("book").id().asString(); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-1"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-3"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-5"))); } @@ -841,9 +841,9 @@ public void testQueryById() { String authorId = graph.vertexLabel("author").id().asString(); // Query vertex by id Id id = SplicingIdGenerator.splicing(authorId, "1"); - List vertexes = graph.traversal().V(id).toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + List vertices = graph.traversal().V(id).toList(); + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); } @@ -867,20 +867,20 @@ public void testQueryByLabel() { init10Vertices(); // Query by vertex label - List vertexes = graph.traversal().V().hasLabel("book") + List vertices = graph.traversal().V().hasLabel("book") .toList(); String bookId = graph.vertexLabel("book").id().asString(); - Assert.assertEquals(5, vertexes.size()); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertEquals(5, vertices.size()); + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-1"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-2"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-3"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-4"))); - Assert.assertTrue(Utils.containsId(vertexes, + Assert.assertTrue(Utils.containsId(vertices, SplicingIdGenerator.splicing(bookId, "java-5"))); } @@ -901,11 +901,11 @@ public void testQueryByLabelAndKeyName() { init10Vertices(); // Query by vertex label and key-name - List vertexes = graph.traversal().V().hasLabel("language") + List vertices = graph.traversal().V().hasLabel("language") .has("dynamic").toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "language", "name", "python", "dynamic", true); } @@ -915,10 +915,10 @@ public void testQueryByPrimaryValues() { init10Vertices(); // Query vertex by primary-values - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("author").has("id", 1).toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); } @@ -929,17 +929,17 @@ public void testQueryByPrimaryValuesAndProps() { init10Vertices(); // Query vertex by primary-values - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("author").has("id", 1) .has("name", "James Gosling").toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); - vertexes = graph.traversal().V().hasLabel("author") + vertices = graph.traversal().V().hasLabel("author") .has("id", 1).has("name", "fake-name").toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -956,10 +956,10 @@ public void testQueryFilterByPropName() { ConditionQuery q = new ConditionQuery(HugeType.VERTEX); q.eq(HugeKeys.LABEL, language.id()); q.key(HugeKeys.PROPERTIES, dynamic.id()); - List vertexes = ImmutableList.copyOf(graph.vertices(q)); + List vertices = ImmutableList.copyOf(graph.vertices(q)); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "language", "name", "python", "dynamic", true); } @@ -971,21 +971,21 @@ public void testQueryByHasKey() { features.supportsQueryWithContainsKey()); init10Vertices(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("language").hasKey("dynamic") .toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "language", "name", "python", "dynamic", true); - vertexes = graph.traversal().V().hasKey("age").toList(); - Assert.assertEquals(2, vertexes.size()); - assertContains(vertexes, + vertices = graph.traversal().V().hasKey("age").toList(); + Assert.assertEquals(2, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); - assertContains(vertexes, + assertContains(vertices, T.label, "author", "id", 2, "name", "Guido van Rossum", "age", 61, "lived", "California"); @@ -1010,17 +1010,17 @@ public void testQueryByHasValue() { features.supportsQueryWithContains()); init10Vertices(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("language").hasValue(true) .toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "language", "name", "python", "dynamic", true); - vertexes = graph.traversal().V().hasValue(62).toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + vertices = graph.traversal().V().hasValue(62).toList(); + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); @@ -1044,12 +1044,12 @@ public void testQueryByStringPropWithOneResult() { initPersonIndex(true); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("city", "Taipei") .toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "person", "name", "Hebe", "city", "Taipei", "age", 21); } @@ -1063,19 +1063,19 @@ public void testQueryByStringPropWithMultiResults() { initPersonIndex(true); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("city", "Beijing") .toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); - assertContains(vertexes, + assertContains(vertices, T.label, "person", "name", "James", "city", "Beijing", "age", 19); - assertContains(vertexes, + assertContains(vertices, T.label, "person", "name", "Tom Cat", "city", "Beijing", "age", 20); - assertContains(vertexes, + assertContains(vertices, T.label, "person", "name", "Lisa", "city", "Beijing", "age", 20); } @@ -1087,11 +1087,11 @@ public void testQueryByIntPropWithOneResult() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", 19).toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "person", "name", "James", "city", "Beijing", "age", 19); } @@ -1103,15 +1103,15 @@ public void testQueryByIntPropWithMultiResults() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", 20).toList(); - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); - assertContains(vertexes, + assertContains(vertices, T.label, "person", "name", "Tom Cat", "city", "Beijing", "age", 20); - assertContains(vertexes, + assertContains(vertices, T.label, "person", "name", "Lisa", "city", "Beijing", "age", 20); } @@ -1123,10 +1123,10 @@ public void testQueryByIntPropWithNonResult() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", 18).toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -1136,10 +1136,10 @@ public void testQueryByIntPropWithDifferentDataType() { HugeGraph graph = graph(); initPersonIndex(false); init5Persons(); - List vertexes; + List vertices; - vertexes = graph.traversal().V().has("age", 21).toList(); - Assert.assertEquals(1, vertexes.size()); + vertices = graph.traversal().V().has("age", 21).toList(); + Assert.assertEquals(1, vertices.size()); Assert.assertThrows(IllegalArgumentException.class, () -> { graph.traversal().V().has("age", 21.0).toList(); @@ -1157,12 +1157,12 @@ public void testQueryByIntPropUsingLtWithOneResult() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.lt(19)) .toList(); - Assert.assertEquals(1, vertexes.size()); - assertContains(vertexes, + Assert.assertEquals(1, vertices.size()); + assertContains(vertices, T.label, "person", "name", "Baby", "city", "Hongkong", "age", 3); } @@ -1174,11 +1174,11 @@ public void testQueryByIntPropUsingLtWithMultiResults() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.lt(21)) .toList(); - Assert.assertEquals(4, vertexes.size()); + Assert.assertEquals(4, vertices.size()); } @Test @@ -1188,11 +1188,11 @@ public void testQueryByIntPropUsingLteWithMultiResults() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.lte(20)) .toList(); - Assert.assertEquals(4, vertexes.size()); + Assert.assertEquals(4, vertices.size()); } @Test @@ -1202,11 +1202,11 @@ public void testQueryByIntPropUsingGtWithOneResult() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.gt(20)) .toList(); - Assert.assertEquals(1, vertexes.size()); + Assert.assertEquals(1, vertices.size()); } @Test @@ -1216,11 +1216,11 @@ public void testQueryByIntPropUsingGtWithMultiResults() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.gt(1)) .toList(); - Assert.assertEquals(5, vertexes.size()); + Assert.assertEquals(5, vertices.size()); } @Test @@ -1230,11 +1230,11 @@ public void testQueryByIntPropUsingGtWithNonResult() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.gt(30)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -1244,11 +1244,11 @@ public void testQueryByIntPropUsingGteWithMultiResults() { initPersonIndex(false); init5Persons(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.gte(20)) .toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); } @Test @@ -1260,12 +1260,12 @@ public void testQueryByIntPropUsingInsideWithOneResult() { init5Persons(); // 3 < age && age < 20 (that's age == 19) - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person").has("age", P.inside(3, 20)) .toList(); - Assert.assertEquals(1, vertexes.size()); - Assert.assertEquals(19, vertexes.get(0).property("age").value()); + Assert.assertEquals(1, vertices.size()); + Assert.assertEquals(19, vertices.get(0).property("age").value()); } @Test @@ -1277,27 +1277,27 @@ public void testQueryByIntPropUsingInsideWithMultiResults() { init5Persons(); // 19 < age && age < 21 (that's age == 20) - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person") .has("age", P.inside(19, 21)) .toList(); - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); // 3 < age && age < 21 (that's age == 19 or age == 20) - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.inside(3, 21)) .toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); // 0 < age && age < 22 (that's all) - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person") .has("age", P.inside(0, 22)) .toList(); - Assert.assertEquals(5, vertexes.size()); + Assert.assertEquals(5, vertices.size()); } @Test @@ -1309,41 +1309,41 @@ public void testQueryByIntPropUsingInsideWithNonResult() { init5Persons(); // 3 < age && age < 19 - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person") .has("age", P.inside(3, 19)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 0 < age && age < 3 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.inside(0, 3)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 20 < age && age < 21 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.inside(20, 21)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 21 < age && age < 25 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.inside(21, 25)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 21 < age && age < 20 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person") .has("age", P.inside(21, 20)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -1355,12 +1355,12 @@ public void testQueryByIntPropUsingBetweenWithOneResult() { init5Persons(); // 3 <= age && age < 19 (that's age == 3) - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person") .has("age", P.between(3, 19)) .toList(); - Assert.assertEquals(1, vertexes.size()); + Assert.assertEquals(1, vertices.size()); } @Test @@ -1372,19 +1372,19 @@ public void testQueryByIntPropUsingBetweenWithMultiResults() { init5Persons(); // 19 <= age && age < 21 - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person") .has("age", P.between(19, 21)) .toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); // 3 <= age && age < 21 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.between(3, 21)) .toList(); - Assert.assertEquals(4, vertexes.size()); + Assert.assertEquals(4, vertices.size()); } @Test @@ -1396,26 +1396,26 @@ public void testQueryByIntPropUsingBetweenWithNonResult() { init5Persons(); // 4 <= age && age < 19 - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .hasLabel("person") .has("age", P.between(4, 19)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 3 <= age && age < 3 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.between(3, 3)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); // 21 <= age && age < 20 - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .hasLabel("person").has("age", P.between(21, 20)) .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -2163,9 +2163,9 @@ public void testRemoveVertex() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().toList(); - Assert.assertEquals(10, vertexes.size()); - assertContains(vertexes, + List vertices = graph.traversal().V().toList(); + Assert.assertEquals(10, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); @@ -2173,9 +2173,9 @@ public void testRemoveVertex() { vertex.remove(); graph.tx().commit(); - vertexes = graph.traversal().V().toList(); - Assert.assertEquals(9, vertexes.size()); - assertNotContains(vertexes, + vertices = graph.traversal().V().toList(); + Assert.assertEquals(9, vertices.size()); + assertNotContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); } @@ -2185,9 +2185,9 @@ public void testRemoveVertexOfNotExists() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().toList(); - Assert.assertEquals(10, vertexes.size()); - assertContains(vertexes, + List vertices = graph.traversal().V().toList(); + Assert.assertEquals(10, vertices.size()); + assertContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); @@ -2195,9 +2195,9 @@ public void testRemoveVertexOfNotExists() { vertex.remove(); graph.tx().commit(); - vertexes = graph.traversal().V().toList(); - Assert.assertEquals(9, vertexes.size()); - assertNotContains(vertexes, + vertices = graph.traversal().V().toList(); + Assert.assertEquals(9, vertices.size()); + assertNotContains(vertices, T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian"); @@ -2217,9 +2217,9 @@ public void testRemoveVertexAfterAddVertexWithTx() { tx.commit(); tx.close(); - List vertexes = graph.traversal().V().toList(); - Assert.assertEquals(1, vertexes.size()); - assertNotContains(vertexes, T.label, "book", "name", "java-2"); + List vertices = graph.traversal().V().toList(); + Assert.assertEquals(1, vertices.size()); + assertNotContains(vertices, T.label, "book", "name", "java-2"); } @Test @@ -2227,11 +2227,11 @@ public void testRemoveVertexOneByOne() { HugeGraph graph = graph(); init10Vertices(); - List vertexes = graph.traversal().V().toList(); - Assert.assertEquals(10, vertexes.size()); + List vertices = graph.traversal().V().toList(); + Assert.assertEquals(10, vertices.size()); - for (int i = 0; i < vertexes.size(); i++) { - vertexes.get(i).remove(); + for (int i = 0; i < vertices.size(); i++) { + vertices.get(i).remove(); graph.tx().commit(); Assert.assertEquals(9 - i, graph.traversal().V().toList().size()); } @@ -2995,7 +2995,7 @@ public void testScanVertex() { storeFeatures().supportsScanKeyRange()); init10Vertices(); - List vertexes = new LinkedList<>(); + List vertices = new LinkedList<>(); long splitSize = 1 * 1024 * 1024; Object splits = graph.graphTransaction() @@ -3003,10 +3003,10 @@ public void testScanVertex() { for (Shard split : (List) splits) { ConditionQuery q = new ConditionQuery(HugeType.VERTEX); q.scan(split.start(), split.end()); - vertexes.addAll(ImmutableList.copyOf(graph.vertices(q))); + vertices.addAll(ImmutableList.copyOf(graph.vertices(q))); } - Assert.assertEquals(10, vertexes.size()); + Assert.assertEquals(10, vertices.size()); } @Test @@ -3017,7 +3017,7 @@ public void testScanVertexInPaging() { storeFeatures().supportsScanKeyRange()); init10Vertices(); - List vertexes = new LinkedList<>(); + List vertices = new LinkedList<>(); ConditionQuery query = new ConditionQuery(HugeType.VERTEX); query.scan(String.valueOf(Long.MIN_VALUE), @@ -3028,11 +3028,11 @@ public void testScanVertexInPaging() { query.page(page); Iterator iterator = graph.vertices(query); while (iterator.hasNext()) { - vertexes.add(iterator.next()); + vertices.add(iterator.next()); } page = PageInfo.page(iterator); } - Assert.assertEquals(10, vertexes.size()); + Assert.assertEquals(10, vertices.size()); } @Test @@ -3089,12 +3089,12 @@ public void testQuerySingleIndexedPropertyByEqual() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("band", "lenovo").toList(); - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); - vertexes = graph.traversal().V().has("band", "apple").toList(); - Assert.assertEquals(1, vertexes.size()); + vertices = graph.traversal().V().has("band", "apple").toList(); + Assert.assertEquals(1, vertices.size()); } @Test @@ -3102,12 +3102,12 @@ public void testQuerySingleIndexedPropertyByNotEqual() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("band", "acer").toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); - vertexes = graph.traversal().V().has("band", "Hp").toList(); - Assert.assertEquals(0, vertexes.size()); + vertices = graph.traversal().V().has("band", "Hp").toList(); + Assert.assertEquals(0, vertices.size()); } @Test @@ -3115,12 +3115,12 @@ public void testQueryComplexIndexedPropertyByEqualOnePrefix() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "3.2GHz").toList(); - Assert.assertEquals(3, vertexes.size()); + Assert.assertEquals(3, vertices.size()); - vertexes = graph.traversal().V().has("cpu", "4.6GHz").toList(); - Assert.assertEquals(1, vertexes.size()); + vertices = graph.traversal().V().has("cpu", "4.6GHz").toList(); + Assert.assertEquals(1, vertices.size()); } @Test @@ -3128,12 +3128,12 @@ public void testQueryComplexIndexedPropertyByNotEqualOnePrefix() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "2.8GHz").toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); - vertexes = graph.traversal().V().has("cpu", "4.8GHz").toList(); - Assert.assertEquals(0, vertexes.size()); + vertices = graph.traversal().V().has("cpu", "4.8GHz").toList(); + Assert.assertEquals(0, vertices.size()); } @Test @@ -3141,17 +3141,17 @@ public void testQueryComplexIndexedPropertyByEqualTwoPrefix() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "3.2GHz") .has("ram", "16GB") .toList(); - Assert.assertEquals(2, vertexes.size()); + Assert.assertEquals(2, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("ram", "32GB") .has("cpu", "4.6GHz") .toList(); - Assert.assertEquals(1, vertexes.size()); + Assert.assertEquals(1, vertices.size()); } @Test @@ -3159,17 +3159,17 @@ public void testQueryComplexIndexedPropertyByNotEqualTwoPrefix() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "3.3GHz") .has("ram", "16GB") .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("ram", "32GB") .has("cpu", "4.8GHz") .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -3177,19 +3177,19 @@ public void testQueryComplexIndexedPropertyByEqualAll() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "3.2GHz") .has("band", "lenovo") .has("ram", "16GB") .toList(); - Assert.assertEquals(1, vertexes.size()); + Assert.assertEquals(1, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("ram", "32GB") .has("cpu", "4.6GHz") .has("band", "microsoft") .toList(); - Assert.assertEquals(1, vertexes.size()); + Assert.assertEquals(1, vertices.size()); } @Test @@ -3197,19 +3197,19 @@ public void testQueryComplexIndexedPropertyByNotEqualAll() { HugeGraph graph = graph(); init5Computers(); - List vertexes = graph.traversal().V() + List vertices = graph.traversal().V() .has("cpu", "3.3GHz") .has("band", "apple") .has("ram", "16GB") .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("ram", "32GB") .has("cpu", "4.8GHz") .has("band", "microsoft") .toList(); - Assert.assertEquals(0, vertexes.size()); + Assert.assertEquals(0, vertices.size()); } @Test @@ -3225,44 +3225,44 @@ public void testQueryByPage() { Assert.assertEquals(10, IteratorUtils.count(iter)); String page = TraversalUtil.page(iter); - List vertexes; + List vertices; - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("~page", page).limit(1) .toList(); - Assert.assertEquals(1, vertexes.size()); - Vertex vertex1 = vertexes.get(0); + Assert.assertEquals(1, vertices.size()); + Vertex vertex1 = vertices.get(0); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("~page", page).limit(33) .toList(); - Assert.assertEquals(33, vertexes.size()); - Vertex vertex2 = vertexes.get(0); + Assert.assertEquals(33, vertices.size()); + Vertex vertex2 = vertices.get(0); Assert.assertEquals(vertex1.id(), vertex2.id()); Assert.assertEquals(vertex1.label(), vertex2.label()); Assert.assertEquals(IteratorUtils.asList(vertex1.properties()), IteratorUtils.asList(vertex2.properties())); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("~page", page).limit(89) .toList(); - Assert.assertEquals(89, vertexes.size()); - Vertex vertex3 = vertexes.get(88); + Assert.assertEquals(89, vertices.size()); + Vertex vertex3 = vertices.get(88); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("~page", page).limit(90) .toList(); - Assert.assertEquals(90, vertexes.size()); - Vertex vertex4 = vertexes.get(88); + Assert.assertEquals(90, vertices.size()); + Vertex vertex4 = vertices.get(88); Assert.assertEquals(vertex3.id(), vertex4.id()); Assert.assertEquals(vertex3.label(), vertex4.label()); Assert.assertEquals(IteratorUtils.asList(vertex3.properties()), IteratorUtils.asList(vertex4.properties())); - vertexes = graph.traversal().V() + vertices = graph.traversal().V() .has("~page", page).limit(91) .toList(); - Assert.assertEquals(90, vertexes.size()); + Assert.assertEquals(90, vertices.size()); } @Test @@ -3285,10 +3285,10 @@ public void testQueryByPageResultsMatched() { iter = graph.traversal().V() .has("~page", page).limit(size); @SuppressWarnings("unchecked") - List vertexes = IteratorUtils.asList(iter); - Assert.assertEquals(size, vertexes.size()); + List vertices = IteratorUtils.asList(iter); + Assert.assertEquals(size, vertices.size()); - pageAll.addAll(vertexes); + pageAll.addAll(vertices); page = TraversalUtil.page(iter); } @@ -4255,11 +4255,11 @@ private void initPageTestData() { } private Vertex vertex(String label, String pkName, Object pkValue) { - List vertexes = graph().traversal().V() + List vertices = graph().traversal().V() .hasLabel(label).has(pkName, pkValue) .toList(); - Assert.assertTrue(vertexes.size() <= 1); - return vertexes.size() == 1 ? vertexes.get(0) : null; + Assert.assertTrue(vertices.size() <= 1); + return vertices.size() == 1 ? vertices.get(0) : null; } private static void assertContains(List vertices, diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java index a3342dbde2..c185d1d557 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java @@ -49,8 +49,8 @@ public static HugeGraph open() { return HugeFactory.open(confPath); } - public static boolean containsId(List vertexes, Id id) { - for (Vertex v : vertexes) { + public static boolean containsId(List vertices, Id id) { + for (Vertex v : vertices) { if (v.id().equals(id)) { return true; } @@ -58,9 +58,9 @@ public static boolean containsId(List vertexes, Id id) { return false; } - public static boolean contains(List vertexes, + public static boolean contains(List vertices, FakeVertex fakeVertex) { - for (Vertex v : vertexes) { + for (Vertex v : vertices) { if (fakeVertex.equalsVertex(v)) { return true; }