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


Java OClass.createProperty方法代码示例

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


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

示例1: setupTypesAndIndices

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
/**
 * Setup some indices. This is highly orientdb specific and may not be easy so setup using blueprint API.
 */
private void setupTypesAndIndices() {
	try (Tx tx = graph.tx()) {
		OrientGraph g = ((OrientGraph) ((DelegatingFramedOrientGraph) tx.getGraph()).getBaseGraph());
		ODatabaseDocument rawDb = g.getRawDatabase();
		OClass e = rawDb.createEdgeClass("HAS_MEMBER");
		e.createProperty("in", OType.LINK);
		e.createProperty("out", OType.LINK);
		e.createIndex("e.has_member", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "out", "in");

		OClass v = rawDb.createVertexClass(Group.class.getSimpleName());
		v.createProperty("name", OType.STRING);

		v = rawDb.createVertexClass(Person.class.getSimpleName());
		v.createProperty("name", OType.STRING);
		v.createIndex(Person.class.getSimpleName() + ".name", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "name");
		tx.success();
	}

}
 
开发者ID:Syncleus,项目名称:Ferma-OrientDB,代码行数:23,代码来源:IndexTest.java

示例2: createSchemaDB

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
private void createSchemaDB(ODatabaseDocumentTx db)
{
    OSchema schema = db.getMetadata().getSchema();

    // item
    OClass item = schema.createClass("Item");

    item.createProperty("stringKey", OType.STRING).createIndex(OClass.INDEX_TYPE.UNIQUE);
    item.createProperty("intKey", OType.INTEGER).createIndex(OClass.INDEX_TYPE.UNIQUE);
    item.createProperty("date", OType.DATE).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("time", OType.DATETIME).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("text", OType.STRING);
    item.createProperty("length", OType.LONG).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("published", OType.BOOLEAN).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("title", OType.STRING).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("author", OType.STRING).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("tags", OType.EMBEDDEDLIST);

}
 
开发者ID:geekflow,项目名称:light,代码行数:20,代码来源:OrientJdbcTest.java

示例3: initialize

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
public void initialize() {
    // method is called under unit of work (with NOTX transaction mode,
    // because orient "DDL" must be executed in this mode).

    final ODatabaseDocumentTx db = context.getConnection();
    final OSchema schema = db.getMetadata().getSchema();

    // creating class only if it isn't already exists
    // this is very naive approach: normally existing class structure must also be
    // verified and updated if necessary
    if (schema.existsClass(CLASS_NAME)) {
        return;
    }

    final OClass sampleClass = schema.createClass(CLASS_NAME);
    sampleClass.createProperty("name", OType.STRING);
    sampleClass.createProperty("amount", OType.INTEGER);
}
 
开发者ID:xvik,项目名称:guice-persist-orient-examples,代码行数:20,代码来源:ManualSchemeInitializer.java

