Rules

Operations related to Rules. A rule is a statement that defines or constrains some aspect of the business.

Read Rules

Fetch rules stored inside a model. Endpoint allows for:

  • full text search - searching inside: id, name, sparql rule, rule url, passing test case, violating test case for string passed in searchedText field
  • sorting - sorting by allowed values of rules and sorting order (default ascending)
  • filtering - gives option to limit query result by country and criticality Each functionality can be combined to create complex usage of this endpoint.
SecurityapiKey
Request
path Parameters
knowledgeGraphId
required
integer

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelId
required
integer

Used to identify model and objects inside it.

Example: 1
query Parameters
page
integer >= 0
Default: 0

The number of the page to read. Parameter isn't required, by default, set to '0'.

Example: page=0
pageSize
integer >= 0
Default: 10

Maximum number of elements on the page to read. Parameter isn't required. Can't be negative, by default, set to 10.

Example: pageSize=10
publicationStatus
string

If enabled, start filtering based on publication status.

Enum: Description
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: publicationStatus=PUBLISHED
ruleUrl
string

Used to identify rule by its URL.

Example: ruleUrl=https://www.cdq.com/rule/isValidEmail
searchedCountry
string

Used to filter objects.

Example: searchedCountry=Country
searchedCriticality
string

Used to filter objects.

Example: searchedCriticality=Criticality
searchedStatus
string

Used to filter objects. Correct values: * ARCHIVED - Archived status. * BLOCKED - Blocked status. * DEACTIVATED - Deactivated status. * DRAFT - Draft status. * HYPERCARE - Hypercare status. * IDEA - Idea status. * IMPLEMENTED - Implemented status. * PLANNED - Planned status. * RELEASED - Released status. * UNDER_REVIEW - Under review status.

Example: searchedStatus=RELEASED
searchedText
string

Used to filter objects.

Example: searchedText=Searched Text
sort
string

Enables sorting of rules by attributes.

Enum: "COUNTRY" "CREATED_AT" "CREATED_BY" "CRITICALITY" "LAST_EDITOR" "LAST_MODIFICATION" "NAME" "STATUS"
Example: sort=NAME
sortType
string
Default: "ASC"

Allows changing the default sorting order (ASC) to desire by user.

Enum: Description
DESC

Sort in descending order.

ASC

Sort in ascending order.

Example: sortType=ASC
header Parameters
X-Credential-Username
required
string

Username that is passed as header parameter with the name X-Credential-Username. The header can take a form of:

  • username (e.g. "johnjoe")
  • user id (e.g. "87b1bdb1-ba87-4522-b363-c5a0e6e917b3")
Example: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3
Responses
200

OK

401

Unauthorized

403

Forbidden

404

Not Found

get/knowledgegraphs/{knowledgeGraphId}/models/{modelId}/rules
Request samples
Response samples
application/json
{
  • "summary": "Example response of fetching rules",
  • "value": "{\"pageSize\":10,\"page\":0,\"values\":[{\"id\":110,\"name\":\"Email validation\",\"status\":\"IDEA\",\"country\":\"WORLD\",\"criticality\":\"ERROR\",\"businessRuleType\":\"DATA_QUALITY_RULE\",\"sparql\":\"SELECT ?recordId WHERE {\\n ?s <https://cdq.com/KG/Property-3AEMail> ?email .\\n ?s <https://cdq.com/KG/Property-3AHas_record_id> ?recordId .\\n FILTER (!regex(str(?email), \\\"^(.+)@(.+)$\\\")) .\\n}\",\"correctRecord\":\"{ \\\"email\\\": \\\"demouser@cdq.com\\\" }\",\"incorrectRecord\":\"{ \\\"email\\\": \\\"incorre! ct@gmail.com\\\"}\",\"description\":\"Validates email against allowed characters\",\"violationMessage\":\"Email is incorrect\",\"createdAt\":\"2021-12-30T10:46:29\",\"createdBy\":\"demo_user\",\"lastModifier\":\"demo_user\",\"lastModificationDate\":\"2021-12-30T10:46:29\"}],\"total\":1}\n"
}