Skip to content

knowledge_model.py

KnowledgeModel (Node)

Knowledge Model object to interact with Celonis Studio API.

url: str inherited property readonly

API

  • /package-manager/api/nodes/{node_id}

attachment_url: str inherited property readonly

API

  • /package-manager/api/attachments

viewer_attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node with mode VIEWER.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

content: Dict property readonly

Get content of the Knowledge Model as raw dict. Content is loaded form final endpoint to also obtain content of a possible base model. Content is loaded from endpoint if initial load or self.static = False.

API

  • POST: /semantic-layer/api/layer/{root_node_key}.{key}/final
    {
        "withVariableReplacement": False,
        "withAutogeneratedDataModelData": False
    }
    

Returns:

Type Description
Dict

Content as Dictionary.

creator_attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node with mode CREATOR.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

name: str inherited property writable

Name of the object via data['name'] if available.

data inherited property writable

Response data from the Celonis API. If static is set to False, every time you set the data property will execute a POST request to the resource API endpoint to update the remote resource in Celonis EMS.

Examples:

o = celonis.<api-service>.find("<name or ID")

# This will execute a `POST` request to '<celonis_url>/<api-service>/api/...'
o.data["name"] = "New Name"

draft: KnowledgeModelDraft property readonly

Obtain a draft of this knowledge model to edit content. Draft is designed to behave similarly to the UI YAML edit mode.

Exceptions:

Type Description
PyCelonisValueError

Draft is allowed with static=False (eager loading).

Returns:

Type Description
KnowledgeModelDraft

Editable draft version of this Knowledge Model.

key: str inherited property writable

Key of the object via data['key'] if available.

custom_objects: List[Dict] property readonly

Returns custom objects of the Knowledge Model and its base model in case of an extension.

Returns:

Type Description
List[Dict]

List of custom objects.

kpis: CelonisCollection[KPI] property readonly

Get all KPIs of the Knowledge Model and its base model in case of an extension.

Returns:

Type Description
CelonisCollection[KPI]

A Collection of KPIs.

filters: CelonisCollection[KnowledgeModelPQLFilter] property readonly

Get all Filters of the Knowledge Model and its base model in case of an extension.

Returns:

Type Description
CelonisCollection[KnowledgeModelPQLFilter]

A Collection of Filters.

variables: List[Dict] property readonly

Get all Variables of the Knowledge Model and its base model in case of an extension.

Returns:

Type Description
List[Dict]

List of variables

records: CelonisCollection[Record] property readonly

Get all Records of knowledge model and its base model in case of an extension.

Returns:

Type Description
CelonisCollection[Record]

A Collection of Records.

create_attachment(self, name, configuration, shareable=True, mode='CREATOR') inherited

Creates a new Attachment in the Node.

Parameters:

Name Type Description Default
name str

Name of attachment

required
configuration str

Dictionary with content of attachment

required
shareable bool

Whether attachment is shareable or not

True
mode str

Attachment mode. One of [VIEWER, CREATOR]

'CREATOR'

Returns:

Type Description
Attachment

The newly created Attachment.

reset_state(self) inherited

Resets data = None. This will force a reload of the remote resource from Celonis EMS on the next property access.

delete(self) inherited

Executes a DELETE request to the resource API endpoint to delete the remote resource in Celonis EMS.

KnowledgeModelDraft (Node)

Knowledge Model Draft object to interact with Celonis Studio API.

url: str inherited property readonly

API

  • /package-manager/api/nodes/{node_id}

attachment_url: str inherited property readonly

API

  • /package-manager/api/attachments

viewer_attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node with mode VIEWER.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

creator_attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node with mode CREATOR.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

attachments: CelonisCollection[Attachment] inherited property readonly

Get all Attachments of the Node.

Returns:

Type Description
CelonisCollection[Attachment]

A Collection of Attachments.

name: str inherited property writable

Name of the object via data['name'] if available.

data inherited property writable

Response data from the Celonis API. If static is set to False, every time you set the data property will execute a POST request to the resource API endpoint to update the remote resource in Celonis EMS.

Examples:

o = celonis.<api-service>.find("<name or ID")

# This will execute a `POST` request to '<celonis_url>/<api-service>/api/...'
o.data["name"] = "New Name"

key: str inherited property writable

Key of the object via data['key'] if available.

content: Dict property writable

Get/Set the Content of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
Dict

Content of Knowledge Model.

custom_objects: List[Dict] property writable

Get/Set Custom Objects of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
List[Dict]

List of custom objects

kpis: List[Dict] property writable

Get/Set KPI objects of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
List[Dict]

List of KPIs.

filters: List[Dict] property writable

Get/Set Filter objects of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
List[Dict]

List of Filters.

