Search in sources :

Example 1 with SchemaViolationException

use of org.janusgraph.core.SchemaViolationException in project janusgraph by JanusGraph.

the class JanusGraphTest method testRelationTypeIndexes.

@Test
public void testRelationTypeIndexes() {
    PropertyKey weight = makeKey("weight", Float.class);
    PropertyKey time = makeKey("time", Long.class);
    PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.LIST).make();
    EdgeLabel connect = mgmt.makeEdgeLabel("connect").signature(time).make();
    EdgeLabel child = mgmt.makeEdgeLabel("child").multiplicity(Multiplicity.ONE2MANY).make();
    EdgeLabel link = mgmt.makeEdgeLabel("link").unidirected().make();
    RelationTypeIndex name1 = mgmt.buildPropertyIndex(name, "weightDesc", weight);
    RelationTypeIndex connect1 = mgmt.buildEdgeIndex(connect, "weightAsc", Direction.BOTH, incr, weight);
    RelationTypeIndex connect2 = mgmt.buildEdgeIndex(connect, "weightDesc", Direction.OUT, decr, weight);
    RelationTypeIndex connect3 = mgmt.buildEdgeIndex(connect, "time+weight", Direction.OUT, decr, time, weight);
    RelationTypeIndex child1 = mgmt.buildEdgeIndex(child, "time", Direction.OUT, time);
    RelationTypeIndex link1 = mgmt.buildEdgeIndex(link, "time", Direction.OUT, time);
    final String name1n = name1.name(), connect1n = connect1.name(), connect2n = connect2.name(), connect3n = connect3.name(), child1n = child1.name(), link1n = link1.name();
    // ########### INSPECTION & FAILURE ##############
    assertTrue(mgmt.containsRelationIndex(name, "weightDesc"));
    assertTrue(mgmt.containsRelationIndex(connect, "weightDesc"));
    assertFalse(mgmt.containsRelationIndex(child, "weightDesc"));
    assertEquals("time+weight", mgmt.getRelationIndex(connect, "time+weight").name());
    assertNotNull(mgmt.getRelationIndex(link, "time"));
    assertNull(mgmt.getRelationIndex(name, "time"));
    assertEquals(1, Iterables.size(mgmt.getRelationIndexes(child)));
    assertEquals(3, Iterables.size(mgmt.getRelationIndexes(connect)));
    assertEquals(0, Iterables.size(mgmt.getRelationIndexes(weight)));
    try {
        // Name already exists
        mgmt.buildEdgeIndex(connect, "weightAsc", Direction.OUT, time);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    // } catch (IllegalArgumentException e) {}
    try {
        // Not valid in this direction due to multiplicity constraint
        mgmt.buildEdgeIndex(child, "blablub", Direction.IN, time);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Not valid in this direction due to unidirectionality
        mgmt.buildEdgeIndex(link, "blablub", Direction.BOTH, time);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // ########## END INSPECTION ###########
    finishSchema();
    weight = mgmt.getPropertyKey("weight");
    time = mgmt.getPropertyKey("time");
    name = mgmt.getPropertyKey("name");
    connect = mgmt.getEdgeLabel("connect");
    child = mgmt.getEdgeLabel("child");
    link = mgmt.getEdgeLabel("link");
    // ########### INSPECTION & FAILURE (copied from above) ##############
    assertTrue(mgmt.containsRelationIndex(name, "weightDesc"));
    assertTrue(mgmt.containsRelationIndex(connect, "weightDesc"));
    assertFalse(mgmt.containsRelationIndex(child, "weightDesc"));
    assertEquals("time+weight", mgmt.getRelationIndex(connect, "time+weight").name());
    assertNotNull(mgmt.getRelationIndex(link, "time"));
    assertNull(mgmt.getRelationIndex(name, "time"));
    assertEquals(1, Iterables.size(mgmt.getRelationIndexes(child)));
    assertEquals(3, Iterables.size(mgmt.getRelationIndexes(connect)));
    assertEquals(0, Iterables.size(mgmt.getRelationIndexes(weight)));
    try {
        // Name already exists
        mgmt.buildEdgeIndex(connect, "weightAsc", Direction.OUT, time);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    // } catch (IllegalArgumentException e) {}
    try {
        // Not valid in this direction due to multiplicity constraint
        mgmt.buildEdgeIndex(child, "blablub", Direction.IN, time);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Not valid in this direction due to unidirectionality
        mgmt.buildEdgeIndex(link, "blablub", Direction.BOTH, time);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // ########## END INSPECTION ###########
    mgmt.rollback();
    /*
        ########## TEST WITHIN TRANSACTION ##################
        */
    weight = tx.getPropertyKey("weight");
    time = tx.getPropertyKey("time");
    final int numV = 100;
    JanusGraphVertex v = tx.addVertex();
    JanusGraphVertex[] ns = new JanusGraphVertex[numV];
    for (int i = 0; i < numV; i++) {
        double w = (i * 0.5) % 5;
        long t = (i + 77) % numV;
        VertexProperty p = v.property("name", "v" + i, "weight", w, "time", t);
        ns[i] = tx.addVertex();
        for (String label : new String[] { "connect", "child", "link" }) {
            Edge e = v.addEdge(label, ns[i], "weight", w, "time", t);
        }
    }
    JanusGraphVertex u = ns[0];
    VertexList vl;
    // ######### QUERIES ##########
    v = getV(tx, v);
    u = getV(tx, u);
    evaluateQuery(v.query().keys("name").has("weight", Cmp.GREATER_THAN, 3.6), PROPERTY, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").has("weight", Cmp.LESS_THAN, 0.9).orderBy("weight", incr), PROPERTY, 2 * numV / 10, 1, new boolean[] { true, true }, weight, Order.ASC);
    evaluateQuery(v.query().keys("name").interval("weight", 1.1, 2.2).orderBy("weight", decr).limit(numV / 10), PROPERTY, numV / 10, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name").has("time", Cmp.EQUAL, 5).orderBy("weight", decr), PROPERTY, 1, 1, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name"), PROPERTY, numV, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, 5), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(BOTH).has("time", Cmp.EQUAL, 5), EDGE, 1, 2, new boolean[0]);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", 10, 20).orderBy("weight", decr).limit(5), EDGE, 5, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(BOTH).interval("weight", 0.0, 1.0).orderBy("weight", decr), EDGE, 2 * numV / 10, 2, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("weight", 0.0, 1.0), EDGE, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("child").direction(BOTH), EDGE, numV, 1, new boolean[] { true, true });
    vl = v.query().labels("child").direction(BOTH).vertexIds();
    assertEquals(numV, vl.size());
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("child").interval("weight", 0.0, 1.0).direction(OUT), EDGE, 2 * numV / 10, 1, new boolean[] { false, true });
    vl = v.query().labels("child").interval("weight", 0.0, 1.0).direction(OUT).vertexIds();
    assertEquals(2 * numV / 10, vl.size());
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("child").interval("time", 70, 80).direction(OUT).orderBy("time", incr), EDGE, 10, 1, new boolean[] { true, true }, time, Order.ASC);
    vl = v.query().labels("child").interval("time", 70, 80).direction(OUT).orderBy("time", incr).vertexIds();
    assertEquals(10, vl.size());
    assertFalse(vl.isSorted());
    assertFalse(isSortedByID(vl));
    vl.sort();
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("connect").has("time", Cmp.EQUAL, 5).interval("weight", 0.0, 5.0).direction(OUT), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").has("time", Cmp.EQUAL, 5).interval("weight", 0.0, 5.0).direction(BOTH), EDGE, 1, 2, new boolean[0]);
    evaluateQuery(v.query().labels("connect").interval("time", 10, 20).interval("weight", 0.0, 5.0).direction(OUT), EDGE, 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).orderBy("weight", incr).limit(10), EDGE, 10, 1, new boolean[] { true, true }, weight, Order.ASC);
    evaluateQuery(v.query().labels("connect").direction(OUT).orderBy("weight", decr).limit(10), EDGE, 10, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("weight", 1.4, 2.75).orderBy("weight", decr), EDGE, 3 * numV / 10, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).has("time", Cmp.EQUAL, 22).orderBy("weight", decr), EDGE, 1, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).has("time", Cmp.EQUAL, 22).orderBy("weight", incr), EDGE, 1, 1, new boolean[] { true, false }, weight, Order.ASC);
    evaluateQuery(v.query().labels("connect").direction(OUT).adjacent(u), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).has("weight", Cmp.EQUAL, 0.0).adjacent(u), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("weight", 0.0, 1.0).adjacent(u), EDGE, 1, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("time", 50, 100).adjacent(u), EDGE, 1, 1, new boolean[] { false, true });
    evaluateQuery(v.query(), RELATION, numV * 4, 1, new boolean[] { true, true });
    evaluateQuery(v.query().direction(OUT), RELATION, numV * 4, 1, new boolean[] { false, true });
    // --------------
    clopen();
    weight = tx.getPropertyKey("weight");
    time = tx.getPropertyKey("time");
    // ######### QUERIES (copied from above) ##########
    v = getV(tx, v);
    u = getV(tx, u);
    evaluateQuery(v.query().keys("name").has("weight", Cmp.GREATER_THAN, 3.6), PROPERTY, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").has("weight", Cmp.LESS_THAN, 0.9).orderBy("weight", incr), PROPERTY, 2 * numV / 10, 1, new boolean[] { true, true }, weight, Order.ASC);
    evaluateQuery(v.query().keys("name").interval("weight", 1.1, 2.2).orderBy("weight", decr).limit(numV / 10), PROPERTY, numV / 10, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name").has("time", Cmp.EQUAL, 5).orderBy("weight", decr), PROPERTY, 1, 1, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name"), PROPERTY, numV, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, 5), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(BOTH).has("time", Cmp.EQUAL, 5), EDGE, 1, 2, new boolean[0]);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", 10, 20).orderBy("weight", decr).limit(5), EDGE, 5, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(BOTH).interval("weight", 0.0, 1.0).orderBy("weight", decr), EDGE, 2 * numV / 10, 2, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("weight", 0.0, 1.0), EDGE, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("child").direction(BOTH), EDGE, numV, 1, new boolean[] { true, true });
    vl = v.query().labels("child").direction(BOTH).vertexIds();
    assertEquals(numV, vl.size());
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("child").interval("weight", 0.0, 1.0).direction(OUT), EDGE, 2 * numV / 10, 1, new boolean[] { false, true });
    vl = v.query().labels("child").interval("weight", 0.0, 1.0).direction(OUT).vertexIds();
    assertEquals(2 * numV / 10, vl.size());
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("child").interval("time", 70, 80).direction(OUT).orderBy("time", incr), EDGE, 10, 1, new boolean[] { true, true }, time, Order.ASC);
    vl = v.query().labels("child").interval("time", 70, 80).direction(OUT).orderBy("time", incr).vertexIds();
    assertEquals(10, vl.size());
    assertFalse(vl.isSorted());
    assertFalse(isSortedByID(vl));
    vl.sort();
    assertTrue(vl.isSorted());
    assertTrue(isSortedByID(vl));
    evaluateQuery(v.query().labels("connect").has("time", Cmp.EQUAL, 5).interval("weight", 0.0, 5.0).direction(OUT), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").has("time", Cmp.EQUAL, 5).interval("weight", 0.0, 5.0).direction(BOTH), EDGE, 1, 2, new boolean[0]);
    evaluateQuery(v.query().labels("connect").interval("time", 10, 20).interval("weight", 0.0, 5.0).direction(OUT), EDGE, 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).orderBy("weight", incr).limit(10), EDGE, 10, 1, new boolean[] { true, true }, weight, Order.ASC);
    evaluateQuery(v.query().labels("connect").direction(OUT).orderBy("weight", decr).limit(10), EDGE, 10, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("weight", 1.4, 2.75).orderBy("weight", decr), EDGE, 3 * numV / 10, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).has("time", Cmp.EQUAL, 22).orderBy("weight", decr), EDGE, 1, 1, new boolean[] { true, true }, weight, Order.DESC);
    evaluateQuery(v.query().labels("connect").direction(OUT).has("time", Cmp.EQUAL, 22).orderBy("weight", incr), EDGE, 1, 1, new boolean[] { true, false }, weight, Order.ASC);
    evaluateQuery(v.query().labels("connect").direction(OUT).adjacent(u), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).has("weight", Cmp.EQUAL, 0.0).adjacent(u), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("weight", 0.0, 1.0).adjacent(u), EDGE, 1, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("connect").direction(OUT).interval("time", 50, 100).adjacent(u), EDGE, 1, 1, new boolean[] { false, true });
    evaluateQuery(v.query(), RELATION, numV * 4, 1, new boolean[] { true, true });
    evaluateQuery(v.query().direction(OUT), RELATION, numV * 4, 1, new boolean[] { false, true });
    // Update in transaction
    for (Object o : v.query().labels("name").properties()) {
        JanusGraphVertexProperty<String> p = (JanusGraphVertexProperty<String>) o;
        if (p.<Long>value("time") < (numV / 2))
            p.remove();
    }
    for (Object o : v.query().direction(BOTH).edges()) {
        JanusGraphEdge e = (JanusGraphEdge) o;
        if (e.<Long>value("time") < (numV / 2))
            e.remove();
    }
    ns = new JanusGraphVertex[numV * 3 / 2];
    for (int i = numV; i < numV * 3 / 2; i++) {
        double w = (i * 0.5) % 5;
        v.property("name", "v" + i, "weight", w, "time", (long) i);
        ns[i] = tx.addVertex();
        for (String label : new String[] { "connect", "child", "link" }) {
            JanusGraphEdge e = v.addEdge(label, ns[i], "weight", w, "time", (long) i);
        }
    }
    // ######### UPDATED QUERIES ##########
    evaluateQuery(v.query().keys("name").has("weight", Cmp.GREATER_THAN, 3.6), PROPERTY, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").interval("time", numV / 2 - 10, numV / 2 + 10), PROPERTY, 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").interval("time", numV / 2 - 10, numV / 2 + 10).orderBy("weight", decr), PROPERTY, 10, 1, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name").interval("time", numV, numV + 10).limit(5), PROPERTY, 5, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, 5), EDGE, 0, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, numV + 5), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", 10, 20).orderBy("weight", decr).limit(5), EDGE, 0, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", numV + 10, numV + 20).orderBy("weight", decr).limit(5), EDGE, 5, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query(), RELATION, numV * 4, 1, new boolean[] { true, true });
    evaluateQuery(v.query().direction(OUT), RELATION, numV * 4, 1, new boolean[] { false, true });
    // ######### END UPDATED QUERIES ##########
    newTx();
    weight = tx.getPropertyKey("weight");
    time = tx.getPropertyKey("time");
    v = getV(tx, v);
    u = getV(tx, u);
    // ######### UPDATED QUERIES (copied from above) ##########
    evaluateQuery(v.query().keys("name").has("weight", Cmp.GREATER_THAN, 3.6), PROPERTY, 2 * numV / 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").interval("time", numV / 2 - 10, numV / 2 + 10), PROPERTY, 10, 1, new boolean[] { false, true });
    evaluateQuery(v.query().keys("name").interval("time", numV / 2 - 10, numV / 2 + 10).orderBy("weight", decr), PROPERTY, 10, 1, new boolean[] { false, false }, weight, Order.DESC);
    evaluateQuery(v.query().keys("name").interval("time", numV, numV + 10).limit(5), PROPERTY, 5, 1, new boolean[] { false, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, 5), EDGE, 0, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).has("time", Cmp.EQUAL, numV + 5), EDGE, 1, 1, new boolean[] { true, true });
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", 10, 20).orderBy("weight", decr).limit(5), EDGE, 0, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query().labels("child").direction(OUT).interval("time", numV + 10, numV + 20).orderBy("weight", decr).limit(5), EDGE, 5, 1, new boolean[] { true, false }, weight, Order.DESC);
    evaluateQuery(v.query(), RELATION, numV * 4, 1, new boolean[] { true, true });
    evaluateQuery(v.query().direction(OUT), RELATION, numV * 4, 1, new boolean[] { false, true });
