21.16. Constraints

Create uniqueness constraint

Create a uniqueness constraint on a property.

Example request

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

Example response

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

Example response

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

Get all uniqueness constraints for a label

Example request

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1454105736700_2" ],
  "label" : "label_1454105736700_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1454105736700_1" ],
  "label" : "label_1454105736700_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_1454105736114_1/uniqueness/property_1454105736114_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_1454109113743_1/existence/property_1454109113743_1
  • Accept: application/json; charset=UTF-8

Example response

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

Example response

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

Get all constraints for a label

Example request

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

Example response

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

Example response

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

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "relationshipType" : "relationshipType_1454109113580_1",
  "property_keys" : [ "property_1454109113580_2" ],
  "type" : "RELATIONSHIP_PROPERTY_EXISTENCE"
}, {
  "relationshipType" : "relationshipType_1454109113580_1",
  "property_keys" : [ "property_1454109113580_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_1454105736238_1" ],
  "label" : "label_1454105736238_1",
  "type" : "UNIQUENESS"
}, {
  "property_keys" : [ "property_1454105736317_1" ],
  "label" : "label_1454105736317_1",
  "type" : "UNIQUENESS"
} ]