21.16. Constraints

Create uniqueness constraint

Create a uniqueness constraint on a property.

Example request

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

Example response

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

Example response

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

Get all uniqueness constraints for a label

Example request

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1452643240288_1" ],
  "label" : "label_1452643240288_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1452643240288_2" ],
  "label" : "label_1452643240288_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_1452643239640_1/uniqueness/property_1452643239640_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_1452645351611_1/existence/property_1452645351611_1
  • Accept: application/json; charset=UTF-8

Example response

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

Example response

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

Get all constraints for a label

Example request

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

Example response

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

Example response

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1452645351406_1",
  "property_keys" : [ "property_1452645351406_2" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
}, {
  "relationshipType" : "relationshipType_1452645351406_1",
  "property_keys" : [ "property_1452645351406_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_1452643239840_1" ],
  "label" : "label_1452643239840_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1452643239766_1" ],
  "label" : "label_1452643239766_1",
  "type" : "UNIQUENESS"
} ]