- URL:
- https://<kgserveradmin_datamodel-url>/constraintRules
- Methods:
GET- Operations:
- Add, Delete, Update
- Version Introduced:
- 11.3
Description
A knowledge graph service's constraint 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 Apply operation. If a relationship matches the pattern defined by an exclusion rule it is considered invalid and will be rejected by the Apply 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 category which excludes types from the set. Importantly when assigning the SET 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 constraint 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 Delete PBF-formatted response.
Examples
The following portion of a query response includes the system constraint rule that relationships of type 'HasDocument' can only have a destination entity of type 'Document'.
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 Entity | Relationship | Destination Entity | ApplyEdits Result |
|---|---|---|---|
Person | HasDocument | Vehicle |
|
Vehicle | HasDocument | Document |
|
The following portion of a query response includes the system constraint rules that 'Provenance' cannot be the origin entity type or destination entity type.
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 Entity | Relationship | Destination Entity | ApplyEdits Result |
|---|---|---|---|
Person | HasDocument | Document |
|
Provenance | Owns | Document |
|
Request parameters
| Parameter | Details |
|---|---|
| The response format. The only supported format is |
Example usage
The following is a sample request URL for a knowledge graph service named Supply :
https://organization.example.com/<context>/rest/admin/services/Hosted/SupplyChain/KnowledgeGraphServer/dataModel/constraintRules?f=html