21.16. Constraints

Create uniqueness constraint

Create a uniqueness constraint on a property.

Example request

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
{
  "label" : "label_1458673525444_1",
  "type" : "UNIQUENESS",
  "property_keys" : [ "property_1458673525444_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_1458673526178_1/uniqueness/property_1458673526178_1
  • Accept: application/json; charset=UTF-8

Example response

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

Get all uniqueness constraints for a label

Example request

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1458673526055_1" ],
  "label" : "label_1458673526055_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1458673526055_2" ],
  "label" : "label_1458673526055_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_1458673525276_1/uniqueness/property_1458673525276_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_1458676696923_1/existence/property_1458676696923_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1458676696923_1" ],
  "label" : "label_1458676696923_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_1458676697049_1/existence/
  • Accept: application/json; charset=UTF-8

Example response

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

Get all constraints for a label

Example request

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1458673525826_1" ],
  "label" : "label_1458673525826_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_1458676694347_1/existence/property_1458676694347_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1458676694347_1",
  "property_keys" : [ "property_1458676694347_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_1458676696730_1/existence/
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1458676696730_1",
  "property_keys" : [ "property_1458676696730_2" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
}, {
  "relationshipType" : "relationshipType_1458676696730_1",
  "property_keys" : [ "property_1458676696730_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_1458673525561_1" ],
  "label" : "label_1458673525561_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1458673525444_1" ],
  "label" : "label_1458673525444_1",
  "type" : "UNIQUENESS"
} ]