Skip to content

Knowledge Graph API (1)

A Knowledge Graph is a graph-based data model representation of knowledge within a domain. In other words, it contains nodes and edges that represent entities and the relationships between them. The API should then enable the creation, update, or query with regard to these graphs and their models.

Languages
Servers
Mock server

https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/

Production SOAP

https://api.corporate-data-league.ch/knowledge-graph-api/soap/v1/

Production

https://api.corporate-data-league.ch/knowledge-graph-api/

Concepts

Operations related to Concepts. A concept is a unit of knowledge that is created and managed within a model.

Operations

Concept history

Operations related to Concept history. A concept history is a record of changes made to a concept.

Operations

Imports

Operations related to Imports. An import is a process of bringing data from an external source into the system.

Operations

Knowledge Graphs

Operations related to Knowledge Graphs and their management. A Knowledge Graph is a graph-based data model

Operations

Models

Operations related to Models. A model is a collection of concepts and their relationships.

Operations

Query

Operations related to Query. A query is a request for information from a database.

Rules

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

Operations

Read Rules

Request

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.
Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Query
pageinteger>= 0

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

Default 0
Example: page=0
pageSizeinteger>= 0

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

Default 10
Example: pageSize=10
searchedTextstring

Used to filter objects.

Example: searchedText=Searched Text
searchedCountrystring

Used to filter objects.

Example: searchedCountry=Country
searchedCriticalitystring

Used to filter objects.

Example: searchedCriticality=Criticality
searchedStatusstring

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
ruleUrlstring

Used to identify rule by its URL.

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

If enabled, start filtering based on publication status.

Enum ValueDescription
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: publicationStatus=PUBLISHED
sortstring

Enables sorting of rules by attributes.

Enum"COUNTRY""CREATED_AT""CREATED_BY""CRITICALITY""LAST_EDITOR""LAST_MODIFICATION""NAME""STATUS"
Example: sort=NAME
sortTypestring

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

Default "ASC"
Enum ValueDescription
DESC

Sort in descending order.

ASC

Sort in ascending order.

Example: sortType=ASC
Headers
X-Credential-Usernamestringrequired

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
curl -i -X GET \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rules \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

OK

Bodyapplication/json
pageSizeinteger>= 0required

Number of rules on the page.

Example: "10"
pageinteger>= 0required

Number of the page.

Example: "10"
valuesArray of objects(Rule)required

List of rules.

values[].​idintegerrequired

Rule ID.

Example: "1"
values[].​urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
values[].​namestringrequired

Name of the rule.

Example: "Rule 1"
values[].​statusstringrequired

Represents the status of a rule.

Enum ValueDescription
ARCHIVED

The rule is marked as obsolete, no longer in use.

BLOCKED

The rule is marked as blocked, no longer in use.

DEACTIVATE

The rule is deactivated - either manually or automatically during release because of failed test or quality gate check.

DRAFT

The rule is in draft state.

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status.

IDEA

The rule is an idea.

IMPLEMENTED

The rule is implemented but not released yet.

PLANNED

The rule is ready to be published.

RELEASED

The rule is activated to use to validate data.

UNDER_REVIEW

The rule is waiting for review to be performed.

Example: "ARCHIVED"
values[].​countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
values[].​criticalitystring

Represents the severity of the rule; based on this property, different actions can be taken when the rule fails.

Enum ValueDescription
NO_DEFECT

No defect.

INFO

Information.

WARNING

Warning.

ERROR

Error.

Example: "NO_DEFECT"
values[].​businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
values[].​sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
values[].​correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
values[].​incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
values[].​descriptionstring

Description of the rule.

Example: "Rule description"
values[].​violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
values[].​createdAtstring(CreatedAt)required

