use of com.tinkerpop.frames.domain.incidences.Knows in project frames by tinkerpop.
the class FramedEdgeTest method setup.
@Before
public void setup() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
framedGraph = new FramedGraphFactory().create(graph);
marko = framedGraph.getVertex(1, Person.class);
vadas = framedGraph.getVertex(2, Person.class);
peter = framedGraph.getVertex(6, Person.class);
josh = framedGraph.getVertex(4, Person.class);
knows = framedGraph.getEdge(7, Knows.class);
lop = framedGraph.getVertex(3, Project.class);
}
use of com.tinkerpop.frames.domain.incidences.Knows in project frames by tinkerpop.
the class FramedGraphTest method testCreateFrameForNonexistantElements.
public void testCreateFrameForNonexistantElements() {
Graph graph = new TinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);
Person vertex = framedGraph.getVertex(-1, Person.class);
Assert.assertNull(vertex);
vertex = framedGraph.frame((Vertex) null, Person.class);
Assert.assertNull(vertex);
Knows edge = framedGraph.getEdge(-1, Knows.class);
Assert.assertNull(edge);
edge = framedGraph.frame((Edge) null, Knows.class);
Assert.assertNull(edge);
}
use of com.tinkerpop.frames.domain.incidences.Knows in project frames by tinkerpop.
the class FramedVertexTest method testAddingIncidences.
@Test
public void testAddingIncidences() {
CreatedInfo markoCreatedRipple = marko.addCreatedInfo(ripple);
assertEquals(newHashSet(markoCreatedRipple, markoCreatedLop), newHashSet(marko.getCreated()));
assertNull(markoCreatedRipple.getWeight());
markoCreatedRipple.setWeight(0.0f);
assertEquals(0.0f, markoCreatedRipple.getWeight(), 0.01f);
Knows markoKnowsPeter = marko.addKnows(peter);
assertEquals(newHashSet(markoKnowsPeter, markoKnowsVadas, markowKnowsJosh), newHashSet(marko.getKnows()));
assertNull(markoKnowsPeter.getWeight());
markoKnowsPeter.setWeight(1.0f);
assertEquals(1.0f, markoKnowsPeter.getWeight(), 0.01f);
}
use of com.tinkerpop.frames.domain.incidences.Knows in project frames by tinkerpop.
the class FramedVertexTest method testAddingAdjacencies.
@Test
public void testAddingAdjacencies() {
marko.addKnowsPerson(peter);
Person bryn = marko.addKnowsNewPerson();
bryn.setName("bryn");
Knows markoKnowsBryn = framedGraph.frame(graph.getEdge(13), Knows.class);
Knows markoKnowsPeter = framedGraph.frame(graph.getEdge(0), Knows.class);
assertEquals(newHashSet(markoKnowsVadas, markowKnowsJosh, markoKnowsPeter, markoKnowsBryn), newHashSet(marko.getKnows()));
marko.addCreatedProject(ripple);
assertEquals(newHashSet(lop, ripple), newHashSet(marko.getCreatedProjects()));
}
use of com.tinkerpop.frames.domain.incidences.Knows in project frames by tinkerpop.
the class FramedVertexTest method testFramingInterfaces.
@Test
public void testFramingInterfaces() {
StandalonePerson marko = framedGraph.frame(graph.getVertex(1), StandalonePerson.class);
assertTrue(marko instanceof VertexFrame);
for (Knows knows : marko.getKnows()) {
assertTrue(knows instanceof EdgeFrame);
}
}
Aggregations