Examples of constraintFor()


Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test
    public void shouldEnforceUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        this.g.tx().commit();
        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.tx().commit();
        assertEquals("marko", g.V().<Vertex>has(T.label, "Person").<Vertex>has("name", "marko").next().value("name"));
    }
View Full Code Here

Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test
    public void shouldEnforceMultipleUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("surname").create();
        this.g.tx().commit();
        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.addVertex(T.label, "Person", "surname", "aaaa");
        this.g.tx().commit();
View Full Code Here

Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test
    public void shouldEnforceMultipleUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("surname").create();
        this.g.tx().commit();
        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.addVertex(T.label, "Person", "surname", "aaaa");
        this.g.tx().commit();
        boolean failSurname = false;
View Full Code Here

Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test
    public void shouldDropMultipleUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("surname").create();
        this.g.tx().commit();

        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.addVertex(T.label, "Person", "surname", "aaaa");
View Full Code Here

Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test
    public void shouldDropMultipleUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("surname").create();
        this.g.tx().commit();

        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.addVertex(T.label, "Person", "surname", "aaaa");
        this.g.tx().commit();
View Full Code Here

Examples of org.neo4j.graphdb.schema.Schema.constraintFor()

    @Test(expected = ConstraintViolationException.class)
    public void shouldFailUniqueConstraint() {
        this.g.tx().readWrite();
        final Schema schema = this.g.getBaseGraph().schema();
        schema.constraintFor(DynamicLabel.label("Person")).assertPropertyIsUnique("name").create();
        this.g.tx().commit();
        this.g.addVertex(T.label, "Person", "name", "marko");
        this.g.tx().commit();
        assertEquals("marko", g.V().<Vertex>has(T.label, "Person").<Vertex>has("name", "marko").next().value("name"));
        this.g.addVertex(T.label, "Person", "name", "marko");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.