use of com.tinkerpop.frames.domain.incidences.CreatedInfo in project frames by tinkerpop.
the class FramedElementTest method testSettingProperties.
@Test
public void testSettingProperties() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);
Person marko = framedGraph.getVertex(1, Person.class);
assertEquals(marko.getName(), "marko");
marko.setName("pavel");
assertEquals(marko.getName(), "pavel");
assertEquals(marko.getAge(), new Integer(29));
marko.setAge(31);
assertEquals(marko.getAge(), new Integer(31));
CreatedInfo markoCreatedLopInfo = framedGraph.getEdge(9, CreatedInfo.class);
assertEquals(markoCreatedLopInfo.getWeight(), 0.4f, 0.1f);
markoCreatedLopInfo.setWeight(99.0f);
assertEquals(markoCreatedLopInfo.getWeight(), 99.0f, 0.1f);
markoCreatedLopInfo.setWeight(0.4f);
// Same with deprecated Domain/Range annotations:
Created markoCreatedLop = framedGraph.getEdge(9, Direction.OUT, Created.class);
assertEquals(markoCreatedLop.getWeight(), 0.4f, 0.1f);
markoCreatedLop.setWeight(99.0f);
assertEquals(markoCreatedLop.getWeight(), 99.0f, 0.1f);
}
use of com.tinkerpop.frames.domain.incidences.CreatedInfo in project frames by tinkerpop.
the class FramedElementTest method testToString.
@Test
public void testToString() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);
Person marko = framedGraph.getVertex(1, Person.class);
assertEquals("v[1]", marko.toString());
CreatedInfo markoCreatedLopInfo = framedGraph.getEdge(9, CreatedInfo.class);
assertEquals("e[9][1-created->3]", markoCreatedLopInfo.toString());
// Using deprecated Domain/Range annotations:
Created markoCreatedLop = framedGraph.getEdge(9, Direction.OUT, Created.class);
assertEquals("e[9][1-created->3]", markoCreatedLop.toString());
}
use of com.tinkerpop.frames.domain.incidences.CreatedInfo 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.CreatedInfo in project frames by tinkerpop.
the class FramedVertexTest method testAddIncidenceIn.
@Test
public void testAddIncidenceIn() {
Project rdfAgents = framedGraph.addVertex(null, Project.class);
CreatedInfo createdInfo = rdfAgents.addCreatedByPersonInfo(marko);
assertEquals(marko, createdInfo.getPerson());
assertEquals(rdfAgents, createdInfo.getProject());
assertEquals(marko, getOnlyElement(rdfAgents.getCreatedByPeople()));
}
use of com.tinkerpop.frames.domain.incidences.CreatedInfo in project frames by tinkerpop.
the class FramedEdgeTest method testGettingOutAndIn.
@Test
public void testGettingOutAndIn() {
assertEquals(marko, knows.getOut());
assertEquals(vadas, knows.getIn());
CreatedInfo created = lop.getCreatedInfo().iterator().next();
assertEquals(lop, created.getProject());
assertTrue(created.getPerson().equals(marko) || created.getPerson().equals(peter) || created.getPerson().equals(josh));
created = marko.getCreatedInfo().iterator().next();
assertEquals(lop, created.getProject());
assertEquals(marko, created.getPerson());
}
Aggregations