Esempio n. 1
0
  //    @Test
  public void testLazyLoadTableViaVertexHasWithKeyMissingColumn() throws Exception {
    // Create a new sqlgGraph
    SqlgGraph sqlgGraph1 = SqlgGraph.open(configuration);
    // Not entirely sure what this is for, else it seems hazelcast has not yet distributed the map
    Thread.sleep(1000);
    // add a vertex in the old, the new should only see it after a commit
    Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a");
    this.sqlgGraph.tx().commit();
    Assert.assertEquals(1, sqlgGraph1.traversal().V().count().next().intValue());
    Assert.assertEquals(
        1,
        sqlgGraph1
            .traversal()
            .V()
            .has(T.label, "Person")
            .has("name", "a")
            .count()
            .next()
            .intValue());
    Vertex v11 = sqlgGraph1.traversal().V().has(T.label, "Person").<Vertex>has("name", "a").next();
    Assert.assertFalse(v11.property("surname").isPresent());
    // the next alter will lock if this transaction is still active
    sqlgGraph1.tx().rollback();

    // add column in one
    v1.property("surname", "bbb");
    this.sqlgGraph.tx().commit();

    Vertex v12 = sqlgGraph1.addVertex(T.label, "Person", "surname", "ccc");
    Assert.assertEquals("ccc", v12.value("surname"));
    sqlgGraph1.tx().rollback();
    sqlgGraph1.close();
  }
 @Override
 public void map(final Vertex vertex, final MapEmitter<Object, Double> emitter) {
   final Property pageRank = vertex.property(PageRankVertexProgram.PAGE_RANK);
   if (pageRank.isPresent()) {
     emitter.emit(vertex.id(), (Double) pageRank.value());
   }
 }
 @Override
 public void activate(final Collection<TinkerGraphPosLengthMatch> matches) {
   for (final TinkerGraphPosLengthMatch plm : matches) {
     final Vertex segment = plm.getSegment();
     final Integer length = plm.getLength();
     segment.property(LENGTH, -length + 1);
   }
 }