use of com.tinkerpop.blueprints.impls.orient.OrientGraph in project orientdb by orientechnologies.
the class IndexTest method testNullIteration.
public void testNullIteration() {
ODatabaseDocumentTx database = (ODatabaseDocumentTx) this.database.getUnderlying();
OrientGraph graph = new OrientGraph(database, false);
OClass v = database.getMetadata().getSchema().getClass("V");
OClass testNullIteration = database.getMetadata().getSchema().createClass("NullIterationTest", v);
testNullIteration.createProperty("name", OType.STRING);
testNullIteration.createProperty("birth", OType.DATETIME);
database.command(new OCommandSQL("CREATE VERTEX NullIterationTest SET name = 'Andrew', birth = sysdate()")).execute();
database.command(new OCommandSQL("CREATE VERTEX NullIterationTest SET name = 'Marcel', birth = sysdate()")).execute();
database.command(new OCommandSQL("CREATE VERTEX NullIterationTest SET name = 'Olivier'")).execute();
ODocument metadata = new ODocument();
metadata.field("ignoreNullValues", false);
testNullIteration.createIndex("NullIterationTestIndex", INDEX_TYPE.NOTUNIQUE.name(), null, metadata, new String[] { "birth" });
List<ODocument> result = database.query(new OSQLSynchQuery<ODocument>("SELECT FROM NullIterationTest ORDER BY birth ASC"));
Assert.assertEquals(result.size(), 3);
result = database.query(new OSQLSynchQuery<ODocument>("SELECT FROM NullIterationTest ORDER BY birth DESC"));
Assert.assertEquals(result.size(), 3);
result = database.query(new OSQLSynchQuery<ODocument>("SELECT FROM NullIterationTest"));
Assert.assertEquals(result.size(), 3);
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraph in project orientdb by orientechnologies.
the class SQLCreateVertexTest method testIsClassName.
public void testIsClassName() {
OrientGraph graph = new OrientGraph(database, false);
graph.shutdown();
database.open("admin", "admin");
graph.createVertexType("Like").createProperty("anything", OType.STRING);
graph.createVertexType("Is").createProperty("anything", OType.STRING);
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraph in project orientdb by orientechnologies.
the class SQLCreateVertexTest method testCreateVertexBooleanProp.
public void testCreateVertexBooleanProp() {
OrientGraph graph = new OrientGraph(database, false);
graph.shutdown();
database.open("admin", "admin");
database.command(new OCommandSQL("create vertex set script = true")).execute();
database.command(new OCommandSQL("create vertex")).execute();
database.command(new OCommandSQL("create vertex V")).execute();
// TODO complete this!
// database.command(new OCommandSQL("create vertex set")).execute();
// database.command(new OCommandSQL("create vertex set set set = 1")).execute();
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraph in project orientdb by orientechnologies.
the class TransactionConsistencyTest method testQueryIsolation.
@Test
public void testQueryIsolation() {
OrientGraph graph = new OrientGraph(url);
try {
graph.addVertex(null, "purpose", "testQueryIsolation");
if (!url.startsWith("remote")) {
List<OIdentifiable> result = graph.getRawGraph().query(new OSQLSynchQuery<Object>("select from V where purpose = 'testQueryIsolation'"));
Assert.assertEquals(result.size(), 1);
}
graph.commit();
List<OIdentifiable> result = graph.getRawGraph().query(new OSQLSynchQuery<Object>("select from V where purpose = 'testQueryIsolation'"));
Assert.assertEquals(result.size(), 1);
} finally {
graph.shutdown();
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientGraph in project orientdb by orientechnologies.
the class OGraphBatchInsertTest method testHoles.
public void testHoles() {
String dbUrl = "memory:batchinsert_testHoles";
OGraphBatchInsert batch = new OGraphBatchInsert(dbUrl, "admin", "admin");
batch.setParallel(1);
batch.begin();
batch.createEdge(0L, 1L, null);
batch.createEdge(1L, 3L, null);
batch.createEdge(3L, 4L, null);
Map<String, Object> vertexProps = new HashMap<String, Object>();
vertexProps.put("foo", "aa");
batch.setVertexProperties(3L, vertexProps);
vertexProps.put("foo", "bar");
batch.setVertexProperties(4L, vertexProps);
batch.end();
OrientGraph g = new OrientGraph(dbUrl, "admin", "admin");
Iterable<Vertex> result = g.command(new OSQLSynchQuery<Vertex>("select expand(out().in().out().out().in().out().out().in().out()) from V where uid = ?")).execute(0L);
boolean found = false;
for (Vertex v : result) {
assertFalse(found);
assertEquals("bar", v.getProperty("foo"));
found = true;
}
assertTrue(found);
g.shutdown();
}
Aggregations