当前位置: 首页>>代码示例>>Java>>正文


Java ODatabaseDocumentTx.drop方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.drop方法的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentTx.drop方法的具体用法?Java ODatabaseDocumentTx.drop怎么用?Java ODatabaseDocumentTx.drop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx的用法示例。


在下文中一共展示了ODatabaseDocumentTx.drop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: boundingBoxTestNew

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void boundingBoxTestNew() {

  ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:test");

  db.create();

  try {

    // Shape parse = JtsSpatialContext.GEO
    // .getWktShapeParser()
    // .parse(
    // "POLYGON((-83.757293 42.281164, -83.749274 42.281164, -83.749274 42.275227, -83.757293 42.275227, -83.757293 42.281164))");

    Shape parse = JtsSpatialContext.GEO
        .makeRectangle(-83.7662120858887,-83.71986351411135, 42.26531323615103, 42.29239784478525);
    Point point = JtsSpatialContext.GEO.makePoint(-83.7605452, 42.2814837);

    point.relate(parse);

  } catch (Exception e) {
    e.printStackTrace();
  } finally {
    db.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:27,代码来源:LuceneSpatialMemoryTest.java

示例2: connect

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public OrientConnection connect() throws Exception {
    final OrientGraphFactory graphFactory = new OrientGraphFactory(url.toString(), userName, password);

    final ODatabaseDocumentTx database = graphFactory.getDatabase(false, false);
    if (database.exists()) {
        database.open(userName, password);
        database.drop();
    }

    graphFactory.setAutoStartTx(false);
    graphFactory.declareIntent(new OIntentMassiveInsert().setEnableCache(false));

    return new AbstractOrientConnection(graphFactory.getNoTx()) {
        @Override
        public void close() throws Exception {
            graph.commit();
            graph.getRawGraph().close();
        }
    };
}
 
开发者ID:gsson,项目名称:dependency-grapher,代码行数:21,代码来源:OrientDB.java

示例3: testPointTransactionRollBack

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void testPointTransactionRollBack() {

  ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:txPoint");

  try {
    db.create();

    OSchema schema = db.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass oClass = schema.createClass("City");
    oClass.setSuperClass(v);
    oClass.createProperty("location", OType.EMBEDDED, schema.getClass("OPoint"));
    oClass.createProperty("name", OType.STRING);

    db.command(new OCommandSQL("CREATE INDEX City.location ON City(location) SPATIAL ENGINE LUCENE")).execute();

    OIndex idx = db.getMetadata().getIndexManager().getIndex("City.location");
    ODocument rome = newCity("Rome", 12.5, 41.9);
    ODocument london = newCity("London", -0.1275, 51.507222);

    db.begin();

    db.command(new OCommandSQL("insert into City set name = 'Test' , location = ST_GeomFromText('" + PWKT + "')")).execute();
    db.save(rome);
    db.save(london);
    String query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(1, docs.size());
    Assert.assertEquals(3, idx.getSize());
    db.rollback();

    query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(0, docs.size());
    Assert.assertEquals(0, idx.getSize());
  } finally {
    db.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:41,代码来源:LuceneTransactionGeoQueryTest.java

示例4: dropDb

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private void dropDb() {
  ODatabaseDocumentTx db = database.getInstance().connect();
  db.drop();
  assertFalse(db.exists());
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:6,代码来源:DatabaseExternalizerTest.java

示例5: testPointTransactionUpdate

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void testPointTransactionUpdate() {

  ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:txPoint");

  try {
    db.create();

    OSchema schema = db.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass oClass = schema.createClass("City");
    oClass.setSuperClass(v);
    oClass.createProperty("location", OType.EMBEDDED, schema.getClass("OPoint"));
    oClass.createProperty("name", OType.STRING);

    db.command(new OCommandSQL("CREATE INDEX City.location ON City(location) SPATIAL ENGINE LUCENE")).execute();

    OIndex idx = db.getMetadata().getIndexManager().getIndex("City.location");
    ODocument rome = newCity("Rome", 12.5, 41.9);

    db.begin();

    db.save(rome);

    db.commit();

    String query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(0, docs.size());
    Assert.assertEquals(1, idx.getSize());

    db.begin();

    db.command(new OCommandSQL("update City set location = ST_GeomFromText('" + PWKT + "')")).execute();

    query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(1, docs.size());
    Assert.assertEquals(1, idx.getSize());

    db.commit();

    query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(1, docs.size());
    Assert.assertEquals(1, idx.getSize());

  } finally {
    db.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:52,代码来源:LuceneTransactionGeoQueryTest.java

示例6: shutdown

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private void shutdown(boolean delete) throws Exception {
	if (pool == null || pool.isClosed()) {
		return;
	}

	ODatabaseDocumentTx db = getGraphNoCreate();
	if (delete) {
		discardDirty();
	} else {
		saveDirty();
	}

	synchronized (allConns) {
		// Close all other connections
		for (ODatabaseDocumentTx conn : allConns) {
			if (conn != db) {
				pool.invalidateObject(conn);
			}
		}
		dbConn.get().activateOnCurrentThread();

		/*
		 * We want to completely close the database (e.g. so we can delete
		 * the directory later from the Hawk UI).
		 */
		final OStorage storage = db.getStorage();
		if (delete) {
			db.drop();
		} else {
			db.close();
		}
		storage.close(true, false);
		Orient.instance().unregisterStorage(storage);
		pool.invalidateObject(db);

		if (delete && storageFolder != null) {
			try {
				deleteRecursively(storageFolder);
			} catch (IOException e) {
				console.printerrln(e);
			}
		}

		pool.clear();
	}

	metamodelIndex = fileIndex = null;
	storageFolder = tempFolder = null;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:50,代码来源:OrientDatabase.java

示例7: boundingBoxTest

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void boundingBoxTest() {

  ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:test");

  db.create();

  try {

    OClass point = db.getMetadata().getSchema().createClass("Point");
    point.createProperty("latitude", OType.DOUBLE);
    point.createProperty("longitude", OType.DOUBLE);

    db.command(new OCommandSQL("CREATE INDEX Point.ll ON Point(latitude,longitude) SPATIAL ENGINE LUCENE")).execute();

    ODocument document = new ODocument("Point");

    document.field("latitude", 42.2814837);
    document.field("longitude", -83.7605452);

    db.save(document);

    List<?> query = db
        .query(new OSQLSynchQuery<ODocument>(
            "SELECT FROM Point WHERE [latitude, longitude] WITHIN [[42.26531323615103,-83.71986351411135],[42.29239784478525,-83.7662120858887]]"));

    Assert.assertEquals(query.size(), 1);
  } finally {
    db.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:32,代码来源:LuceneSpatialMemoryTest.java


注:本文中的com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.drop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。