20.16. Constraints

Create uniqueness constraint

Create a uniqueness constraint on a property.

Example request

  • POST http://localhost:7474/db/data/schema/constraint/label_1465360175185_1/uniqueness/
  • Accept: application/json; charset=UTF-8
  • Content-Type: application/json
{
  "property_keys" : [ "property_1465360175185_1" ]
}

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
{
  "label" : "label_1465360175185_1",
  "type" : "UNIQUENESS",
  "property_keys" : [ "property_1465360175185_1" ]
}

Get a specific uniqueness constraint

Get a specific uniqueness constraint for a label and a property.

Example request

  • GET http://localhost:7474/db/data/schema/constraint/label_1465360175515_1/uniqueness/property_1465360175515_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465360175515_1" ],
  "label" : "label_1465360175515_1",
  "type" : "UNIQUENESS"
} ]

Get all uniqueness constraints for a label

Example request

  • GET http://localhost:7474/db/data/schema/constraint/label_1465360175465_1/uniqueness/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465360175465_1" ],
  "label" : "label_1465360175465_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1465360175465_2" ],
  "label" : "label_1465360175465_1",
  "type" : "UNIQUENESS"
} ]

Drop uniqueness constraint

Drop uniqueness constraint for a label and a property.

Example request

  • DELETE http://localhost:7474/db/data/schema/constraint/label_1465360175062_1/uniqueness/property_1465360175062_1
  • Accept: application/json; charset=UTF-8

Example response

  • 204: No Content

Get a specific node property existence constraint

Get a specific node property existence constraint for a label and a property.

Example request

  • GET http://localhost:7474/db/data/schema/constraint/label_1465364825138_1/existence/property_1465364825138_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465364825138_1" ],
  "label" : "label_1465364825138_1",
  "type" : "NODE_PROPERTY_EXISTENCE"
} ]

Get all node property existence constraints for a label

Example request

  • GET http://localhost:7474/db/data/schema/constraint/label_1465364825213_1/existence/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465364825213_2" ],
  "label" : "label_1465364825213_1",
  "type" : "NODE_PROPERTY_EXISTENCE"
}, {
  "property_keys" : [ "property_1465364825213_1" ],
  "label" : "label_1465364825213_1",
  "type" : "NODE_PROPERTY_EXISTENCE"
} ]

Get all constraints for a label

Example request

  • GET http://localhost:7474/db/data/schema/constraint/label_1465360175390_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465360175390_1" ],
  "label" : "label_1465360175390_1",
  "type" : "UNIQUENESS"
} ]

Get a specific relationship property existence constraint

Get a specific relationship property existence constraint for a label and a property.

Example request

  • GET http://localhost:7474/db/data/schema/relationship/constraint/relationshipType_1465364822822_1/existence/property_1465364822822_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1465364822822_1",
  "property_keys" : [ "property_1465364822822_1" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
} ]

Get all relationship property existence constraints for a type

Example request

  • GET http://localhost:7474/db/data/schema/relationship/constraint/relationshipType_1465364825009_1/existence/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1465364825009_1",
  "property_keys" : [ "property_1465364825009_2" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
}, {
  "relationshipType" : "relationshipType_1465364825009_1",
  "property_keys" : [ "property_1465364825009_1" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
} ]

Get all constraints

Example request

  • GET http://localhost:7474/db/data/schema/constraint
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465360175185_1" ],
  "label" : "label_1465360175185_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1465360175224_1" ],
  "label" : "label_1465360175224_1",
  "type" : "UNIQUENESS"
} ]