use of com.baidu.hugegraph.structure.schema.PropertyKey in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testSetCheckExist.
@Test
public void testSetCheckExist() {
SchemaManager schema = schema();
PropertyKey age = schema.propertyKey("age").userdata("min", 0).userdata("max", 100).create();
Assert.assertTrue(age.checkExist());
age.checkExist(false);
Assert.assertFalse(age.checkExist());
}
use of com.baidu.hugegraph.structure.schema.PropertyKey in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testPropertyKeyV58.
@Test
public void testPropertyKeyV58() {
PropertyKey.Builder builder = new PropertyKey.BuilderImpl("name", null);
PropertyKey propertyKey = builder.dataType(DataType.INT).cardinality(Cardinality.SINGLE).userdata("min", 1).userdata("max", 100).build();
PropertyKey.PropertyKeyV58 propertyKeyV58 = propertyKey.switchV58();
String pkV58String = "{name=name, cardinality=SINGLE, " + "dataType=INT, aggregateType=NONE, properties=[]}";
Assert.assertEquals(pkV58String, propertyKeyV58.toString());
Assert.assertEquals(HugeType.PROPERTY_KEY.string(), propertyKeyV58.type());
}
use of com.baidu.hugegraph.structure.schema.PropertyKey in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testPropertyKey.
@Test
public void testPropertyKey() {
PropertyKey.Builder builder = new PropertyKey.BuilderImpl("name", null);
PropertyKey propertyKey = builder.dataType(DataType.INT).cardinality(Cardinality.SINGLE).userdata("min", 1).userdata("max", 100).build();
String pkString = "{name=name, cardinality=SINGLE, dataType=INT, " + "aggregateType=NONE, properties=[], " + "writeType=OLTP}";
Assert.assertEquals(pkString, propertyKey.toString());
Assert.assertEquals(HugeType.PROPERTY_KEY.string(), propertyKey.type());
Assert.assertEquals(0, propertyKey.aggregateType().code());
Assert.assertEquals("none", propertyKey.aggregateType().string());
}
use of com.baidu.hugegraph.structure.schema.PropertyKey in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyTest method testPropertyKeyV46.
@Test
public void testPropertyKeyV46() {
PropertyKey.Builder builder = new PropertyKey.BuilderImpl("name", null);
PropertyKey propertyKey = builder.dataType(DataType.INT).cardinality(Cardinality.SINGLE).userdata("min", 1).userdata("max", 100).build();
PropertyKey.PropertyKeyV46 propertyKeyV46 = propertyKey.switchV46();
String pkV46String = "{name=name, cardinality=SINGLE, " + "dataType=INT, properties=[]}";
Assert.assertEquals(pkV46String, propertyKeyV46.toString());
Assert.assertEquals(HugeType.PROPERTY_KEY.string(), propertyKeyV46.type());
}
use of com.baidu.hugegraph.structure.schema.PropertyKey in project incubator-hugegraph-toolchain by apache.
the class PropertyKeyService method add.
public void add(PropertyKeyEntity entity, int connId) {
HugeClient client = this.client(connId);
PropertyKey propertyKey = convert(entity, client);
client.schema().addPropertyKey(propertyKey);
}
Aggregations