Explore the ASAM ODS Data Model#
In this example Notebook, we show you how to explore the data model of your Peak ODS Server.
Understanding the data model is important once it comes to query (instance) data from your Peak ODS Server.
The first sections are on initializing and connecting. The fun starts with “ASAM ODS Data Model”.
Dependencies for this notebook#
The ASAM ODSBox contains some functionality that wraps the ODS HTTP API making using Python easier ;-)
try:
import odsbox
except:
!pip install odsbox
from odsbox.con_i import ConI
ASAM ODS Data Model#
Establish session#
The ODS HTTP API is a session based API. The session ID is called con_i in the ODS documentation. The ASAM ODSBox uses con_i as API object representing the session. Close this session to release the connection license. Otherwise the session will be auto closed after 30 minutes of inactivity.
con_i = ConI(url='https://docker.peak-solution.de:10032/api', auth=('Demo','mdm'))
Explore the Data Model#
The data model describes the way your data is stored in the Peak ODS Server. The data model consists of entities (you can compare them to class-definitions) and their according attributes and relations to other entities.
model = con_i.model()
List all Entities#
Entities are the major building blocks of the data model. You typically query for instances of entities to explore your data. Let’s list all entities to see what we have
for entity in model.entities:
print(entity)
TplTestEquipmentRoot
Status
MDMRole
CatTestEquipmentComp
UnitUnderTest
StructureLevel
CatTestEquipmentAttr
LocalColumn
CatUnitUnderTestAttr
TplTestEquipmentAttr
ValueList
MDMAttr
MDMTagParameter
MDMTag
TestEquipment
TplTest
SubMatrix
TplTestStep
Project
ToCondition
UserParameter
TplUnitUnderTestAttr
CatTestSequenceAttr
Domain
WorkflowParameter
MDMLocalization
InitToken
Unit
ValueListValue
TestSequence
MeaResult
ToAction
NameMap
TplUnitUnderTestComp
MDMGroup
CatUnitUnderTestComp
FavouriteLists
TplTestSequenceRoot
TplParameter
Test
ExtSystem
ExternalComponent
CatSensor
TestStep
AttributeMap
CatTestSequenceComp
PhysDimension
MDMTagParameterSet
TplTestEquipmentComp
StatusValidity
TplSubMatrix
MDMLog
WorkflowParameterSet
MeaQuantity
ResultParameterSet
TokenType
CatSensorAttr
Classification
TplMeaResult
ProjectDomain
Workflow
WorkflowRun
Role
Environment
ActionRun
TplSensorAttr
DynToken
TplSensor
TplParameterSet
SystemParameter
MDMFunction
Condition
Action
ResultParameter
TplUnitUnderTestRoot
ExtSystemAttr
Quantity
TplGroup
User
TplTestSequenceAttr
TplTestStepUsage
TplTestSequenceComp
Examine a specific entitiy#
The entitiy definition contains some information of the entity itself and all attributes and references of this entity.
Have a specifc look to the base_name - in other data models your specific entity may have a diferent name. You can use the base_name for data model agnostic queries.
Also the aid can be of importance of you deal directly with the ASAM ODS REST API, not using JAQueL.
model.entities["Unit"]
name: "Unit"
base_name: "AoUnit"
aid: 54
attributes {
key: "dB"
value {
name: "dB"
data_type: DT_BOOLEAN
length: 1
id: 7
}
}
attributes {
key: "dB_reference_factor"
value {
name: "dB_reference_factor"
data_type: DT_FLOAT
length: 1
id: 8
}
}
attributes {
key: "Offset"
value {
name: "Offset"
base_name: "offset"
data_type: DT_DOUBLE
length: 1
obligatory: true
id: 6
}
}
attributes {
key: "Name"
value {
name: "Name"
base_name: "name"
data_type: DT_STRING
length: 50
obligatory: true
unique: true
id: 1
}
}
attributes {
key: "MimeType"
value {
name: "MimeType"
base_name: "mime_type"
data_type: DT_STRING
length: 256
obligatory: true
id: 2
}
}
attributes {
key: "Id"
value {
name: "Id"
base_name: "id"
data_type: DT_LONGLONG
length: 1
obligatory: true
unique: true
autogenerated: true
}
}
attributes {
key: "Factor"
value {
name: "Factor"
base_name: "factor"
data_type: DT_DOUBLE
length: 1
obligatory: true
id: 5
}
}
attributes {
key: "Description"
value {
name: "Description"
base_name: "description"
data_type: DT_STRING
length: 500
id: 3
}
}
attributes {
key: "DateCreated"
value {
name: "DateCreated"
base_name: "version_date"
data_type: DT_DATE
length: 30
id: 4
}
}
relations {
key: "WorkflowParameter"
value {
name: "WorkflowParameter"
base_name: "parameters"
inverse_name: "Unit"
inverse_base_name: "unit"
entity_name: "WorkflowParameter"
entity_aid: 73
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
relations {
key: "TplParameter"
value {
name: "TplParameter"
base_name: "parameters"
inverse_name: "Unit"
inverse_base_name: "unit"
entity_name: "TplParameter"
entity_aid: 71
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
relations {
key: "ResultParameter"
value {
name: "ResultParameter"
base_name: "parameters"
inverse_name: "Unit"
inverse_base_name: "unit"
entity_name: "ResultParameter"
entity_aid: 66
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
relations {
key: "Quantities"
value {
name: "Quantities"
base_name: "quantities"
inverse_name: "Unit"
inverse_base_name: "default_unit"
entity_name: "Quantity"
entity_aid: 55
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
relations {
key: "PhysDimension"
value {
name: "PhysDimension"
base_name: "phys_dimension"
inverse_name: "Units"
inverse_base_name: "units"
entity_name: "PhysDimension"
entity_aid: 47
range_min: 1
range_max: 1
inverse_range_max: -1
relation_type: RT_INFO
relationship: RS_INFO_TO
}
}
relations {
key: "MeaQuantities"
value {
name: "MeaQuantities"
base_name: "measurement_quantities"
inverse_name: "Unit"
inverse_base_name: "unit"
entity_name: "MeaQuantity"
entity_aid: 80
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
relations {
key: "MDMTagParameter"
value {
name: "MDMTagParameter"
base_name: "parameters"
inverse_name: "Unit"
inverse_base_name: "unit"
entity_name: "MDMTagParameter"
entity_aid: 65
virtual_reference: true
range_max: -1
inverse_range_max: 1
relation_type: RT_INFO
relationship: RS_INFO_FROM
}
}
Examine Attributes#
Looking at the attributes is also important when examine the data model. Like entities, also attributes can have a base_name to be used for data model agnostsic queries.
Furthermore data_type and obligatory information is important - especially when it comes to writing data
model.entities["Unit"].attributes["Name"]
name: "Name"
base_name: "name"
data_type: DT_STRING
length: 50
obligatory: true
unique: true
id: 1
Examine Relations#
Relations describe the connection between entities. In a data model relations are important for exploring the data neighbors. Relations have names to identify them (think of identifying a specific tire like “front left”) and the definition of the entity they’re pointing to: the entity_name. With range_min and range_max you can determine whether a relation is obligatory. In case a relation has also a (parallel) backward relation, the inverse_name contains this information.
model.entities["Unit"].relations["PhysDimension"]
name: "PhysDimension"
base_name: "phys_dimension"
inverse_name: "Units"
inverse_base_name: "units"
entity_name: "PhysDimension"
entity_aid: 47
range_min: 1
range_max: 1
inverse_range_max: -1
relation_type: RT_INFO
relationship: RS_INFO_TO
Close session#
Don’t forget to close the session to release the connection license. Otherwise the session will be auto closed after 30 minutes of inactivity.
con_i.logout()
License#
Copyright © 2025 Peak Solution GmbH
The training material in this repository is licensed under a Creative Commons BY-NC-SA 4.0 license. See LICENSE file for more information.
Notebook: 📓 Back to ASAM ODS Overview