use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class RamTableTest method setup.
@Before
public void setup() {
this.graph = HugeFactory.open(FakeObjects.newConfig());
SchemaManager schema = this.graph.schema();
schema.propertyKey("p3").asText().create();
schema.vertexLabel("vl1").useCustomizeNumberId().create();
schema.vertexLabel("vl2").useCustomizeNumberId().create();
schema.vertexLabel("vl3").useCustomizeStringId().create();
schema.edgeLabel("el1").sourceLabel("vl1").targetLabel("vl1").create();
schema.edgeLabel("el2").sourceLabel("vl2").targetLabel("vl2").create();
schema.edgeLabel("el3").sourceLabel("vl3").targetLabel("vl3").properties("p3").multiTimes().sortKeys("p3").create();
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class TestGraph method initEdgeLabelDefaultCreatedDefault.
public void initEdgeLabelDefaultCreatedDefault(String defaultVL) {
SchemaManager schema = this.graph.schema();
schema.edgeLabel("created").link(defaultVL, defaultVL).properties("weight", "color").nullableKeys("weight", "color").ifNotExist().create();
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class TestGraph method initEdgeLabelPersonCreatedSoftware.
public void initEdgeLabelPersonCreatedSoftware() {
SchemaManager schema = this.graph.schema();
schema.edgeLabel("created").link("person", "software").properties("weight").nullableKeys("weight").ifNotExist().create();
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class TestGraph method initEdgeLabelDefaultKnowsDefault.
public void initEdgeLabelDefaultKnowsDefault(String defaultVL) {
SchemaManager schema = this.graph.schema();
schema.edgeLabel("knows").link(defaultVL, defaultVL).properties("data", "test", "year", "boolean", "float", "double", "string", "integer", "long", "weight", "myEdgeId", "since", "acl", "stars", "aKey", "gremlin.partitionGraphStrategy.partition", "color").nullableKeys("data", "test", "year", "boolean", "float", "double", "string", "integer", "long", "weight", "myEdgeId", "since", "acl", "stars", "aKey", "gremlin.partitionGraphStrategy.partition", "color").ifNotExist().create();
}
use of com.baidu.hugegraph.schema.SchemaManager in project incubator-hugegraph by apache.
the class TestGraph method clearSchema.
@Watched
protected void clearSchema() {
// Clear schema and graph data will be cleared at same time
SchemaManager schema = this.graph.schema();
schema.getIndexLabels().stream().forEach(elem -> {
schema.indexLabel(elem.name()).remove();
});
schema.getEdgeLabels().stream().forEach(elem -> {
schema.edgeLabel(elem.name()).remove();
});
schema.getVertexLabels().stream().forEach(elem -> {
schema.vertexLabel(elem.name()).remove();
});
schema.getPropertyKeys().stream().forEach(elem -> {
schema.propertyKey(elem.name()).remove();
});
TaskScheduler scheduler = this.graph.taskScheduler();
scheduler.tasks(null, -1, null).forEachRemaining(elem -> {
scheduler.delete(elem.id());
});
}
Aggregations