Date of creation (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
values[].​createdBystring(CreatedBy)required

Creator of a resource.

Example: "76248934691294444"
values[].​lastModifierstring(UserId)required

Unique ID of a user.

Example: "johndoe"
values[].​lastModificationDatestring(ModifiedAt)required

Date of modification (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
values[].​publicationStatusstring

Publication status of the rule.

Enum ValueDescription
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: "PUBLISHED"
values[].​categorystring

Category of the rule.

Example: "Category"
totalintegerrequired

Total number of rules.

Example: "10"
Response
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" }

Create Rule

Request

Create rule inside a model.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
Bodyapplication/jsonrequired
urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
namestringrequired

Name of the rule.

Example: "Rule 1"
descriptionstring

Description of the rule.

Example: "Rule description"
violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
categorystring

Category of the rule.

Example: "Category"
countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
criticalitystring(RuleCriticalityEnum)

Criticality enum.

Enum ValueDescription
NO_DEFECT

No defect

INFO

Information

WARNING

Warning

ERROR

Error

Example: "NO_DEFECT"
statusstring(RuleStatusEnum)required

Rule status enum.

Enum ValueDescription
ARCHIVED

The Rule is marked as obsolete, no longer in use

BLOCKED

The Rule is marked as blocked, no longer in use

DEACTIVATE

The Rule is deactivated - either manually or automatically by during release because of failed testing or quality gate check

DRAFT

Rule is in draft state

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status

IDEA

Rule is an idea

IMPLEMENTED

Rule is implemented but not released yet

PLANNED

The Rule is ready to be published

RELEASED

Rule is activated to use to validate data

UNDER_REVIEW

Rule is waiting for review to be done

Example: "ARCHIVED"
sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
curl -i -X POST \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rules \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "url": "https://www.cdq.com/rule/isValidEmail",
    "name": "Email validation",
    "description": "Validates email against allowed characters",
    "violationMessage": "Email is incorrect",
    "businessRuleType": "DATA_QUALITY_RULE",
    "category": "https://www.cdq.com/rule/category/validation/email",
    "country": "WORLD",
    "criticality": "ERROR",
    "status": "IDEA",
    "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\"}"
  }'

Responses

Created

Bodyapplication/json
idintegerrequired

Rule ID.

Example: "1"
urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
namestringrequired

Name of the rule.

Example: "Rule 1"
statusstringrequired

Represents the status of a rule.

Enum ValueDescription
ARCHIVED

The rule is marked as obsolete, no longer in use.

BLOCKED

The rule is marked as blocked, no longer in use.

DEACTIVATE

The rule is deactivated - either manually or automatically during release because of failed test or quality gate check.

DRAFT

The rule is in draft state.

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status.

IDEA

The rule is an idea.

IMPLEMENTED

The rule is implemented but not released yet.

PLANNED

The rule is ready to be published.

RELEASED

The rule is activated to use to validate data.

UNDER_REVIEW

The rule is waiting for review to be performed.

Example: "ARCHIVED"
countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
criticalitystring

Represents the severity of the rule; based on this property, different actions can be taken when the rule fails.

Enum ValueDescription
NO_DEFECT

No defect.

INFO

Information.

WARNING

Warning.

ERROR

Error.

Example: "NO_DEFECT"
businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
descriptionstring

Description of the rule.

Example: "Rule description"
violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
createdAtstring(CreatedAt)required

Date of creation (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
createdBystring(CreatedBy)required

Creator of a resource.

Example: "76248934691294444"
lastModifierstring(UserId)required

Unique ID of a user.

Example: "johndoe"
lastModificationDatestring(ModifiedAt)required

Date of modification (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
publicationStatusstring

Publication status of the rule.

Enum ValueDescription
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: "PUBLISHED"
categorystring

Category of the rule.

Example: "Category"
Response
application/json
{ "summary": "Rule created response", "value": "{\"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\"}\n" }

Get Rule

Request

Fetch single rule by ruleId.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
ruleIdintegerrequired

Used to identify Rule.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
curl -i -X GET \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rules/1 \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

OK

Bodyapplication/json
pageSizeinteger>= 0required

Number of rules on the page.

Example: "10"
pageinteger>= 0required

Number of the page.

Example: "10"
valuesArray of objects(Rule)required

List of rules.

values[].​idintegerrequired

Rule ID.

Example: "1"
values[].​urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
values[].​namestringrequired

Name of the rule.

Example: "Rule 1"
values[].​statusstringrequired

Represents the status of a rule.

Enum ValueDescription
ARCHIVED

The rule is marked as obsolete, no longer in use.

BLOCKED

The rule is marked as blocked, no longer in use.

DEACTIVATE

The rule is deactivated - either manually or automatically during release because of failed test or quality gate check.

DRAFT

The rule is in draft state.

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status.

IDEA

The rule is an idea.

IMPLEMENTED

The rule is implemented but not released yet.

PLANNED

The rule is ready to be published.

RELEASED

The rule is activated to use to validate data.

UNDER_REVIEW

The rule is waiting for review to be performed.

Example: "ARCHIVED"
values[].​countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
values[].​criticalitystring

Represents the severity of the rule; based on this property, different actions can be taken when the rule fails.

Enum ValueDescription
NO_DEFECT

No defect.

INFO

Information.

WARNING

Warning.

ERROR

Error.

Example: "NO_DEFECT"
values[].​businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
values[].​sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
values[].​correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
values[].​incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
values[].​descriptionstring

Description of the rule.

Example: "Rule description"
values[].​violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
values[].​createdAtstring(CreatedAt)required

Date of creation (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
values[].​createdBystring(CreatedBy)required

Creator of a resource.

Example: "76248934691294444"
values[].​lastModifierstring(UserId)required

Unique ID of a user.

Example: "johndoe"
values[].​lastModificationDatestring(ModifiedAt)required

Date of modification (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
values[].​publicationStatusstring

Publication status of the rule.

Enum ValueDescription
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: "PUBLISHED"
values[].​categorystring

Category of the rule.

Example: "Category"
totalintegerrequired

Total number of rules.

Example: "10"
Response
application/json
{ "summary": "Fetch single rule", "value": "{\"pageSize\":null,\"page\":null,\"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" }

Update Rules

Request

Update rule identified by ruleId.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
ruleIdintegerrequired

Used to identify Rule.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
Bodyapplication/jsonrequired
urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
namestringrequired

Name of the rule.

Example: "Rule 1"
descriptionstring

Description of the rule.

Example: "Rule description"
violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
categorystring

Category of the rule.

Example: "Category"
countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
criticalitystring(RuleCriticalityEnum)

Criticality enum.

Enum ValueDescription
NO_DEFECT

No defect

INFO

Information

WARNING

Warning

ERROR

Error

Example: "NO_DEFECT"
statusstring(RuleStatusEnum)required

Rule status enum.

Enum ValueDescription
ARCHIVED

The Rule is marked as obsolete, no longer in use

BLOCKED

The Rule is marked as blocked, no longer in use

DEACTIVATE

The Rule is deactivated - either manually or automatically by during release because of failed testing or quality gate check

DRAFT

Rule is in draft state

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status

IDEA

Rule is an idea

IMPLEMENTED

Rule is implemented but not released yet

PLANNED

The Rule is ready to be published

RELEASED

Rule is activated to use to validate data

UNDER_REVIEW

Rule is waiting for review to be done

Example: "ARCHIVED"
sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
curl -i -X PUT \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rules/1 \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "url": "https://www.cdq.com/rule/isValidEmail",
    "name": "Email validation",
    "description": "Validates email against allowed characters",
    "violationMessage": "Email is incorrect",
    "businessRuleType": "DATA_QUALITY_RULE",
    "category": "https://www.cdq.com/rule/category/validation/email",
    "country": "WORLD",
    "criticality": "WARNING",
    "status": "IDEA",
    "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\"}"
  }'

Responses

Rule updated successfully

Bodyapplication/json
idintegerrequired

Rule ID.

Example: "1"
urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
namestringrequired

Name of the rule.

Example: "Rule 1"
statusstringrequired

Represents the status of a rule.

Enum ValueDescription
ARCHIVED

The rule is marked as obsolete, no longer in use.

BLOCKED

The rule is marked as blocked, no longer in use.

DEACTIVATE

The rule is deactivated - either manually or automatically during release because of failed test or quality gate check.

DRAFT

The rule is in draft state.

HYPERCARE

Active rule after transitioning from PLANNED or DEACTIVATED status.

IDEA

The rule is an idea.

IMPLEMENTED

The rule is implemented but not released yet.

PLANNED

The rule is ready to be published.

RELEASED

The rule is activated to use to validate data.

UNDER_REVIEW

The rule is waiting for review to be performed.

Example: "ARCHIVED"
countrystring

Represents country that rule applies to, valid in ISO-2 format.

Example: "DE"
criticalitystring

Represents the severity of the rule; based on this property, different actions can be taken when the rule fails.

Enum ValueDescription
NO_DEFECT

No defect.

INFO

Information.

WARNING

Warning.

ERROR

Error.

Example: "NO_DEFECT"
businessRuleTypestringrequired

Type of business rule.

Enum ValueDescription
AUTOMATION_RULE

Custom automation rule that allows for generating decisions in data maintenance workflows based on data quality rules, automated data enrichments or lookups.

DATA_QUALITY_RULE

Also known as data validation rule, defines business requirements for specific data.

Example: "AUTOMATION_RULE"
sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
descriptionstring

Description of the rule.

Example: "Rule description"
violationMessagestring

Message to display when rule fails.

Example: "Rule failed"
createdAtstring(CreatedAt)required

Date of creation (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
createdBystring(CreatedBy)required

Creator of a resource.

Example: "76248934691294444"
lastModifierstring(UserId)required

Unique ID of a user.

Example: "johndoe"
lastModificationDatestring(ModifiedAt)required

Date of modification (ISO 8601-compliant).

Example: "2020-08-31T16:47+00:00"
publicationStatusstring

Publication status of the rule.

Enum ValueDescription
PUBLISHED

Published status.

UNPUBLISHED

Unpublished status.

Example: "PUBLISHED"
categorystring

Category of the rule.

Example: "Category"
Response
application/json
{ "summary": "Update rule response", "value": "{\"id\":110,\"name\":\"Email validation\",\"status\":\"IDEA\",\"country\":\"WORLD\",\"criticality\":\"WARNING\",\"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-30T12:29:11\",\"createdBy\":\"demo_user\",\"lastModifier\":\"demo_user\",\"lastModificationDate\":\"2021-12-30T12:29:11\"}\n" }

Delete Rules

Request

Deletes rule identified by ruleId.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
ruleIdintegerrequired

Used to identify Rule.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
curl -i -X DELETE \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rules/1 \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

Rule deleted successfully

Check Rule Before Creation

Request

Test rule against data, rule does not need to be released prior to testing.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
Bodyapplication/jsonrequired
sparqlstringrequired

SPARQL rule that is used for validation of data.

Example: "SELECT * WHERE { ?s ?p ?o }"
correctRecordstringrequired

Test case containing a record that passes the validation against SPARQL rule.

Example: "SELECT * WHERE { ?s ?p ?o }"
incorrectRecordstringrequired

Test case containing a record that does not pass the validation against SPARQL rule.

Example: "SELECT WHERE { ?s ?p ?"
curl -i -X POST \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rule/test \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

OK

Bodyapplication/json
checkOutcomestringrequired

Outcome of the rule check.

Enum ValueDescription
VALID

Rule check is valid.

INVALID

Rule check is invalid.

Example: "VALID"
testCaseListArray of objects(TestcaseResponse)

List of test cases.

Response
application/json
"{\"checkOutcome\": \"INVALID\", \"testCaseList\": [{\"testCaseName\": \"correctRecord\",\"status\": \"status\",\"sparqlMessage\": \"An unexpected character at line 1, column 130, please check your test case\"},{\"testCaseName\": \"incorrectRecord\",\"status\": \"status\",\"sparqlMessage\": \"result\"}]}\n"

Export Rules

Request

Exporting rule(s) as CSV file.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Query
ruleIdListArray of integers

Used to retrieve a list of rules by their id's.

Example: ruleIdList=1
Headers
X-Credential-Usernamestringrequired

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
Bodyapplication/jsonrequired
fieldsArray of strings

List of fields that should be included in the CSV file.

Items Enum ValueDescription
URL

URL of the rule.

NAME

Name of the rule.

STATUS

Status of the rule.

CRITICALITY

Criticality of the rule.

BUSINESSRULETYPE

Type of business rule.

DESCRIPTION

Description of the rule.

COUNTRY

Country that rule applies to.

SPARQL

SPARQL rule that is used for validation of data.

CORRECTRECORD

Test case containing a record that passes the validation against SPARQL rule.

INCORRECTRECORD

Test case containing a record that does not pass the validation against SPARQL rule.

Example: ["URL"]
curl -i -X POST \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rule/export \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "fields": [
      "CATEGORY",
      "NAME",
      "DESCRIPTION",
      "VIOLATIONMESSAGE",
      "INCORRECTRECORD",
      "URL",
      "PUBLICATIONSTATUS"
    ]
  }'

Responses

OK

Bodyapplication/json
linkToCSVPathstring

Path to CSV file.

Example: "https://s3.eu-central-1.amazonaws.com/cdq-kg-exports/1/2/3.csv"
Response
application/json
{ "summary": "Successfully exported rule as CSV file.", "value": "{ \"linkToCSVPath\": \"knowledgegraphs/pathToFolder/userName-2022-11-14T09-04-01.082706266.csv.gz\"}\n" }

Release New Version

Request

Test rule against data, rule does not need to be released prior to testing.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
ruleIdintegerrequired

Used to identify Rule.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
curl -i -X GET \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rule/1/test \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3'

Responses

OK

Bodyapplication/json
checkOutcomestringrequired

Outcome of the rule check.

Enum ValueDescription
VALID

Rule check is valid.

INVALID

Rule check is invalid.

Example: "VALID"
testCaseListArray of objects(TestcaseResponse)

List of test cases.

Response
application/json
"{\"checkOutcome\":\"INVALID\",\"message\":\"\",\"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\\\"}\"}}\n"

Rule Update Status

Request

Update rule's status.

Security
basicAuth
Path
knowledgeGraphIdintegerrequired

Used to identify Knowledge Graph and objects inside it.

Example: 1
modelIdintegerrequired

Used to identify model and objects inside it.

Example: 1
Headers
X-Credential-Usernamestringrequired

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
Bodyapplication/jsonrequired
urlstringrequired

URL of the rule.

Example: "https://www.cdq.com/rule/1"
statusstringrequired

Represents the status of a rule.

Example: "ARCHIVED"
editIdintegerrequired

Edit ID.

Example: "1"
curl -i -X PUT \
  -u <username>:<password> \
  https://idp.cdq.com/_mock/apis/knowledge-graph-api/api-v1/knowledgegraphs/1/models/1/rule/status \
  -H 'Content-Type: application/json' \
  -H 'X-Credential-Username: 87b1bdb1-ba87-4522-b363-c5a0e6e917b3' \
  -d '{
    "summary": "Update rule'\''s status to `RELEASED`.",
    "value": "{\"url\":\"https://www.cdq.com/rule/isValidEmail\",\"status\":\"RELEASED\",\"editId\":1}\n"
  }'

Responses

OK

Translation

Operations related to Translation. Translation is the communication of a source language text's meaning through an equivalent target language text.

Operations

Validation Graph

Operations related to Validation Graphs. A Validation Graph is a graph-based data model representation of knowledge within a domain.

Operations

Values

Operations related to Values. A value is a piece of information that is stored in a database.

Operations