示例4: defineType

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
protected void defineType(final OClass type) {
  type.createProperty(P_DOMAIN, OType.STRING)
      .setNotNull(true);
  type.createProperty(P_TYPE, OType.STRING)
      .setNotNull(true);
  type.createProperty(P_CONTEXT, OType.STRING)
      .setNotNull(true);
  type.createProperty(P_TIMESTAMP, OType.LONG)
      .setNotNull(true);
  type.createProperty(P_NODE_ID, OType.STRING)
      .setNotNull(true);
  type.createProperty(P_INITIATOR, OType.STRING)
      .setNotNull(true);
  type.createProperty(P_ATTRIBUTES, OType.EMBEDDEDMAP);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:AuditDataEntityAdapter.java

示例5: initDatabase

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }

    final Optional<ODatabaseDocumentTxSupplier> dbSupplier = service.getODatabaseDocumentTxSupplier(CLASS_NAME);
    assertThat(dbSupplier.isPresent(), is(true));

    try (final ODatabase db = dbSupplier.get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:21,代码来源:EmbeddedOrientDBServiceWithSSLTest.java

示例6: setUp

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Before
public void setUp() {
  try (ODatabaseDocumentTx db = componentDatabase.getInstance().connect()) {
    OSchema schema = db.getMetadata().getSchema();

    OClass bucketType = schema.createClass(BUCKET_CLASS);

    OClass componentType = schema.createClass(COMPONENT_CLASS);

    componentType.createProperty(P_GROUP, OType.STRING);
    componentType.createProperty(P_NAME, OType.STRING)
        .setMandatory(true)
        .setNotNull(true);
    componentType.createProperty(P_VERSION, OType.STRING);
    componentType.createProperty(P_BUCKET, OType.LINK, bucketType).setMandatory(true).setNotNull(true);
  }

  underTest = new ComponentDatabaseUpgrade_1_2(componentDatabase.getInstanceProvider());
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:ComponentDatabaseUpgrade_1_2_Test.java

示例7: initDatabase

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }
    try (final ODatabase db = service.getODatabaseDocumentTxSupplier(CLASS_NAME).get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:17,代码来源:OrientDBHazelcastPluginTest.java

示例8: initTableClass

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
private static void initTableClass()
{
    ODatabaseDocumentTx documentTx = factory.getDatabase();
    OSchema schema = documentTx.getMetadata().getSchema();
    OClass oClass = schema.getClass("Classes");

    if (oClass == null)
    {
        oClass = schema.createClass("Classes");
        oClass.createProperty("name", OType.STRING);
        oClass.createProperty("byteCode", OType.BINARY);

        oClass.createIndex("ClassNameUnique", OClass.INDEX_TYPE.UNIQUE, "name");
    }
}
 
开发者ID:geekflow,项目名称:light,代码行数:16,代码来源:RepositoryFactory.java

示例9: init

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
protected void init(OObjectDatabaseTx db, OSchema schema) {
    if (schema.getClass("Filter") == null) {
        OClass filterClass = schema.createClass("Filter");
        filterClass.createProperty("type", OType.STRING);
        filterClass.createProperty("value", OType.STRING);
        filterClass.createIndex("filter.type.indices", OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX, "type");
        filterClass.createIndex("filter.value.indices", OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX, "value");
    }
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:11,代码来源:FiltersOrientDbRepository.java

示例10: init

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
public void init() {
    try (ODatabaseDocumentTx db = docDb()) {
        OSchema schema = db.getMetadata().getSchema();
        if (!schema.existsClass(GCP_CONFIG)) {
            OClass newClass = schema.createClass(GCP_CONFIG);
            newClass.createProperty("hg", OType.STRING);
            newClass.createProperty("map", OType.EMBEDDEDMAP);
            newClass.createIndex("hg.unq", OClass.INDEX_TYPE.UNIQUE, "hg");
            db.commit(true);
            db.command(new OCommandSQL("INSERT INTO " + GCP_CONFIG +
                    " SET hg=\"" + hostGroup + "\", map={}")).execute();
        }
        fetchFromDb(db);
        executor.scheduleAtFixedRate(() -> {
            LOG.info("Trying to reload configuration from main DB.");
            putLock.writeLock().lock();
            try {
                if (!isClosed) {
                    try (ODatabaseDocumentTx _db = docDb()) {
                        fetchFromDb(_db);
                    }
                }
            } finally {
                putLock.writeLock().unlock();
            }
        }, readLong(ConfigProperty.POLL_INTERVAL), readLong(ConfigProperty.POLL_INTERVAL), TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:30,代码来源:OrientDbConfigurationManager.java

示例11: init

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@BeforeClass
public void init() {
  initDB();

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

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

}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:15,代码来源:LuceneSpatialMultiPolygonTest.java

示例12: initClazz

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
public void initClazz(ODatabaseDocumentTx db) {

  OSchemaProxy schema = db.getMetadata().getSchema();
  OClass polygon = schema.createAbstractClass(getName(),superClass(db));
  polygon.createProperty("coordinates", OType.EMBEDDEDLIST, OType.EMBEDDEDLIST);
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:8,代码来源:OMultiPolygonShapeBuilder.java

示例13: defineType

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
protected void defineType(final ODatabaseDocumentTx db, final OClass type) {
  super.defineType(type);
  type.createProperty(P_COMPONENT, OType.LINK, componentEntityAdapter.getSchemaType());
  type.createProperty(P_NAME, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);
  type.createProperty(P_SIZE, OType.LONG);
  type.createProperty(P_CONTENT_TYPE, OType.STRING);
  type.createProperty(P_BLOB_REF, OType.STRING);
  type.createProperty(P_LAST_DOWNLOADED, OType.DATETIME);
  type.createProperty(P_BLOB_CREATED, OType.DATETIME);
  type.createProperty(P_BLOB_UPDATED, OType.DATETIME);
  type.createProperty(P_CREATED_BY, OType.STRING);
  type.createProperty(P_CREATED_BY_IP, OType.STRING);

  ODocument metadata = db.newInstance()
      .field("ignoreNullValues", false)
      .field("mergeKeys", false);
  type.createIndex(I_BUCKET_COMPONENT_NAME, INDEX_TYPE.UNIQUE.name(), null, metadata,
      new String[]{P_BUCKET, P_COMPONENT, P_NAME}
  );
  type.createIndex(I_BUCKET_NAME, INDEX_TYPE.NOTUNIQUE, P_BUCKET, P_NAME);
  type.createIndex(I_COMPONENT, INDEX_TYPE.NOTUNIQUE, P_COMPONENT);

  new OIndexBuilder(type, I_NAME_CASEINSENSITIVE, INDEX_TYPE.NOTUNIQUE)
      .property(P_NAME, OType.STRING)
      .caseInsensitive()
      .build(db);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:31,代码来源:AssetEntityAdapter.java

示例14: initClazz

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@Override
public void initClazz(ODatabaseDocumentTx db) {

  OSchemaProxy schema = db.getMetadata().getSchema();
  OClass multiPoint = schema.createAbstractClass(getName(),superClass(db));
  multiPoint.createProperty(COORDINATES, OType.EMBEDDEDLIST, OType.EMBEDDEDLIST);
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:8,代码来源:OMultiPointShapeBuilder.java

示例15: init

import com.orientechnologies.orient.core.metadata.schema.OClass; //导入方法依赖的package包/类
@BeforeClass
@Override
public void init() {
  super.init();
  OSchema schema = databaseDocumentTx.getMetadata().getSchema();
  OClass v = schema.getClass("V");
  OClass oClass = schema.createClass("Place");
  oClass.setSuperClass(v);
  oClass.createProperty("location", OType.EMBEDDED, schema.getClass("OMultiLineString"));
  oClass.createProperty("name", OType.STRING);

  databaseDocumentTx.command(new OCommandSQL("CREATE INDEX Place.location ON Place(location) SPATIAL ENGINE LUCENE")).execute();
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:14,代码来源:LuceneSpatialMultiLineStringTest.java


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