Creating Frames

Bryn Cooke edited this page Nov 4, 2013 · 11 revisions

When you develop a Frames-annotation Java interface, you provide it “life” by binding it to the underlying Blueprints graph. To make this binding, the FramedGraph is used. In FramedGraph there are a collection of helpful methods which are demonstrated using the toy graph diagrammed below and the example Java code.

Graph graph = ... // get a reference to the graph
FramedGraphFactory factory = new FramedGraphFactory(); // make sure you reuse the factory when creating new framed graphs.
FramedGraph<Graph> framedGraph = factory.create(graph); // wrap the base graph

Person marko = framedGraph.getVertex(1, Person.class);
Person peter = framedGraph.getVertex(6, Person.class);
Iterable<Project> javaProjects = framedGraph.getVertices("lang","java", Project.class);

Knows markoKnowsVadas = framedGraph.getEdge(7, Knows.class);
Knows markoKnowsJosh = framedGraph.getEdge(8, Knows.class);