Search in sources :

Example 56 with Label

use of org.neo4j.graphdb.Label in project neo4j by neo4j.

the class PECListingIT method canListNodePropertyExistenceConstraints.

@Test
public void canListNodePropertyExistenceConstraints() throws Exception {
    // GIVEN
    Label label = label("Person");
    SchemaHelper.createNodePropertyExistenceConstraint(db, label, "name");
    // WHEN / THEN
    executeCommand("schema ls", "ON \\(person:Person\\) ASSERT exists\\(person.name\\)");
}
Also used : Label(org.neo4j.graphdb.Label) Test(org.junit.Test)

Example 57 with Label

use of org.neo4j.graphdb.Label in project neo4j by neo4j.

the class PECListingIT method canListBothNodeAndRelationshipPropertyExistenceConstraintsByLabelAndType.

@Test
public void canListBothNodeAndRelationshipPropertyExistenceConstraintsByLabelAndType() throws Exception {
    // GIVEN
    Label label = label("Person");
    RelationshipType relType = RelationshipType.withName("KNOWS");
    // WHEN
    SchemaHelper.createNodePropertyExistenceConstraint(db, label, "name");
    SchemaHelper.createRelPropertyExistenceConstraint(db, relType, "since");
    // THEN
    executeCommand("schema ls -l :Person -r :KNOWS", "ON \\(person:Person\\) ASSERT exists\\(person.name\\)", "ON \\(\\)-\\[knows:KNOWS\\]-\\(\\) ASSERT exists\\(knows.since\\)");
}
Also used : Label(org.neo4j.graphdb.Label) RelationshipType(org.neo4j.graphdb.RelationshipType) Test(org.junit.Test)

Example 58 with Label

use of org.neo4j.graphdb.Label in project neo4j by neo4j.

the class PECListingIT method canListNodePropertyExistenceConstraintsByLabelAndProperty.

@Test
public void canListNodePropertyExistenceConstraintsByLabelAndProperty() throws Exception {
    // GIVEN
    Label label = label("Person");
    SchemaHelper.createNodePropertyExistenceConstraint(db, label, "name");
    // WHEN / THEN
    executeCommand("schema ls -l :Person -p name", "ON \\(person:Person\\) ASSERT exists\\(person.name\\)");
}
Also used : Label(org.neo4j.graphdb.Label) Test(org.junit.Test)

Example 59 with Label

use of org.neo4j.graphdb.Label in project neo4j by neo4j.

the class PECListingIT method canListBothNodeAndRelationshipPropertyExistenceConstraints.

@Test
public void canListBothNodeAndRelationshipPropertyExistenceConstraints() throws Exception {
    // GIVEN
    Label label = label("Person");
    RelationshipType relType = RelationshipType.withName("KNOWS");
    // WHEN
    SchemaHelper.createNodePropertyExistenceConstraint(db, label, "name");
    SchemaHelper.createRelPropertyExistenceConstraint(db, relType, "since");
    // THEN
    executeCommand("schema ls", "ON \\(person:Person\\) ASSERT exists\\(person.name\\)", "ON \\(\\)-\\[knows:KNOWS\\]-\\(\\) ASSERT exists\\(knows.since\\)");
}
Also used : Label(org.neo4j.graphdb.Label) RelationshipType(org.neo4j.graphdb.RelationshipType) Test(org.junit.Test)

Example 60 with Label

use of org.neo4j.graphdb.Label in project neo4j by neo4j.

the class PECListingIT method canListNodePropertyExistenceConstraintsByLabel.

@Test
public void canListNodePropertyExistenceConstraintsByLabel() throws Exception {
    // GIVEN
    Label label = label("Person");
    SchemaHelper.createNodePropertyExistenceConstraint(db, label, "name");
    // WHEN / THEN
    executeCommand("schema ls -l :Person", "ON \\(person:Person\\) ASSERT exists\\(person.name\\)");
}
Also used : Label(org.neo4j.graphdb.Label) Test(org.junit.Test)

Aggregations

Label (org.neo4j.graphdb.Label)82 Test (org.junit.Test)55 Node (org.neo4j.graphdb.Node)48 Transaction (org.neo4j.graphdb.Transaction)44 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)12 RelationshipType (org.neo4j.graphdb.RelationshipType)8 DependencyResolver (org.neo4j.graphdb.DependencyResolver)6 DynamicLabel (org.neo4j.graphdb.DynamicLabel)6 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)6 Statement (org.neo4j.kernel.api.Statement)6 ArrayList (java.util.ArrayList)5 ConstraintViolationException (org.neo4j.graphdb.ConstraintViolationException)5 Relationship (org.neo4j.graphdb.Relationship)5 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)5 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)5 File (java.io.File)4 HashSet (java.util.HashSet)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 TransactionFailureException (org.neo4j.graphdb.TransactionFailureException)4