Search in sources :

Example 51 with SchemaManager

use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.

the class GraphsApiTest method initPropertyKey.

protected static void initPropertyKey(HugeClient client) {
    SchemaManager schema = client.schema();
    schema.propertyKey("name").asText().ifNotExist().create();
    schema.propertyKey("age").asInt().ifNotExist().create();
    schema.propertyKey("city").asText().ifNotExist().create();
    schema.propertyKey("lang").asText().ifNotExist().create();
    schema.propertyKey("date").asDate().ifNotExist().create();
    schema.propertyKey("price").asInt().ifNotExist().create();
    schema.propertyKey("weight").asDouble().ifNotExist().create();
}
Also used : SchemaManager(com.baidu.hugegraph.driver.SchemaManager)

Example 52 with SchemaManager

use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.

the class BaseClientTest method initIndexLabel.

protected static void initIndexLabel() {
    SchemaManager schema = schema();
    schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create();
    schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create();
    schema.indexLabel("knowsByDate").onE("knows").by("date").secondary().ifNotExist().create();
    schema.indexLabel("createdByDate").onE("created").by("date").secondary().ifNotExist().create();
}
Also used : SchemaManager(com.baidu.hugegraph.driver.SchemaManager)

Example 53 with SchemaManager

use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.

the class BaseClientTest method initVertexLabel.

protected static void initVertexLabel() {
    SchemaManager schema = schema();
    schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").nullableKeys("city").ifNotExist().create();
    schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").nullableKeys("price").ifNotExist().create();
    schema.vertexLabel("book").useCustomizeStringId().properties("name", "price").nullableKeys("price").ifNotExist().create();
}
Also used : SchemaManager(com.baidu.hugegraph.driver.SchemaManager)

Example 54 with SchemaManager

use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.

the class BaseClientTest method initEdgeLabel.

protected static void initEdgeLabel() {
    SchemaManager schema = schema();
    schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").multiTimes().properties("date", "city").sortKeys("date").nullableKeys("city").ifNotExist().create();
    schema.edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date", "city").nullableKeys("city").ifNotExist().create();
}
Also used : SchemaManager(com.baidu.hugegraph.driver.SchemaManager)

Example 55 with SchemaManager

use of com.baidu.hugegraph.driver.SchemaManager in project incubator-hugegraph-toolchain by apache.

the class BaseClientTest method initPropertyKey.

protected static void initPropertyKey() {
    SchemaManager schema = schema();
    schema.propertyKey("name").asText().ifNotExist().create();
    schema.propertyKey("age").asInt().ifNotExist().create();
    schema.propertyKey("city").asText().ifNotExist().create();
    schema.propertyKey("lang").asText().ifNotExist().create();
    schema.propertyKey("date").asDate().ifNotExist().create();
    schema.propertyKey("price").asInt().ifNotExist().create();
    schema.propertyKey("weight").asDouble().ifNotExist().create();
}
Also used : SchemaManager(com.baidu.hugegraph.driver.SchemaManager)

Aggregations

SchemaManager (com.baidu.hugegraph.driver.SchemaManager)61 Test (org.junit.Test)39 Vertex (com.baidu.hugegraph.structure.graph.Vertex)18 Date (java.util.Date)14 GraphManager (com.baidu.hugegraph.driver.GraphManager)11 IndexLabel (com.baidu.hugegraph.structure.schema.IndexLabel)11 EdgeLabel (com.baidu.hugegraph.structure.schema.EdgeLabel)9 HugeClient (com.baidu.hugegraph.driver.HugeClient)8 BeforeClass (org.junit.BeforeClass)8 PropertyKey (com.baidu.hugegraph.structure.schema.PropertyKey)7 VertexLabel (com.baidu.hugegraph.structure.schema.VertexLabel)6 Edge (com.baidu.hugegraph.structure.graph.Edge)4 ArrayList (java.util.ArrayList)3 PropertyIndex (com.baidu.hugegraph.entity.schema.PropertyIndex)2 Task (com.baidu.hugegraph.structure.Task)2 Result (com.baidu.hugegraph.structure.gremlin.Result)2 ResultSet (com.baidu.hugegraph.structure.gremlin.ResultSet)2 BaseClientTest (com.baidu.hugegraph.BaseClientTest)1 GremlinManager (com.baidu.hugegraph.driver.GremlinManager)1 LoadOptions (com.baidu.hugegraph.loader.executor.LoadOptions)1