Skip to content

Commit 77e44e7

Browse files
committed
Resolve change requests
1 parent 7fedb3e commit 77e44e7

2 files changed

Lines changed: 43 additions & 18 deletions

File tree

sdk/basyx/aas/examples/tutorial_navigate_aas.py

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,28 @@
1212
# through them using IdShorts and IdShortPaths.
1313
#
1414
# Step-by-Step Guide:
15-
# Step 1: Create a Submodel with a Property, a Property Collection, a Property List and a Collection List
15+
# Step 1: Create a Submodel with a Property, a SubmodelElementCollection of Properties, a SubmodelElementList of
16+
# Properties and a SubmodelElementList of SubmodelElementCollections
17+
#
18+
# Submodel "https://iat.rwth-aachen.de/Simple_Submodel"
19+
# ├── Property "MyProperty"
20+
# │
21+
# ├── SubmodelElementCollection "MyPropertyCollection"
22+
# │ ├── Property "MyProperty0"
23+
# │ └── Property "MyProperty1"
24+
# │
25+
# ├── SubmodelElementList "MyPropertyList"
26+
# │ ├── Property [0]
27+
# │ └── Property [1]
28+
# │
29+
# └── SubmodelElementList "MyCollectionList"
30+
# ├── SubmodelElementCollection [0]
31+
# │ └── Property "MyProperty"
32+
# ├── SubmodelElementCollection [1]
33+
# │ └── Property "MyProperty"
34+
# └── SubmodelElementCollection [2]
35+
# └── Property "MyProperty"
36+
#
1637
# Step 2: Navigate through the Submodel using IdShorts and IdShortPaths
1738

1839

@@ -31,25 +52,25 @@
3152
)
3253
submodel.submodel_element.add(my_property)
3354

34-
# Step 1.3: Add a Property Collection to the Submodel
55+
# Step 1.3: Add a SubmodelElementCollection of Properties to the Submodel
3556
my_property_collection = model.SubmodelElementCollection(
3657
id_short="MyPropertyCollection",
3758
value={
3859
model.Property(
3960
id_short="MyProperty0",
4061
value_type=model.datatypes.String,
41-
value="I am the first of two Properties within a Property Collection"
62+
value="I am the first of two Properties within a SubmodelElementCollection"
4263
),
4364
model.Property(
4465
id_short="MyProperty1",
4566
value_type=model.datatypes.String,
46-
value="I am the second of two Properties within a Property Collection"
67+
value="I am the second of two Properties within a SubmodelElementCollection"
4768
)
4869
}
4970
)
5071
submodel.submodel_element.add(my_property_collection)
5172

52-
# Step 1.4: Add a Property List to the Submodel
73+
# Step 1.4: Add a SubmodelElementList of Properties to the Submodel
5374
my_property_list = model.SubmodelElementList(
5475
id_short="MyPropertyList",
5576
type_value_list_element=model.Property,
@@ -59,40 +80,40 @@
5980
model.Property(
6081
id_short=None,
6182
value_type=model.datatypes.String,
62-
value="I am Property 0 within a Property List"
83+
value="I am Property 0 within a SubmodelElementList"
6384
),
6485
model.Property(
6586
id_short=None,
6687
value_type=model.datatypes.String,
67-
value="I am Property 1 within a Property List"
88+
value="I am Property 1 within a SubmodelElementList"
6889
)
6990
]
7091
)
7192
submodel.submodel_element.add(my_property_list)
7293

