org.umlg.sqlg.test.gremlincompile.TestGraphStepOrderBy Maven / Gradle / Ivy
package org.umlg.sqlg.test.gremlincompile;
import org.apache.tinkerpop.gremlin.process.traversal.Order;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Assert;
import org.junit.Test;
import org.umlg.sqlg.test.BaseTest;
import java.util.List;
import java.util.Map;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.select;
/**
* Created by pieter on 2015/08/22.
*/
public class TestGraphStepOrderBy extends BaseTest {
// @Test
// public void testOrderBy() {
// Vertex a1 = this.sqlgGraph.addVertex(T.label, "A", "name", "a", "surname", "a");
// Vertex a2 = this.sqlgGraph.addVertex(T.label, "A", "name", "a", "surname", "b");
// Vertex a3 = this.sqlgGraph.addVertex(T.label, "A", "name", "a", "surname", "c");
// Vertex b1 = this.sqlgGraph.addVertex(T.label, "A", "name", "b", "surname", "a");
// Vertex b2 = this.sqlgGraph.addVertex(T.label, "A", "name", "b", "surname", "b");
// Vertex b3 = this.sqlgGraph.addVertex(T.label, "A", "name", "b", "surname", "c");
// this.sqlgGraph.tx().commit();
//
// List result = this.sqlgGraph.traversal().V().hasLabel("A")
// .order()
// .by("name", Order.incr).by("surname", Order.decr)
// .toList();
//
// Assert.assertEquals(6, result.size());
// Assert.assertEquals(a3, result.get(0));
// Assert.assertEquals(a2, result.get(1));
// Assert.assertEquals(a1, result.get(2));
// Assert.assertEquals(b3, result.get(3));
// Assert.assertEquals(b2, result.get(4));
// Assert.assertEquals(b1, result.get(5));
// }
@Test
public void testOrderBy2() {
Vertex group = this.sqlgGraph.addVertex(T.label, "Group", "name", "MTN");
Vertex network = this.sqlgGraph.addVertex(T.label, "Network", "name", "SouthAfrica");
Vertex networkSoftwareVersion = this.sqlgGraph.addVertex(T.label, "NetworkSoftwareVersion", "name", "SouthAfricaHuawei");
group.addEdge("groupNetwork", network);
network.addEdge("networkNetworkSoftwareVersion", networkSoftwareVersion);
Vertex networkNodeGroupBsc = this.sqlgGraph.addVertex(T.label, "NetworkNodeGroup", "name", "BSC");
Vertex networkNodeGroupRnc = this.sqlgGraph.addVertex(T.label, "NetworkNodeGroup", "name", "RNC");
networkSoftwareVersion.addEdge("networkSoftwareVersionNetworkNodeGroup", networkNodeGroupBsc);
networkSoftwareVersion.addEdge("networkSoftwareVersionNetworkNodeGroup", networkNodeGroupRnc);
Vertex bsc1 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "BSCA");
Vertex bsc2 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "BSCB");
Vertex bsc3 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "BSCC");
Vertex bsc4 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "BSCD");
Vertex rnc1 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "RNCA");
Vertex rnc2 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "RNCB");
Vertex rnc3 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "RNCC");
Vertex rnc4 = this.sqlgGraph.addVertex(T.label, "NetworkNode", "name", "RNCD");
networkNodeGroupBsc.addEdge("networkNodeGroupNetworkNode", bsc1);
networkNodeGroupBsc.addEdge("networkNodeGroupNetworkNode", bsc2);
networkNodeGroupBsc.addEdge("networkNodeGroupNetworkNode", bsc3);
networkNodeGroupBsc.addEdge("networkNodeGroupNetworkNode", bsc4);
networkNodeGroupRnc.addEdge("networkNodeGroupNetworkNode", rnc1);
networkNodeGroupRnc.addEdge("networkNodeGroupNetworkNode", rnc2);
networkNodeGroupRnc.addEdge("networkNodeGroupNetworkNode", rnc3);
networkNodeGroupRnc.addEdge("networkNodeGroupNetworkNode", rnc4);
this.sqlgGraph.tx().commit();
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy