Examples of OGraphDatabase


Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

public class SQLGremlinTest {
  @Test
  public void f() {
    OSQLEngine.getInstance().registerFunction(OSQLFunctionGremlin.NAME, OSQLFunctionGremlin.class);

    OGraphDatabase db = new OGraphDatabase("local:C:/temp/databases/gremlin");
    if (db.exists())
      db.open("admin", "admin");
    else
      db.create();

    // ODocument vertex1 = (ODocument) db.createVertex().field("label", "car").save();
    // ODocument vertex2 = (ODocument) db.createVertex().field("label", "pilot").save();
    // ODocument edge = (ODocument) db.createEdge(vertex1, vertex2).field("label", "drives").save();

    List<?> result = db.query(new OSQLSynchQuery<Object>(
        "select gremlin('current.out.in') as value from V where out.size() > 0 limit 3"));
    System.out.println("Result: " + result);

    result = db.query(new OSQLSynchQuery<Object>("select gremlin('current.out.in') as value from 5:1"));
    System.out.println("Result: " + result);

    db.close();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

  private OGraphDatabase  database;
  private String          url;

  @Parameters(value = "url")
  public GraphDatabaseTest(String iURL) {
    database = new OGraphDatabase(iURL);
    url = iURL;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

  @Override
  public void init() {
    OProfiler.getInstance().startRecording();

    database = new OGraphDatabase(System.getProperty("url")).open("admin", "admin");
    record = database.newInstance();

    database.declareIntent(new OIntentMassiveInsert());
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

  @Override
  public void init() {
    OProfiler.getInstance().startRecording();

    database = new OGraphDatabase(System.getProperty("url")).open("admin", "admin");

    //database = new OGraphDatabase(System.getProperty("url")).create();

    record = database.newInstance();
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

public class SQLGremlinTest {
  @Test
  public void f() {
    OSQLEngine.getInstance().registerFunction(OSQLFunctionGremlin.NAME, OSQLFunctionGremlin.class);

    OGraphDatabase db = new OGraphDatabase("local:C:/temp/databases/gremlin");
    if (db.exists())
      db.open("admin", "admin");
    else
      db.create();

    // ODocument vertex1 = (ODocument) db.createVertex().field("label", "car").save();
    // ODocument vertex2 = (ODocument) db.createVertex().field("label", "pilot").save();
    // ODocument edge = (ODocument) db.createEdge(vertex1, vertex2).field("label", "drives").save();

    List<?> result = db.query(new OSQLSynchQuery<Object>(
        "select gremlin('current.out.in') as value from V where outEdges.size() > 0 limit 3"));
    System.out.println("Result: " + result);

    result = db.query(new OSQLSynchQuery<Object>("select gremlin('current.out.in') as value from 5:1"));
    System.out.println("Result: " + result);

    db.close();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

public class GraphDatabaseTest {
  private OGraphDatabase  database;

  @Parameters(value = "url")
  public GraphDatabaseTest(String iURL) {
    database = new OGraphDatabase(iURL);
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

        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();
        }
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

        return localDocumentTx.get();
    }

    public static OGraphDatabase openGraphDB() {
        if (!hasGraphTx()) {
            OGraphDatabase db = OGraphDatabasePool.global().acquire(
                    (ODBPlugin.gurl == null) ? ODBPlugin.url : ODBPlugin.gurl, ODBPlugin.user, ODBPlugin.passwd);
            localGraphTx.set(db);
            registerListeners(db);
        }
        return localGraphTx.get();
View Full Code Here

Examples of com.orientechnologies.orient.core.db.graph.OGraphDatabase

    private void startup() {
        ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            ClassLoader orientClassLoader = OIndexes.class.getClassLoader();
            Thread.currentThread().setContextClassLoader(orientClassLoader);
            graph = new OGraphDatabase("memory:ekbgraphdb").create();
        } finally {
            Thread.currentThread().setContextClassLoader(origClassLoader);
        }
        Orient.instance().removeShutdownHook();
        graph.createVertexType("Models");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.