Skip to content

knowledge_model.py

KnowledgeModel (Node)

Knowledge Model object to interact with Celonis Studio API.

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.

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.

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.

KnowledgeModelDraft (Node)

Knowledge Model Draft object to interact with Celonis Studio API.

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

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.

KnowledgeModelPQLFilter (KnowledgeModelPQL, PQLFilter)

A PQL Filter in a Knowledge Model.

KPI (KnowledgeModelPQLColumn)

A KPI in a Knowledge Model.

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 pycelonis.celonis_api.base_objects.celonis_data_objects.CelonisCollection[celonis_api.studio.knowledge_model.KPI]

Collection of Knowledge Model KPIs to be processed.

required

Returns:

Type Description
str

Evaluated PQL string.

Record (PQL)

A Record in a Knowledge Model.