use of com.tinkerpop.blueprints.impls.tg.TinkerGraph in project pentaho-metaverse by pentaho.
the class MetaverseUtilTest method testEnhanceEdge.
@Test
public void testEnhanceEdge() {
Graph graph = new TinkerGraph();
Vertex v1 = graph.addVertex(1);
Vertex v2 = graph.addVertex(2);
Edge edge = graph.addEdge(3, v1, v2, "testLabel");
MetaverseUtil.enhanceEdge(edge);
}
use of com.tinkerpop.blueprints.impls.tg.TinkerGraph in project pentaho-metaverse by pentaho.
the class MetaverseUtilTest method testEnhanceVertex.
@Test
public void testEnhanceVertex() {
Graph graph = new TinkerGraph();
Vertex v1 = graph.addVertex(1);
MetaverseUtil.enhanceVertex(v1);
}
use of com.tinkerpop.blueprints.impls.tg.TinkerGraph in project frames by tinkerpop.
the class TypedGraphModuleTest method testSerializeVertexType.
public void testSerializeVertexType() {
Graph graph = new TinkerGraph();
FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class).withClass(C.class).build());
FramedGraph<Graph> framedGraph = factory.create(graph);
A a = framedGraph.addVertex(null, A.class);
C c = framedGraph.addVertex(null, C.class);
assertEquals("A", ((VertexFrame) a).asVertex().getProperty("type"));
assertEquals("C", ((VertexFrame) c).asVertex().getProperty("type"));
}
use of com.tinkerpop.blueprints.impls.tg.TinkerGraph in project frames by tinkerpop.
the class JavaHandlerTest method setup.
@Before
public void setup() {
TinkerGraph base = TinkerGraphFactory.createTinkerGraph();
g = new FramedGraphFactory(new JavaHandlerModule()).create(base);
}
use of com.tinkerpop.blueprints.impls.tg.TinkerGraph in project gremlin by tinkerpop.
the class GremlinGroovyScriptEngineTest method testBindings.
public void testBindings() throws Exception {
final TinkerGraph g = TinkerGraphFactory.createTinkerGraph();
final ScriptEngine engine = new GremlinGroovyScriptEngine();
assertTrue(engine.eval("g = TinkerGraphFactory.createTinkerGraph()") instanceof TinkerGraph);
assertTrue(engine.get("g") instanceof TinkerGraph);
assertEquals(engine.eval("g.v(1)"), g.getVertex(1));
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
bindings.put("s", "marko");
bindings.put("f", 0.5f);
bindings.put("i", 1);
bindings.put("b", true);
bindings.put("l", 100l);
bindings.put("d", 1.55555d);
assertEquals(g.getEdge(7), engine.eval("g.E.has('weight',f).next()", bindings));
assertEquals(g.getVertex(1), engine.eval("g.V.has('name',s).next()", bindings));
assertEquals(g.getVertex(1), engine.eval("g.V.sideEffect{it.bbb=it.name=='marko'}.iterate();g.V.has('bbb',b).next()", bindings));
assertEquals(g.getVertex(1), engine.eval("g.V.sideEffect{it.iii=it.name=='marko'?1:0}.iterate();g.V.has('iii',i).next()", bindings));
assertEquals(g.getVertex(1), engine.eval("g.V.sideEffect{it.lll=it.name=='marko'?100l:0l}.iterate();g.V.has('lll',l).next()", bindings));
assertEquals(g.getVertex(1), engine.eval("g.V.sideEffect{it.ddd=it.name=='marko'?1.55555d:0}.iterate();g.V.has('ddd',d).next()", bindings));
}
Aggregations