// ######### END UPDATED QUERIES ##########
}
Also used : JanusGraphEdge(org.janusgraph.core.JanusGraphEdge) EdgeLabel(org.janusgraph.core.EdgeLabel) RelationTypeIndex(org.janusgraph.core.schema.RelationTypeIndex) JanusGraphVertexProperty(org.janusgraph.core.JanusGraphVertexProperty) JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) SchemaViolationException(org.janusgraph.core.SchemaViolationException) JanusGraphVertexProperty(org.janusgraph.core.JanusGraphVertexProperty) VertexProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty) JanusGraphEdge(org.janusgraph.core.JanusGraphEdge) Edge(org.apache.tinkerpop.gremlin.structure.Edge) PropertyKey(org.janusgraph.core.PropertyKey) VertexList(org.janusgraph.core.VertexList) Test(org.junit.Test)

Example 2 with SchemaViolationException

use of org.janusgraph.core.SchemaViolationException in project janusgraph by JanusGraph.

the class JanusGraphTest method testTransactionalScopeOfSchemaTypes.

/**
 * This tests a special scenario under which a schema type is defined in a (management) transaction
 * and then accessed in a concurrent transaction.
 * Also ensures that unique property values are enforced within and across transactions
 */
@Test
public void testTransactionalScopeOfSchemaTypes() {
    makeVertexIndexedUniqueKey("domain", String.class);
    finishSchema();
    Vertex v1, v2;
    v1 = tx.addVertex();
    try {
        v1.property(VertexProperty.Cardinality.single, "domain", "unique1");
    } catch (SchemaViolationException ignored) {
    } finally {
        tx.rollback();
        tx = null;
    }
    newTx();
    v1 = tx.addVertex();
    v1.property("domain", "unique1");
    try {
        v2 = tx.addVertex();
        v2.property("domain", "unique1");
        fail();
    } catch (SchemaViolationException ignored) {
    } finally {
        tx.rollback();
        tx = null;
    }
    newTx();
    clopen();
    v1 = tx.addVertex();
    v1.property("domain", "unique1");
    assertCount(1, tx.query().has("domain", "unique1").vertices());
    try {
        v2 = tx.addVertex();
        v2.property("domain", "unique1");
        fail();
    } catch (SchemaViolationException ignored) {
    } finally {
        tx.rollback();
        tx = null;
    }
    newTx();
}
Also used : JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) SchemaViolationException(org.janusgraph.core.SchemaViolationException) Test(org.junit.Test)

