assertEquals(database.countClusterElements("Company"), startRecordNumber - 1);
}
@Test
public void graphDB() {
OGraphDatabase database = ODB.openGraphDB();
try {
OClass vehicleClass = database.createVertexType("GraphVehicle");
database.createVertexType("GraphCar", vehicleClass);
database.createVertexType("GraphMotocycle", "GraphVehicle");
ODocument carNode = (ODocument) database.createVertex("GraphCar").field("brand", "Hyundai")
.field("model", "Coupe").field("year", 2003).save();
ODocument motoNode = (ODocument) database.createVertex("GraphMotocycle").field("brand", "Yamaha")
.field("model", "X-City 250").field("year", 2009).save();
database.createEdge(carNode, motoNode).save();
List<ODocument> result = database.query(new OSQLSynchQuery<ODocument>("select from GraphVehicle"));
Assert.assertEquals(result.size(), 2);
for (ODocument v : result) {
Assert.assertTrue(v.getSchemaClass().isSubClassOf(vehicleClass));
}
} finally {
database.close();
}
}