Skip to content
URL:
https://<kgserveradmin_datamodel-url>/constraintRules
Methods:
GET
Operations:
Add, Delete, Update
Version Introduced:
11.3

Description

A knowledge graph service's constraintRules resource allows an administrative client to define relationship exclusion rules. Relationship exclusion rules are a type of constraint rule that define which relationships are possible between different entities in the knowledge graph service data model. When enabled, constraint rules are applied on relationships during the ApplyEdits operation. If a relationship matches the pattern defined by an exclusion rule it is considered invalid and will be rejected by the ApplyEdits operation.

Use the data model query operation to learn about the constraint rules that are defined in the schema.

Relationship exclusion rules consist of sets of origin entity types, sets of relationship types, and sets of destination entity types. Each set of types within a relationship exclusion rule can be assigned one of the following type categories: the SET category includes types within the set, or SET_COMPLEMENT category which excludes types from the set. Importantly when assigning the SET_COMPLEMENT type category, and specifying an empty set, all types are included. Once a relationship exclusion rule is created, the type category cannot be changed.

Relationship exclusion rules can be created, modified, or removed at any time using the add, update, and delete operations within the constraintRules resource. If a relationship exclusion rule includes a type in the delete operation of data model's named type resource, a warning is returned in the DeleteNamedType PBF-formatted response.

Examples

The following portion of a queryDataModel response includes the system constraint rule that relationships of type 'HasDocument' can only have a destination entity of type 'Document'.

Use dark colors for code blocksCopy
1
2
3
4
5
6
originEntityTypesCategory: SET_COMPLEMENT
originEntityTypes: []
relationshipTypesCategory: SET
relationshipTypes: [HasDocument]
destinationEntityTypesCategory: SET_COMPLEMENT
destinationEntityTypes: [Document]

The table below shows the result based on the above relationship exclusion rule.

Origin EntityRelationshipDestination EntityApplyEdits Result

Person

HasDocument

Vehicle

FAIL match is true for exclusion rule

Vehicle

HasDocument

Document

PASS match is false for exclusion rule

The following portion of a queryDataModel response includes the system constraint rules that 'Provenance' cannot be the origin entity type or destination entity type.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
  originEntityTypesCategory: SET_COMPLEMENT
  originEntityTypes: []
  relationshipTypesCategory: SET_COMPLEMENT
  relationshipTypes: []
  destinationEntityTypesCategory: SET
  destinationEntityTypes: [Provenance]

  originEntityTypesCategory: SET
  originEntityTypes: [Provenance]
  relationshipTypesCategory: SET_COMPLEMENT
  relationshipTypes: []
  destinationEntityTypesCategory: SET_COMPLEMENT
  destinationEntityTypes: []

The table below shows the results based on the above relationship exclusion rules.

Origin EntityRelationshipDestination EntityApplyEdits Result

Person

HasDocument

Document

PASS match is false for exclusion rule 1 and false for exclusion rule 2

Provenance

Owns

Document

FAIL match is false for exclusion rule 1 and true for exclusion rule 2

Request parameters

ParameterDetails

f

The response format. The only supported format is html.

Example usage

The following is a sample request URL for a knowledge graph service named SupplyChain :

Use dark colors for code blocksCopy
1
https://organization.example.com/<context>/rest/admin/services/Hosted/SupplyChain/KnowledgeGraphServer/dataModel/constraintRules?f=html

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.