private Boolean constraintsExistsForRelationship(String type, List<String> propertyNames) {
        Schema schema = db.schema();

        for (ConstraintDefinition constraintDefinition : Iterables.asList(schema.getConstraints(RelationshipType.withName(type)))) {
            List<String> properties = Iterables.asList(constraintDefinition.getPropertyKeys());

            if (properties.equals(propertyNames)) {
                return true;
            }
        }

        return false;
    }
private Boolean constraintsExistsForRelationship ( String type , List < String > propertyNames ) { Schema schema = db . schema ( ) ; for ( ConstraintDefinition constraintDefinition : Iterables . asList ( schema . getConstraints ( RelationshipType . withName ( type ) ) ) ) { List < String > properties = Iterables . asList ( constraintDefinition . getPropertyKeys ( ) ) ; if ( properties . equals ( propertyNames ) ) { return true ; } } return false ; }
Checks if a constraint exists for a given type and a list of properties
This method checks for constraints on relationships

@param type
@param propertyNames
@return true if the constraint exists otherwise it returns false