Search in sources :

Example 6 with RelationshipType

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

the class PECListingIT method canListRelationshipPropertyExistenceConstraintsByTypeAndProperty.

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

Example 7 with RelationshipType

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

the class PECListingIT method canListRelationshipPropertyExistenceConstraintsByType.

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

Example 8 with RelationshipType

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

the class GraphDbStructureGuide method showRelCounts.

private void showRelCounts(ReadOperations read, DbStructureVisitor visitor) {
    // all wildcards
    noSide(read, visitor, WILDCARD_REL_TYPE, ANY_RELATIONSHIP_TYPE);
    // one label only
    for (Label label : db.getAllLabels()) {
        int labelId = read.labelGetForName(label.name());
        leftSide(read, visitor, label, labelId, WILDCARD_REL_TYPE, ANY_RELATIONSHIP_TYPE);
        rightSide(read, visitor, label, labelId, WILDCARD_REL_TYPE, ANY_RELATIONSHIP_TYPE);
    }
    // fixed rel type
    for (RelationshipType relType : db.getAllRelationshipTypes()) {
        int relTypeId = read.relationshipTypeGetForName(relType.name());
        noSide(read, visitor, relType, relTypeId);
        for (Label label : db.getAllLabels()) {
            int labelId = read.labelGetForName(label.name());
            // wildcard on right
            leftSide(read, visitor, label, labelId, relType, relTypeId);
            // wildcard on left
            rightSide(read, visitor, label, labelId, relType, relTypeId);
        }
    }
}
Also used : Label(org.neo4j.graphdb.Label) RelationshipType(org.neo4j.graphdb.RelationshipType) PropertyConstraint(org.neo4j.kernel.api.constraints.PropertyConstraint) RelationshipPropertyExistenceConstraint(org.neo4j.kernel.api.constraints.RelationshipPropertyExistenceConstraint) NodePropertyExistenceConstraint(org.neo4j.kernel.api.constraints.NodePropertyExistenceConstraint) UniquenessConstraint(org.neo4j.kernel.api.constraints.UniquenessConstraint)

Example 9 with RelationshipType

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

the class GraphDbStructureGuide method showRelTypes.

private void showRelTypes(ReadOperations read, DbStructureVisitor visitor) {
    for (RelationshipType relType : db.getAllRelationshipTypes()) {
        int relTypeId = read.relationshipTypeGetForName(relType.name());
        visitor.visitRelationshipType(relTypeId, relType.name());
    }
}
Also used : RelationshipType(org.neo4j.graphdb.RelationshipType) PropertyConstraint(org.neo4j.kernel.api.constraints.PropertyConstraint) RelationshipPropertyExistenceConstraint(org.neo4j.kernel.api.constraints.RelationshipPropertyExistenceConstraint) NodePropertyExistenceConstraint(org.neo4j.kernel.api.constraints.NodePropertyExistenceConstraint) UniquenessConstraint(org.neo4j.kernel.api.constraints.UniquenessConstraint)

Example 10 with RelationshipType

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

the class BatchInserterImpl method getRelationshipById.

@Override
public BatchRelationship getRelationshipById(long relId) {
    RelationshipRecord record = getRelationshipRecord(relId).forReadingData();
    RelationshipType type = (RelationshipType) relationshipTypeTokens.byId(record.getType());
    return new BatchRelationship(record.getId(), record.getFirstNode(), record.getSecondNode(), type);
}
Also used : RelationshipType(org.neo4j.graphdb.RelationshipType) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) BatchRelationship(org.neo4j.unsafe.batchinsert.BatchRelationship)

Aggregations

RelationshipType (org.neo4j.graphdb.RelationshipType)147 Node (org.neo4j.graphdb.Node)84 Relationship (org.neo4j.graphdb.Relationship)59 Transaction (org.neo4j.graphdb.Transaction)52 Test (org.junit.Test)35 Test (org.junit.jupiter.api.Test)32 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)20 Direction (org.neo4j.graphdb.Direction)19 Label (org.neo4j.graphdb.Label)18 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)15 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)15 ArrayList (java.util.ArrayList)13 NotFoundException (org.neo4j.graphdb.NotFoundException)10 Traverser (org.neo4j.graphdb.Traverser)10 HashSet (java.util.HashSet)9 RelationshipRecord (org.neo4j.kernel.impl.nioneo.store.RelationshipRecord)7 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)7 Collection (java.util.Collection)6 HashMap (java.util.HashMap)6 LinkedList (java.util.LinkedList)6