Package com.tinkerpop.frames

Examples of com.tinkerpop.frames.FramedGraphFactory


        logger.debug("loading system graph");
        this.systemGraph = new DendriteGraph(systemGraphId, systemProperties);

        // Create a FramedGraphFactory, which we'll use to wrap our metadata graph vertices and edges.
        this.frameFactory = new FramedGraphFactory(
                new GremlinGroovyModule(),
                new JavaHandlerModule(),
                new TypedGraphModuleBuilder()
                        .withClass(ProjectMetadata.class)
                        .withClass(BranchMetadata.class)
View Full Code Here


  }

  @Before
  public void setup() {
    TinkerGraph base = TinkerGraphFactory.createTinkerGraph();
    g = new FramedGraphFactory(new JavaHandlerModule()).create(base);
   
  }
View Full Code Here

  }

  @Test
  public void testAdditionalTypes() {
    Graph graph = TinkerGraphFactory.createTinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new AbstractModule() {

      @Override
      public void doConfigure(FramedGraphConfiguration config) {
        config.addTypeResolver(new TypeResolver() {

          @Override
          public Class<?>[] resolveTypes(Edge e, Class<?> defaultType) {

            return new Class[] { AdditionalEdge.class };
          }

          @Override
          public Class<?>[] resolveTypes(Vertex v, Class<?> defaultType) {
            return new Class[] { AdditionalVertex.class };
          }
        });
      }
    });
    framedGraph = factory.create(graph);

    Person marko = framedGraph.getVertex(1, Person.class);
    Assert.assertTrue(marko instanceof AdditionalVertex);
    Assert.assertFalse(marko instanceof AdditionalEdge);
View Full Code Here

  }

  @Test
  public void testExtendedTypes() {
    Graph graph = TinkerGraphFactory.createTinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new AbstractModule() {

      @Override
      public void doConfigure(FramedGraphConfiguration config) {
        config.addTypeResolver(new TypeResolver() {

          @Override
          public Class<?>[] resolveTypes(Edge e, Class<?> defaultType) {

            return new Class[0];
          }

          @Override
          public Class<?>[] resolveTypes(Vertex v, Class<?> defaultType) {
            return new Class[] { ExtendedPerson.class };
          }
        });
      }

    });
    framedGraph = factory.create(graph);

    Person marko = framedGraph.getVertex(1, Person.class);
    Assert.assertTrue(marko instanceof ExtendedPerson);

  }
View Full Code Here

public class FramedGraphQueryImplTest {
 
  @Test
  public void testDelegation() {
    GraphQuery mockGraphQuery = mock(GraphQuery.class);
    FramedGraph framedGraph = new FramedGraphFactory().create(null);
   
    FramedGraphQueryImpl query = new FramedGraphQueryImpl(framedGraph, mockGraphQuery);
    stub(mockGraphQuery.has("")).toReturn(mockGraphQuery);
    query.has("");
    verify(mockGraphQuery).has("");
View Full Code Here

TOP

Related Classes of com.tinkerpop.frames.FramedGraphFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.