73-
# Step 1.5: Add a Collection List to the Submodel
94+
# Step 1.5: Add a SubmodelElementList of SubmodelElementCollections to the Submodel
7495
my_property_collection_0 = model.SubmodelElementCollection(
7596
id_short=None,
7697
value={model.Property(
7798
id_short="MyProperty",
7899
value_type=model.datatypes.String,
79-
value="I am a simple Property within Property Collection 0"
100+
value="I am a simple Property within SubmodelElementCollection 0"
80101
)}
81102
)
82103
my_property_collection_1 = model.SubmodelElementCollection(
83104
id_short=None,
84105
value={model.Property(
85106
id_short="MyProperty",
86107
value_type=model.datatypes.String,
87-
value="I am a simple Property within Property Collection 1"
108+
value="I am a simple Property within SubmodelElementCollection 1"
88109
)}
89110
)
90111
my_property_collection_2 = model.SubmodelElementCollection(
91112
id_short=None,
92113
value={model.Property(
93114
id_short="MyProperty",
94115
value_type=model.datatypes.String,
95-
value="I am a simple Property within Property Collection 2"
116+
value="I am a simple Property within SubmodelElementCollection 2"
96117
)}
97118
)
98119
my_collection_list = model.SubmodelElementList(
@@ -112,7 +133,8 @@
112133
my_property = cast(model.Property, submodel.get_referable("MyProperty"))
113134
print(f"my_property: id_short = {my_property.id_short}, value = {my_property.value}\n")
114135

115-
# Step 2.2.1: Access a Property within a Property Collection step by step via its IdShort
136+
# Step 2.2: Navigate through a SubmodelElementCollection of Properties
137+
# Step 2.2.1: Access a Property within a SubmodelElementCollection step by step via its IdShort
116138
my_property_collection = cast(model.SubmodelElementCollection, submodel.get_referable("MyPropertyCollection"))
117139
my_property_collection_property_0 = cast(model.Property, my_property_collection.get_referable("MyProperty0"))
118140
print(
@@ -121,7 +143,7 @@
121143
f"value = {my_property_collection_property_0.value}"
122144
)
123145

124-
# Step 2.2.2: Access a Property within a Property Collection via its IdShortPath
146+
# Step 2.2.2: Access a Property within a SubmodelElementCollection via its IdShortPath
125147
my_property_collection_property_1 = cast(
126148
model.Property,
127149
submodel.get_referable(["MyPropertyCollection", "MyProperty1"])
@@ -132,7 +154,8 @@
132154
f"value = {my_property_collection_property_1.value}\n"
133155
)
134156

135-
# Step 2.3.1: Access a Property within a Property List step by step via its index
157+
# Step 2.3: Navigate through a SubmodelElementList of Properties
158+
# Step 2.3.1: Access a Property within a SubmodelElementList step by step via its index
136159
my_property_list = cast(model.SubmodelElementList, submodel.get_referable("MyPropertyList"))
137160
my_property_list_property_0 = cast(model.Property, my_property_list.get_referable("0"))
138161
print(
@@ -141,15 +164,17 @@
141164
f"value = {my_property_list_property_0.value}"
142165
)
143166

144-
# Step 2.3.2: Access a Property within a Property List via its IdShortPath
167+
# Step 2.3.2: Access a Property within a SubmodelElementList via its IdShortPath
145168
my_property_list_property_1 = cast(model.Property, submodel.get_referable(["MyPropertyList", "1"]))
146169
print(
147170
f"my_property_list_property_1: "
148171
f"id_short = {my_property_list_property_1}, "
149172
f"value = {my_property_list_property_1.value}\n"
150173
)
151174

152-
# Step 2.4.1: Access a Property within a Collection List step by step via its index and IdShort
175+
# Step 2.4: Navigate through a SubmodelElementList of SubmodelElementCollections
176+
# Step 2.4.1: Access a Property within a SubmodelElementList of SubmodelElementCollections step by step via its index
177+
# and IdShort
153178
my_collection_list = cast(model.SubmodelElementList, submodel.get_referable("MyCollectionList"))
154179
my_collection_list_collection_0 = cast(model.SubmodelElementCollection, my_collection_list.get_referable("0"))
155180
my_collection_list_collection_0_property_0 = cast(
@@ -162,7 +187,7 @@
162187
f"value = {my_collection_list_collection_0_property_0.value}"
163188
)
164189

165-
# Step 2.4.2: Access a Property within a Collection List via its IdShortPath
190+
# Step 2.4.2: Access a Property within a SubmodelElementList of SubmodelElementCollections via its IdShortPath
166191
my_collection_list_collection_2_property_0 = cast(
167192
model.Property,
168193
submodel.get_referable(["MyCollectionList", "2", "MyProperty"])

sdk/docs/source/tutorials/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Tutorials for working with the Eclipse BaSyx Python SDK
1010
tutorial_navigate_aas
1111
tutorial_storage
1212
tutorial_serialization_deserialization
13-
tutorial_backend_couchdb
1413
tutorial_aasx
14+
tutorial_backend_couchdb

0 commit comments

Comments
 (0)