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();
}
}
Aggregations