incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

Encoded uuid primary values to compresse id length

Open Linary opened this issue 6 years ago • 2 comments

Linary avatar Feb 24 '20 03:02 Linary

schema = graph.schema();

        schema.propertyKey("name").asText().ifNotExist().create();
        schema.propertyKey("age").asInt().ifNotExist().create();
        schema.propertyKey("uuid").asUUID().ifNotExist().create();
        schema.propertyKey("city").asText().ifNotExist().create();
        schema.propertyKey("weight").asDouble().ifNotExist().create();
        schema.propertyKey("lang").asText().ifNotExist().create();
        schema.propertyKey("date").asDate().ifNotExist().create();
        schema.propertyKey("price").asInt().ifNotExist().create();

        schema.vertexLabel("person")
              .properties("name", "age", "city", "date", "uuid")
              .primaryKeys("uuid")
              .ifNotExist()
              .create();


        schema.edgeLabel("knows")
              .multiTimes()
              .sourceLabel("person")
              .targetLabel("person")
              .properties("date", "weight")
              .sortKeys("date")
              .nullableKeys("weight")
              .ifNotExist()
              .create();


        Vertex marko = graph.addVertex(T.label, "person", "name", "marko",
                                       "age", 29, "city", "Beijing",
                                       "uuid", "b80d37b4-22e5-4f6d-af5d-a05d1a31de63",
                                       "date", "2020-02-22");
        Vertex vadas = graph.addVertex(T.label, "person", "name", "vadas",
                                       "age", 27, "city", "Hongkong",
                                       "uuid", "266833c7f0b743e08c48eb9b8113e200",
                                       "date", "2020-02-23");
        marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5);

g.V().hasLabel("person").has("uuid", "266833c7f0b743e08c48eb9b8113e200").bothE()
id label source target properties
S111:b80d37b4-22e5-4f6d-af5d-a05d1a31de63>352>7L8c7QG0>S111:266833c7-f0b7-43e0-8c48-eb9b8113e200 knows 111:b80d37b4-22e5-4f6d-af5d-a05d1a31de63 111:266833c7-f0b7-43e0-8c48-eb9b8113e200 {"weight":0.5,"date":"2016-01-10 00:00:00.000"}

javeme avatar Feb 24 '20 04:02 javeme

customize uuid currently is encoded with base64

javeme avatar Feb 24 '20 05:02 javeme