variables: List[Dict] property writable

Get/Set Variable objects of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
List[Dict]

List of variables

records: List[Dict] property writable

Get/Set Record objects of the Knowledge Model, excluding a possible base model.

Returns:

Type Description
List[Dict]

List of records

create_attachment(self, name, configuration, shareable=True, mode='CREATOR') inherited

Creates a new Attachment in the Node.

Parameters:

Name Type Description Default
name str

Name of attachment

required
configuration str

Dictionary with content of attachment

required
shareable bool

Whether attachment is shareable or not

True
mode str

Attachment mode. One of [VIEWER, CREATOR]

'CREATOR'

Returns:

Type Description
Attachment

The newly created Attachment.

reset_state(self) inherited

Resets data = None. This will force a reload of the remote resource from Celonis EMS on the next property access.

delete(self) inherited

Executes a DELETE request to the resource API endpoint to delete the remote resource in Celonis EMS.

add_custom_object(self, id, display_name, custom_attributes=None)

Adds a Custom Object to the Knowledge Model.

Parameters:

Name Type Description Default
id str

ID of the Custom Object.

required
display_name str

Display name used to display the Custom Object.

required
custom_attributes Dict

Attributes of the Custom Object.

None

Exceptions:

Type Description
PyCelonisValueError

If 'id' is not set or already exists.

PyCelonisValueError

If 'display_name' is not set.

remove_custom_object(self, id)

Removes a Custom Object from the Knowledge Model by ID.

Parameters:

Name Type Description Default
id str

ID of the Custom Object.

required

add_record(self, id, display_name, identifier=None, pql=None, filter_ids=None, attributes=None)

Adds a Record object to the Knowledge Model.

Parameters:

Name Type Description Default
id str

ID of the Record.

required
display_name str

Display name used to display the Record.

required
identifier Dict[str, str]

Identifier of the Record.

None
pql str

PQL of the Record.

None
filter_ids List[str]

Filter IDs of the Record.

None
attributes List[Dict[str, str]]

Attributes of the Record.

None

remove_record(self, id)

Removes the Record from the Knowledge Model by ID.

Parameters:

Name Type Description Default
id str

ID of the Record.

required

KnowledgeModelPQL

A PQL in a Knowledge Model.

query: str property writable

Get the PQL query of the Knowledge Model object.

KnowledgeModelPQLColumn (KnowledgeModelPQL, PQLColumn)

A PQL Column in a Knowledge Model.

query: str inherited property writable

Get the PQL query of the Knowledge Model object.

KnowledgeModelPQLFilter (KnowledgeModelPQL, PQLFilter)

A PQL Filter in a Knowledge Model.

query: str inherited property writable

Get the PQL query of the Knowledge Model object.

count(self, sub, start=0, end=9223372036854775807) inherited

S.count(value) -> integer -- return number of occurrences of value

index(self, sub, start=0, end=9223372036854775807) inherited

S.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

KPI (KnowledgeModelPQLColumn)

A KPI in a Knowledge Model.

query: str inherited property writable

Get the PQL query of the Knowledge Model object.

VariableEvaluator

Helper class to evaluate variables in a PQL string.

evaluate_variables(pql_string, variables) staticmethod

Evaluates the variables in a PQL string.

Parameters:

Name Type Description Default
pql_string str

PQL to be evaluated.

required
variables List[Dict]

List of Knowledge Model variables to be processed.

required

Returns:

Type Description
str

Evaluated PQL string.

KPIEvaluator

Helper class to evaluate kpis in a PQL string.

evaluate_kpis(pql_string, kpis) staticmethod

Evaluates the KPIs in a PQL string.

Parameters:

Name Type Description Default
pql_string str

PQL to be evaluated.

required
kpis CelonisCollection

Collection of Knowledge Model KPIs to be processed.

required

Returns:

Type Description
str

Evaluated PQL string.

Record (PQL)

A Record in a Knowledge Model.

query: List inherited property readonly

Get the PQL query list in Celonis engine format, containing a TABLE statement and optional filters.

add(self, obj) inherited

Tries to add the given object to the PQL query.

Parameters:

Name Type Description Default
obj Union[PQL, PQLColumn, PQLFilter, Dict, Iterable]
  • If PQLColumn, upserts the column based on name.
  • If PQLFilter, adds to filters, if exact filter string already exists does nothing.
  • If dict, checks whether dict looks like Celonis variable and if so upserts the new variable on name. If the variable is a static value the result should already be calculated before adding it.
  • If PQL, does the above for all columns, filters and variables.
  • If abc.Iterable (e.g. list), does the above for each object in the abc.Iterable.
required

Exceptions:

Type Description
PyCelonisTypeError

If type of obj is not supported.

Back to top