Example 3 with SchemaViolationException

use of org.janusgraph.core.SchemaViolationException in project janusgraph by JanusGraph.

the class JanusGraphTest method testSchemaTypes.

/* ==================================================================================
                            SCHEMA TESTS
     ==================================================================================*/
/**
 * Test the definition and inspection of various schema types and ensure their correct interpretation
 * within the graph
 */
@SuppressWarnings("unchecked")
@Test
public void testSchemaTypes() {
    // ---------- PROPERTY KEYS ----------------
    // Normal single-valued property key
    PropertyKey weight = makeKey("weight", Float.class);
    // Indexed unique property key
    PropertyKey uid = makeVertexIndexedUniqueKey("uid", String.class);
    // Indexed but not unique
    PropertyKey someId = makeVertexIndexedKey("someid", Object.class);
    // Set-valued property key
    PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SET).make();
    // List-valued property key with signature
    PropertyKey value = mgmt.makePropertyKey("value").dataType(Double.class).signature(weight).cardinality(Cardinality.LIST).make();
    // ---------- EDGE LABELS ----------------
    // Standard edge label
    EdgeLabel friend = mgmt.makeEdgeLabel("friend").make();
    // Unidirected
    EdgeLabel link = mgmt.makeEdgeLabel("link").unidirected().multiplicity(Multiplicity.MANY2ONE).make();
    // Signature label
    EdgeLabel connect = mgmt.makeEdgeLabel("connect").signature(uid).multiplicity(Multiplicity.SIMPLE).make();
    // Edge labels with different cardinalities
    EdgeLabel parent = mgmt.makeEdgeLabel("parent").multiplicity(Multiplicity.MANY2ONE).make();
    EdgeLabel child = mgmt.makeEdgeLabel("child").multiplicity(Multiplicity.ONE2MANY).make();
    EdgeLabel spouse = mgmt.makeEdgeLabel("spouse").multiplicity(Multiplicity.ONE2ONE).make();
    // ---------- VERTEX LABELS ----------------
    VertexLabel person = mgmt.makeVertexLabel("person").make();
    VertexLabel tag = mgmt.makeVertexLabel("tag").make();
    VertexLabel tweet = mgmt.makeVertexLabel("tweet").setStatic().make();
    long[] sig;
    // ######### INSPECTION & FAILURE ############
    assertTrue(mgmt.isOpen());
    assertEquals("weight", weight.toString());
    assertTrue(mgmt.containsRelationType("weight"));
    assertTrue(mgmt.containsPropertyKey("weight"));
    assertFalse(mgmt.containsEdgeLabel("weight"));
    assertTrue(mgmt.containsEdgeLabel("connect"));
    assertFalse(mgmt.containsPropertyKey("connect"));
    assertFalse(mgmt.containsRelationType("bla"));
    assertNull(mgmt.getPropertyKey("bla"));
    assertNull(mgmt.getEdgeLabel("bla"));
    assertNotNull(mgmt.getPropertyKey("weight"));
    assertNotNull(mgmt.getEdgeLabel("connect"));
    assertTrue(weight.isPropertyKey());
    assertFalse(weight.isEdgeLabel());
    assertEquals(Cardinality.SINGLE, weight.cardinality());
    assertEquals(Cardinality.SINGLE, someId.cardinality());
    assertEquals(Cardinality.SET, name.cardinality());
    assertEquals(Cardinality.LIST, value.cardinality());
    assertEquals(Object.class, someId.dataType());
    assertEquals(Float.class, weight.dataType());
    sig = ((InternalRelationType) value).getSignature();
    assertEquals(1, sig.length);
    assertEquals(weight.longId(), sig[0]);
    assertTrue(mgmt.getGraphIndex(uid.name()).isUnique());
    assertFalse(mgmt.getGraphIndex(someId.name()).isUnique());
    assertEquals("friend", friend.name());
    assertTrue(friend.isEdgeLabel());
    assertFalse(friend.isPropertyKey());
    assertEquals(Multiplicity.ONE2ONE, spouse.multiplicity());
    assertEquals(Multiplicity.ONE2MANY, child.multiplicity());
    assertEquals(Multiplicity.MANY2ONE, parent.multiplicity());
    assertEquals(Multiplicity.MULTI, friend.multiplicity());
    assertEquals(Multiplicity.SIMPLE, connect.multiplicity());
    assertTrue(link.isUnidirected());
    assertFalse(link.isDirected());
    assertFalse(child.isUnidirected());
    assertTrue(spouse.isDirected());
    assertFalse(((InternalRelationType) friend).isInvisibleType());
    assertTrue(((InternalRelationType) friend).isInvisible());
    assertEquals(0, ((InternalRelationType) friend).getSignature().length);
    sig = ((InternalRelationType) connect).getSignature();
    assertEquals(1, sig.length);
    assertEquals(uid.longId(), sig[0]);
    assertEquals(0, ((InternalRelationType) friend).getSortKey().length);
    assertEquals(Order.DEFAULT, ((InternalRelationType) friend).getSortOrder());
    assertEquals(SchemaStatus.ENABLED, ((InternalRelationType) friend).getStatus());
    assertEquals(5, Iterables.size(mgmt.getRelationTypes(PropertyKey.class)));
    assertEquals(6, Iterables.size(mgmt.getRelationTypes(EdgeLabel.class)));
    assertEquals(11, Iterables.size(mgmt.getRelationTypes(RelationType.class)));
    assertEquals(3, Iterables.size(mgmt.getVertexLabels()));
    assertEquals("tweet", tweet.name());
    assertTrue(mgmt.containsVertexLabel("person"));
    assertFalse(mgmt.containsVertexLabel("bla"));
    assertFalse(person.isPartitioned());
    assertFalse(person.isStatic());
    assertFalse(tag.isPartitioned());
    assertTrue(tweet.isStatic());
    // Failures
    try {
        // No data type
        mgmt.makePropertyKey("fid").make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Already exists
        mgmt.makeEdgeLabel("link").unidirected().make();
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // signature and sort-key collide
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).sortKey(someId, weight).signature(someId).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // } catch (IllegalArgumentException e) {}
    try {
        // sort key requires the label to be non-constrained
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).multiplicity(Multiplicity.SIMPLE).sortKey(weight).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // sort key requires the label to be non-constrained
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).multiplicity(Multiplicity.MANY2ONE).sortKey(weight).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Already exists
        mgmt.makeVertexLabel("tweet").make();
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // signature key must have non-generic data type
        mgmt.makeEdgeLabel("test").signature(someId).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // ######### END INSPECTION ############
    finishSchema();
    clopen();
    // Load schema types into current transaction
    weight = mgmt.getPropertyKey("weight");
    uid = mgmt.getPropertyKey("uid");
    someId = mgmt.getPropertyKey("someid");
    name = mgmt.getPropertyKey("name");
    value = mgmt.getPropertyKey("value");
    friend = mgmt.getEdgeLabel("friend");
    link = mgmt.getEdgeLabel("link");
    connect = mgmt.getEdgeLabel("connect");
    parent = mgmt.getEdgeLabel("parent");
    child = mgmt.getEdgeLabel("child");
    spouse = mgmt.getEdgeLabel("spouse");
    person = mgmt.getVertexLabel("person");
    tag = mgmt.getVertexLabel("tag");
    tweet = mgmt.getVertexLabel("tweet");
    // ######### INSPECTION & FAILURE (COPIED FROM ABOVE) ############
    assertTrue(mgmt.isOpen());
    assertEquals("weight", weight.toString());
    assertTrue(mgmt.containsRelationType("weight"));
    assertTrue(mgmt.containsPropertyKey("weight"));
    assertFalse(mgmt.containsEdgeLabel("weight"));
    assertTrue(mgmt.containsEdgeLabel("connect"));
    assertFalse(mgmt.containsPropertyKey("connect"));
    assertFalse(mgmt.containsRelationType("bla"));
    assertNull(mgmt.getPropertyKey("bla"));
    assertNull(mgmt.getEdgeLabel("bla"));
    assertNotNull(mgmt.getPropertyKey("weight"));
    assertNotNull(mgmt.getEdgeLabel("connect"));
    assertTrue(weight.isPropertyKey());
    assertFalse(weight.isEdgeLabel());
    assertEquals(Cardinality.SINGLE, weight.cardinality());
    assertEquals(Cardinality.SINGLE, someId.cardinality());
    assertEquals(Cardinality.SET, name.cardinality());
    assertEquals(Cardinality.LIST, value.cardinality());
    assertEquals(Object.class, someId.dataType());
    assertEquals(Float.class, weight.dataType());
    sig = ((InternalRelationType) value).getSignature();
    assertEquals(1, sig.length);
    assertEquals(weight.longId(), sig[0]);
    assertTrue(mgmt.getGraphIndex(uid.name()).isUnique());
    assertFalse(mgmt.getGraphIndex(someId.name()).isUnique());
    assertEquals("friend", friend.name());
    assertTrue(friend.isEdgeLabel());
    assertFalse(friend.isPropertyKey());
    assertEquals(Multiplicity.ONE2ONE, spouse.multiplicity());
    assertEquals(Multiplicity.ONE2MANY, child.multiplicity());
    assertEquals(Multiplicity.MANY2ONE, parent.multiplicity());
    assertEquals(Multiplicity.MULTI, friend.multiplicity());
    assertEquals(Multiplicity.SIMPLE, connect.multiplicity());
    assertTrue(link.isUnidirected());
    assertFalse(link.isDirected());
    assertFalse(child.isUnidirected());
    assertTrue(spouse.isDirected());
    assertFalse(((InternalRelationType) friend).isInvisibleType());
    assertTrue(((InternalRelationType) friend).isInvisible());
    assertEquals(0, ((InternalRelationType) friend).getSignature().length);
    sig = ((InternalRelationType) connect).getSignature();
    assertEquals(1, sig.length);
    assertEquals(uid.longId(), sig[0]);
    assertEquals(0, ((InternalRelationType) friend).getSortKey().length);
    assertEquals(Order.DEFAULT, ((InternalRelationType) friend).getSortOrder());
    assertEquals(SchemaStatus.ENABLED, ((InternalRelationType) friend).getStatus());
    assertEquals(5, Iterables.size(mgmt.getRelationTypes(PropertyKey.class)));
    assertEquals(6, Iterables.size(mgmt.getRelationTypes(EdgeLabel.class)));
    assertEquals(11, Iterables.size(mgmt.getRelationTypes(RelationType.class)));
    assertEquals(3, Iterables.size(mgmt.getVertexLabels()));
    assertEquals("tweet", tweet.name());
    assertTrue(mgmt.containsVertexLabel("person"));
    assertFalse(mgmt.containsVertexLabel("bla"));
    assertFalse(person.isPartitioned());
    assertFalse(person.isStatic());
    assertFalse(tag.isPartitioned());
    assertTrue(tweet.isStatic());
    // Failures
    try {
        // No data type
        mgmt.makePropertyKey("fid").make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Already exists
        mgmt.makeEdgeLabel("link").unidirected().make();
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // signature and sort-key collide
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).sortKey(someId, weight).signature(someId).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // } catch (IllegalArgumentException e) {}
    try {
        // sort key requires the label to be non-constrained
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).multiplicity(Multiplicity.SIMPLE).sortKey(weight).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // sort key requires the label to be non-constrained
        ((StandardEdgeLabelMaker) mgmt.makeEdgeLabel("other")).multiplicity(Multiplicity.MANY2ONE).sortKey(weight).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    try {
        // Already exists
        mgmt.makeVertexLabel("tweet").make();
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // signature key must have non-generic data type
        mgmt.makeEdgeLabel("test").signature(someId).make();
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // ######### END INSPECTION ############
    /*
          ####### Make sure schema semantics are honored in transactions ######
        */
    clopen();
    JanusGraphTransaction tx2;
    // shouldn't exist
    assertEmpty(tx.query().has("uid", "v1").vertices());
    JanusGraphVertex v = tx.addVertex();
    // test property keys
    v.property("uid", "v1");
    v.property("weight", 1.5);
    v.property("someid", "Hello");
    v.property("name", "Bob");
    v.property("name", "John");
    VertexProperty p = v.property("value", 11);
    p.property("weight", 22);
    v.property("value", 33.3, "weight", 66.6);
    // same values are supported for list-properties
    v.property("value", 11, "weight", 22);
    // test edges
    JanusGraphVertex v12 = tx.addVertex("person"), v13 = tx.addVertex("person");
    v12.property("uid", "v12");
    v13.property("uid", "v13");
    v12.addEdge("parent", v, "weight", 4.5);
    v13.addEdge("parent", v, "weight", 4.5);
    v.addEdge("child", v12);
    v.addEdge("child", v13);
    v.addEdge("spouse", v12);
    v.addEdge("friend", v12);
    // supports multi edges
    v.addEdge("friend", v12);
    v.addEdge("connect", v12, "uid", "e1");
    v.addEdge("link", v13);
    JanusGraphVertex v2 = tx.addVertex("tweet");
    v2.addEdge("link", v13);
    v12.addEdge("connect", v2);
    JanusGraphEdge edge;
    // ######### INSPECTION & FAILURE ############
    assertEquals(v, getOnlyElement(tx.query().has("uid", Cmp.EQUAL, "v1").vertices()));
    v = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v1"));
    v12 = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v12"));
    v13 = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v13"));
    try {
        // Invalid data type
        v.property("weight", "x");
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // Only one "John" should be allowed
        v.property(VertexProperty.Cardinality.list, "name", "John");
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // Cannot set a property as edge
        v.property("link", v);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // Only one property for weight allowed
    v.property(single, "weight", 1.0);
    assertCount(1, v.properties("weight"));
    v.property(VertexProperty.Cardinality.single, "weight", 0.5);
    assertEquals(0.5, v.<Float>value("weight").doubleValue(), 0.00001);
    assertEquals("v1", v.value("uid"));
    assertCount(2, v.properties("name"));
    for (Object prop : v.query().labels("name").properties()) {
        String nameString = ((JanusGraphVertexProperty<String>) prop).value();
        assertTrue(nameString.equals("Bob") || nameString.equals("John"));
    }
    assertTrue(Iterators.size(v.properties("value")) >= 3);
    for (Object o : v.query().labels("value").properties()) {
        JanusGraphVertexProperty<Double> prop = (JanusGraphVertexProperty<Double>) o;
        double prec = prop.value();
        assertEquals(prec * 2, prop.<Number>value("weight").doubleValue(), 0.00001);
    }
    // Ensure we can add additional values
    p = v.property("value", 44.4, "weight", 88.8);
    assertEquals(v, getOnlyElement(tx.query().has("someid", Cmp.EQUAL, "Hello").vertices()));
    // ------- EDGES -------
    try {
        // multiplicity violation
        v12.addEdge("parent", v13);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v13.addEdge("child", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v13.addEdge("spouse", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v.addEdge("spouse", v13);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    assertCount(2, v.query().direction(Direction.IN).labels("parent").edges());
    assertCount(1, v12.query().direction(Direction.OUT).labels("parent").has("weight").edges());
    assertCount(1, v13.query().direction(Direction.OUT).labels("parent").has("weight").edges());
    assertEquals(v12, getOnlyElement(v.query().direction(Direction.OUT).labels("spouse").vertices()));
    edge = Iterables.getOnlyElement(v.query().direction(Direction.BOTH).labels("connect").edges());
    assertEquals(1, edge.keys().size());
    assertEquals("e1", edge.value("uid"));
    try {
        // connect is simple
        v.addEdge("connect", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    // Make sure "link" is unidirected
    assertCount(1, v.query().direction(Direction.BOTH).labels("link").edges());
    assertCount(0, v13.query().direction(Direction.BOTH).labels("link").edges());
    // Assert we can add more friendships
    v.addEdge("friend", v12);
    v2 = Iterables.getOnlyElement(v12.query().direction(Direction.OUT).labels("connect").vertices());
    assertEquals(v13, getOnlyElement(v2.query().direction(Direction.OUT).labels("link").vertices()));
    assertEquals(BaseVertexLabel.DEFAULT_VERTEXLABEL.name(), v.label());
    assertEquals("person", v12.label());
    assertEquals("person", v13.label());
    assertCount(4, tx.query().vertices());
    // ######### END INSPECTION & FAILURE ############
    clopen();
    // ######### INSPECTION & FAILURE (copied from above) ############
    assertEquals(v, getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v1")));
    v = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v1"));
    v12 = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v12"));
    v13 = getOnlyVertex(tx.query().has("uid", Cmp.EQUAL, "v13"));
    try {
        // Invalid data type
        v.property("weight", "x");
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // Only one "John" should be allowed
        v.property(VertexProperty.Cardinality.list, "name", "John");
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // Cannot set a property as edge
        v.property("link", v);
        fail();
    } catch (IllegalArgumentException ignored) {
    }
    // Only one property for weight allowed
    v.property(VertexProperty.Cardinality.single, "weight", 1.0);
    assertCount(1, v.properties("weight"));
    v.property(VertexProperty.Cardinality.single, "weight", 0.5);
    assertEquals(0.5, v.<Float>value("weight").doubleValue(), 0.00001);
    assertEquals("v1", v.value("uid"));
    assertCount(2, v.properties("name"));
    for (Object o : v.query().labels("name").properties()) {
        JanusGraphVertexProperty<String> prop = (JanusGraphVertexProperty<String>) o;
        String nameString = prop.value();
        assertTrue(nameString.equals("Bob") || nameString.equals("John"));
    }
    assertTrue(Iterables.size(v.query().labels("value").properties()) >= 3);
    for (Object o : v.query().labels("value").properties()) {
        JanusGraphVertexProperty<Double> prop = (JanusGraphVertexProperty<Double>) o;
        double prec = prop.value();
        assertEquals(prec * 2, prop.<Number>value("weight").doubleValue(), 0.00001);
    }
    // Ensure we can add additional values
    p = v.property("value", 44.4, "weight", 88.8);
    assertEquals(v, getOnlyElement(tx.query().has("someid", Cmp.EQUAL, "Hello").vertices()));
    // ------- EDGES -------
    try {
        // multiplicity violation
        v12.addEdge("parent", v13);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v13.addEdge("child", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v13.addEdge("spouse", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        // multiplicity violation
        v.addEdge("spouse", v13);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    assertCount(2, v.query().direction(Direction.IN).labels("parent").edges());
    assertCount(1, v12.query().direction(Direction.OUT).labels("parent").has("weight").edges());
    assertCount(1, v13.query().direction(Direction.OUT).labels("parent").has("weight").edges());
    assertEquals(v12, getOnlyElement(v.query().direction(Direction.OUT).labels("spouse").vertices()));
    edge = Iterables.getOnlyElement(v.query().direction(Direction.BOTH).labels("connect").edges());
    assertEquals(1, edge.keys().size());
    assertEquals("e1", edge.value("uid"));
    try {
        // connect is simple
        v.addEdge("connect", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    // Make sure "link" is unidirected
    assertCount(1, v.query().direction(Direction.BOTH).labels("link").edges());
    assertCount(0, v13.query().direction(Direction.BOTH).labels("link").edges());
    // Assert we can add more friendships
    v.addEdge("friend", v12);
    v2 = Iterables.getOnlyElement(v12.query().direction(Direction.OUT).labels("connect").vertices());
    assertEquals(v13, getOnlyElement(v2.query().direction(Direction.OUT).labels("link").vertices()));
    assertEquals(BaseVertexLabel.DEFAULT_VERTEXLABEL.name(), v.label());
    assertEquals("person", v12.label());
    assertEquals("person", v13.label());
    assertCount(4, tx.query().vertices());
    // ######### END INSPECTION & FAILURE ############
    // Ensure index uniqueness enforcement
    tx2 = graph.newTransaction();
    try {
        JanusGraphVertex vx = tx2.addVertex();
        try {
            // property is unique
            vx.property(VertexProperty.Cardinality.single, "uid", "v1");
            fail();
        } catch (SchemaViolationException ignored) {
        }
        vx.property(VertexProperty.Cardinality.single, "uid", "unique");
        JanusGraphVertex vx2 = tx2.addVertex();
        try {
            // property unique
            vx2.property(VertexProperty.Cardinality.single, "uid", "unique");
            fail();
        } catch (SchemaViolationException ignored) {
        }
    } finally {
        tx2.rollback();
    }
    // Ensure that v2 is really static
    v2 = getV(tx, v2);
    assertEquals("tweet", v2.label());
    try {
        v2.property(VertexProperty.Cardinality.single, "weight", 11);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    try {
        v2.addEdge("friend", v12);
        fail();
    } catch (SchemaViolationException ignored) {
    }
    // Ensure that unidirected edges keep pointing to deleted vertices
    getV(tx, v13).remove();
    assertCount(1, v.query().direction(Direction.BOTH).labels("link").edges());
    // Finally, test the schema container
    SchemaContainer schemaContainer = new SchemaContainer(graph);
    assertTrue(schemaContainer.containsRelationType("weight"));
    assertTrue(schemaContainer.containsRelationType("friend"));
    assertTrue(schemaContainer.containsVertexLabel("person"));
    VertexLabelDefinition vld = schemaContainer.getVertexLabel("tag");
    assertFalse(vld.isPartitioned());
    assertFalse(vld.isStatic());
    PropertyKeyDefinition pkd = schemaContainer.getPropertyKey("name");
    assertEquals(Cardinality.SET, pkd.getCardinality());
    assertEquals(String.class, pkd.getDataType());
    EdgeLabelDefinition eld = schemaContainer.getEdgeLabel("child");
    assertEquals("child", eld.getName());
    assertEquals(child.longId(), eld.getLongId());
    assertEquals(Multiplicity.ONE2MANY, eld.getMultiplicity());
    assertFalse(eld.isUnidirected());
}
Also used : EdgeLabelDefinition(org.janusgraph.graphdb.schema.EdgeLabelDefinition) JanusGraphEdge(org.janusgraph.core.JanusGraphEdge) JanusGraphVertexProperty(org.janusgraph.core.JanusGraphVertexProperty) StandardEdgeLabelMaker(org.janusgraph.graphdb.types.StandardEdgeLabelMaker) JanusGraphTransaction(org.janusgraph.core.JanusGraphTransaction) VertexLabel(org.janusgraph.core.VertexLabel) BaseVertexLabel(org.janusgraph.graphdb.types.system.BaseVertexLabel) JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) SchemaViolationException(org.janusgraph.core.SchemaViolationException) JanusGraphVertexProperty(org.janusgraph.core.JanusGraphVertexProperty) VertexProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty) VertexLabelDefinition(org.janusgraph.graphdb.schema.VertexLabelDefinition) SchemaContainer(org.janusgraph.graphdb.schema.SchemaContainer) PropertyKeyDefinition(org.janusgraph.graphdb.schema.PropertyKeyDefinition) EdgeLabel(org.janusgraph.core.EdgeLabel) InternalRelationType(org.janusgraph.graphdb.internal.InternalRelationType) PropertyKey(org.janusgraph.core.PropertyKey) Test(org.junit.Test)

Aggregations

JanusGraphVertex (org.janusgraph.core.JanusGraphVertex)3 SchemaViolationException (org.janusgraph.core.SchemaViolationException)3 Test (org.junit.Test)3 VertexProperty (org.apache.tinkerpop.gremlin.structure.VertexProperty)2 EdgeLabel (org.janusgraph.core.EdgeLabel)2 JanusGraphEdge (org.janusgraph.core.JanusGraphEdge)2 JanusGraphVertexProperty (org.janusgraph.core.JanusGraphVertexProperty)2 PropertyKey (org.janusgraph.core.PropertyKey)2 Edge (org.apache.tinkerpop.gremlin.structure.Edge)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 JanusGraphTransaction (org.janusgraph.core.JanusGraphTransaction)1 VertexLabel (org.janusgraph.core.VertexLabel)1 VertexList (org.janusgraph.core.VertexList)1 RelationTypeIndex (org.janusgraph.core.schema.RelationTypeIndex)1 InternalRelationType (org.janusgraph.graphdb.internal.InternalRelationType)1 EdgeLabelDefinition (org.janusgraph.graphdb.schema.EdgeLabelDefinition)1 PropertyKeyDefinition (org.janusgraph.graphdb.schema.PropertyKeyDefinition)1 SchemaContainer (org.janusgraph.graphdb.schema.SchemaContainer)1 VertexLabelDefinition (org.janusgraph.graphdb.schema.VertexLabelDefinition)1 StandardEdgeLabelMaker (org.janusgraph.graphdb.types.StandardEdgeLabelMaker)1