本文整理汇总了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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}