use of com.baidu.hugegraph.driver.GraphManager in project incubator-hugegraph-toolchain by apache.
the class NeighborRankApiTest method initNeighborRankGraph.
@BeforeClass
public static void initNeighborRankGraph() {
GraphManager graph = graph();
SchemaManager schema = schema();
schema.propertyKey("name").asText().ifNotExist().create();
schema.vertexLabel("person").properties("name").useCustomizeStringId().ifNotExist().create();
schema.vertexLabel("movie").properties("name").useCustomizeStringId().ifNotExist().create();
schema.edgeLabel("follow").sourceLabel("person").targetLabel("person").ifNotExist().create();
schema.edgeLabel("like").sourceLabel("person").targetLabel("movie").ifNotExist().create();
schema.edgeLabel("directedBy").sourceLabel("movie").targetLabel("person").ifNotExist().create();
Vertex O = graph.addVertex(T.label, "person", T.id, "O", "name", "O");
Vertex A = graph.addVertex(T.label, "person", T.id, "A", "name", "A");
Vertex B = graph.addVertex(T.label, "person", T.id, "B", "name", "B");
Vertex C = graph.addVertex(T.label, "person", T.id, "C", "name", "C");
Vertex D = graph.addVertex(T.label, "person", T.id, "D", "name", "D");
Vertex E = graph.addVertex(T.label, "movie", T.id, "E", "name", "E");
Vertex F = graph.addVertex(T.label, "movie", T.id, "F", "name", "F");
Vertex G = graph.addVertex(T.label, "movie", T.id, "G", "name", "G");
Vertex H = graph.addVertex(T.label, "movie", T.id, "H", "name", "H");
Vertex I = graph.addVertex(T.label, "movie", T.id, "I", "name", "I");
Vertex J = graph.addVertex(T.label, "movie", T.id, "J", "name", "J");
Vertex K = graph.addVertex(T.label, "person", T.id, "K", "name", "K");
Vertex L = graph.addVertex(T.label, "person", T.id, "L", "name", "L");
Vertex M = graph.addVertex(T.label, "person", T.id, "M", "name", "M");
O.addEdge("follow", A);
O.addEdge("follow", B);
O.addEdge("follow", C);
D.addEdge("follow", O);
A.addEdge("follow", B);
A.addEdge("like", E);
A.addEdge("like", F);
B.addEdge("like", G);
B.addEdge("like", H);
C.addEdge("like", I);
C.addEdge("like", J);
E.addEdge("directedBy", K);
F.addEdge("directedBy", B);
F.addEdge("directedBy", L);
G.addEdge("directedBy", M);
}
use of com.baidu.hugegraph.driver.GraphManager in project incubator-hugegraph-toolchain by apache.
the class GraphService method updateVertex.
public Vertex updateVertex(int connId, VertexEntity entity) {
HugeClient client = this.client(connId);
GraphManager graph = client.graph();
Vertex vertex = this.buildVertex(connId, entity);
// TODO: client should add updateVertex() method
return graph.addVertex(vertex);
}
use of com.baidu.hugegraph.driver.GraphManager in project incubator-hugegraph-toolchain by apache.
the class GraphService method updateEdge.
public Edge updateEdge(int connId, EdgeEntity entity) {
HugeClient client = this.client(connId);
GraphManager graph = client.graph();
EdgeHolder edgeHolder = this.buildEdge(connId, entity);
// TODO: client should add updateEdge()
return graph.addEdge(edgeHolder.edge);
}
use of com.baidu.hugegraph.driver.GraphManager in project incubator-hugegraph-toolchain by apache.
the class GraphService method addEdge.
public GraphView addEdge(int connId, EdgeEntity entity) {
HugeClient client = this.client(connId);
GraphManager graph = client.graph();
EdgeHolder edgeHolder = this.buildEdge(connId, entity);
Edge edge = graph.addEdge(edgeHolder.edge);
Vertex source = edgeHolder.source;
Vertex target = edgeHolder.target;
return GraphView.builder().vertices(ImmutableSet.of(source, target)).edges(ImmutableSet.of(edge)).build();
}
use of com.baidu.hugegraph.driver.GraphManager in project incubator-hugegraph-toolchain by apache.
the class RestResultTest method init.
@BeforeClass
public static void init() {
graphManager = Mockito.mock(GraphManager.class);
SimpleModule module = new SimpleModule();
module.addDeserializer(Path.class, new PathDeserializer());
RestResult.registerModule(module);
}
Aggregations