use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testAddVertexLabelWith2PrimaryKey.
@Test
public void testAddVertexLabelWith2PrimaryKey() {
super.initPropertyKeys();
SchemaManager schema = graph().schema();
VertexLabel person = schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name", "age").create();
Assert.assertNotNull(person);
Assert.assertEquals("person", person.name());
Assert.assertEquals(3, person.properties().size());
assertContainsPk(person.properties(), "name", "age", "city");
Assert.assertEquals(2, person.primaryKeys().size());
assertContainsPk(person.primaryKeys(), "name", "age");
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testAddVertexWithAutomaticIdStrategyButPassedPk.
@Test
public void testAddVertexWithAutomaticIdStrategyButPassedPk() {
HugeGraph graph = graph();
SchemaManager schema = graph.schema();
Assert.assertThrows(IllegalArgumentException.class, () -> {
schema.vertexLabel("person").useAutomaticId().properties("name", "age").primaryKeys("name").create();
});
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testAddVertexLabel.
@Test
public void testAddVertexLabel() {
super.initPropertyKeys();
SchemaManager schema = graph().schema();
VertexLabel person = schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").create();
Assert.assertNotNull(person);
Assert.assertEquals("person", person.name());
Assert.assertEquals(3, person.properties().size());
assertContainsPk(person.properties(), "name", "age", "city");
Assert.assertEquals(1, person.primaryKeys().size());
assertContainsPk(person.primaryKeys(), "name");
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testAppendVertexLabelWithNullableKeysInAppendProperties.
@Test
public void testAppendVertexLabelWithNullableKeysInAppendProperties() {
super.initPropertyKeys();
SchemaManager schema = graph().schema();
schema.vertexLabel("person").properties("name", "age").primaryKeys("name").create();
VertexLabel person = schema.vertexLabel("person").properties("city").nullableKeys("city").append();
Assert.assertNotNull(person);
Assert.assertEquals("person", person.name());
Assert.assertEquals(3, person.properties().size());
assertContainsPk(person.properties(), "name", "age", "city");
Assert.assertEquals(1, person.primaryKeys().size());
assertContainsPk(person.primaryKeys(), "name");
Assert.assertEquals(1, person.nullableKeys().size());
assertContainsPk(person.nullableKeys(), "city");
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class VertexLabelCoreTest method testEliminateVertexLabelWithUserdata.
@Test
public void testEliminateVertexLabelWithUserdata() {
super.initPropertyKeys();
SchemaManager schema = graph().schema();
VertexLabel player = schema.vertexLabel("player").properties("name").userdata("super_vl", "person").userdata("icon", "picture1").create();
Assert.assertEquals(3, player.userdata().size());
Assert.assertEquals("person", player.userdata().get("super_vl"));
Assert.assertEquals("picture1", player.userdata().get("icon"));
player = schema.vertexLabel("player").userdata("icon", "").eliminate();
Assert.assertEquals(2, player.userdata().size());
Assert.assertEquals("person", player.userdata().get("super_vl"));
}
Aggregations