Search in sources :

Example 1 with IndexConstraintNodeInfo

use of apoc.result.IndexConstraintNodeInfo in project neo4j-apoc-procedures by neo4j-contrib.

the class Schemas method indexesAndConstraintsForNode.

/**
 * Collects indexes and constraints for nodes
 *
 * @return
 */
private Stream<IndexConstraintNodeInfo> indexesAndConstraintsForNode() {
    Schema schema = db.schema();
    // Indexes
    Stream<IndexConstraintNodeInfo> indexes = StreamSupport.stream(schema.getIndexes().spliterator(), false).filter(indexDefinition -> !indexDefinition.isConstraintIndex()).map(indexDefinition -> this.nodeInfoFromIndexDefinition(indexDefinition, schema));
    // Constraints
    Stream<IndexConstraintNodeInfo> constraints = StreamSupport.stream(schema.getConstraints().spliterator(), false).filter(constraintDefinition -> !constraintDefinition.isConstraintType(ConstraintType.RELATIONSHIP_PROPERTY_EXISTENCE)).map(this::nodeInfoFromConstraintDefinition);
    return Stream.concat(indexes, constraints);
}
Also used : AssertSchemaResult(apoc.result.AssertSchemaResult) ConstraintRelationshipInfo(apoc.result.ConstraintRelationshipInfo) java.util(java.util) Label(org.neo4j.graphdb.Label) org.neo4j.procedure(org.neo4j.procedure) Label.label(org.neo4j.graphdb.Label.label) IndexConstraintNodeInfo(apoc.result.IndexConstraintNodeInfo) StringUtils(org.apache.commons.lang3.StringUtils) Schema(org.neo4j.graphdb.schema.Schema) ExecutionException(java.util.concurrent.ExecutionException) ConstraintDefinition(org.neo4j.graphdb.schema.ConstraintDefinition) Iterables(org.neo4j.helpers.collection.Iterables) Stream(java.util.stream.Stream) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) ConstraintType(org.neo4j.graphdb.schema.ConstraintType) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) RelationshipType(org.neo4j.graphdb.RelationshipType) StreamSupport(java.util.stream.StreamSupport) IndexDefinition(org.neo4j.graphdb.schema.IndexDefinition) Schema(org.neo4j.graphdb.schema.Schema) IndexConstraintNodeInfo(apoc.result.IndexConstraintNodeInfo)

Aggregations

AssertSchemaResult (apoc.result.AssertSchemaResult)1 ConstraintRelationshipInfo (apoc.result.ConstraintRelationshipInfo)1 IndexConstraintNodeInfo (apoc.result.IndexConstraintNodeInfo)1 java.util (java.util)1 ExecutionException (java.util.concurrent.ExecutionException)1 Stream (java.util.stream.Stream)1 StreamSupport (java.util.stream.StreamSupport)1 StringUtils (org.apache.commons.lang3.StringUtils)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Label (org.neo4j.graphdb.Label)1 Label.label (org.neo4j.graphdb.Label.label)1 RelationshipType (org.neo4j.graphdb.RelationshipType)1 ConstraintDefinition (org.neo4j.graphdb.schema.ConstraintDefinition)1 ConstraintType (org.neo4j.graphdb.schema.ConstraintType)1 IndexDefinition (org.neo4j.graphdb.schema.IndexDefinition)1 Schema (org.neo4j.graphdb.schema.Schema)1 Iterables (org.neo4j.helpers.collection.Iterables)1 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)1 org.neo4j.procedure (org.neo4j.procedure)1