Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: Fix typos in tutorials #179

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions basyx/aas/examples/tutorial_aasx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
# step 3: Reading AAS objects and auxiliary files from an AASX package


#########################################################################################
# Step 1: Setting up an SupplementaryFileContainer and AAS & submodel with File objects #
#########################################################################################
########################################################################################
# Step 1: Setting up a SupplementaryFileContainer and AAS & submodel with File objects #
########################################################################################

# Let's first create a basic Asset Adminstration Shell with a simple submodel.
# Let's first create a basic Asset Administration Shell with a simple submodel.
# See `tutorial_create_simple_aas.py` for more details.

submodel = model.Submodel(
Expand All @@ -52,8 +52,8 @@
object_store = model.DictObjectStore([submodel, aas, unrelated_submodel])


# For holding auxiliary files, which will eventually be added to an AASX package, we need an SupplementaryFileContainer.
# The `DictSupplementaryFileContainer` is a simple SupplementaryFileContainer, that stores the files' contents in simple
# For holding auxiliary files, which will eventually be added to an AASX package, we need a SupplementaryFileContainer.
# The `DictSupplementaryFileContainer` is a simple SupplementaryFileContainer that stores the files' contents in simple
# bytes objects in memory.
file_store = aasx.DictSupplementaryFileContainer()

Expand All @@ -62,7 +62,7 @@
# For this purpose, we need to specify the file's name in the SupplementaryFileContainer. This name is used to reference
# the file in the container and will later be used as the filename in the AASX package file. Thus, this file must begin
# with a slash and should begin with `/aasx/`. Here, we use `/aasx/suppl/MyExampleFile.pdf`. The
# SupplementaryFileContainer's add_file() method will ensure uniqueness of the name by adding a suffix if a equally
# SupplementaryFileContainer's add_file() method will ensure uniqueness of the name by adding a suffix if an equally
# named file with different contents exists. The final name is returned.
#
# In addition, we need to specify the MIME type of the file, which is later used in the metadata of the AASX package.
Expand Down Expand Up @@ -99,7 +99,7 @@
# objects and fetch the referenced auxiliary files from the SupplementaryFileContainer.
# In order to add more than one AAS to the package, we can simply add more Identifiers to the `aas_ids` list.
#
# ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is not longer valid to add more
# ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is no longer valid to add more
# than one "aas-spec" part (JSON/XML part with AAS objects) to an AASX package. Thus, `write_aas` MUST
# only be called once per AASX package!
writer.write_aas(aas_ids=['https://acplt.org/Simple_AAS'],
Expand All @@ -110,7 +110,7 @@
# only an AAS and referenced objects) in the AASX package manually. `write_aas_objects()` will also take care of
# adding referenced auxiliary files by scanning all submodel objects for contained `File` objects.
#
# ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is not longer valid to add more
# ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is no longer valid to add more
# than one "aas-spec" part (JSON/XML part with AAS objects) to an AASX package. Thus, `write_all_aas_objects` SHALL
# only be used as an alternative to `write_aas` and SHALL only be called once!
objects_to_be_written: model.DictObjectStore[model.Identifiable] = model.DictObjectStore([unrelated_submodel])
Expand All @@ -125,7 +125,7 @@
writer.write_core_properties(meta_data)

# Closing the AASXWriter will write some required parts with relationships and MIME types to the AASX package file and
# close the package file afterwards. Make sure, to always call `AASXWriter.close()` or use the AASXWriter in a `with`
# close the package file afterward. Make sure, to always call `AASXWriter.close()` or use the AASXWriter in a `with`
# statement (as a context manager) as shown above.


Expand All @@ -145,7 +145,7 @@
reader.read_into(object_store=new_object_store,
file_store=new_file_store)

# We can also read the meta data
# We can also read the metadata
new_meta_data = reader.get_core_properties()

# We could also read the thumbnail image, using `reader.get_thumbnail()`
Expand Down
12 changes: 6 additions & 6 deletions basyx/aas/examples/tutorial_backend_couchdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
# Afterwards you can add the new user to the set of "Members" of your new database (via the "Permissions" section in the
# user interface). Alternatively, you can use the admin credentials with the BaSyx Python SDK (see below).

# Step by Step Guide:
# Step-by-Step Guide:
# step 1: connecting to a CouchDB server
# step 2: storing objects in the CouchDBObjectStore
# step 2: storing objects in CouchDBObjectStore
# step 3: updating objects from the CouchDB and committing changes


Expand All @@ -58,7 +58,7 @@


# Provide the login credentials to the CouchDB backend.
# These credetials are used, whenever communication with this CouchDB server is required (either via the
# These credentials are used whenever communication with this CouchDB server is required either via the
# CouchDBObjectStore or via the update()/commit() backend.
basyx.aas.backend.couchdb.register_credentials(couchdb_url, couchdb_user, couchdb_password)

Expand All @@ -81,9 +81,9 @@
object_store.add(example_submodel2)


###################################################################
# Step 3: Updating Objects from the CouchDB and Commiting Changes #
###################################################################
####################################################################
# Step 3: Updating Objects from the CouchDB and Committing Changes #
Frosty2500 marked this conversation as resolved.
Show resolved Hide resolved
####################################################################

# Since the CouchDBObjectStore has set the `source` attribute of our Submodel objects, we can now use update() and
# commit() to synchronize changes to these objects with the database. The `source` indicates (via its URI scheme) that
Expand Down
10 changes: 5 additions & 5 deletions basyx/aas/examples/tutorial_create_simple_aas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# This work is licensed under a Creative Commons CCZero 1.0 Universal License.
# See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
"""
Tutorial for the creation of an simple Asset Administration Shell, containing an AssetInformation object and a Submodel
Tutorial for the creation of a simple Asset Administration Shell, containing an AssetInformation object and a Submodel
reference
"""

# Import all Eclipse BaSyx Python SDK classes from model package
from basyx.aas import model

# In this tutorial, you'll get a step by step guide on how to create an Asset Administration Shell (AAS) and all
# In this tutorial, you'll get a step-by-step guide on how to create an Asset Administration Shell (AAS) and all
# required objects within. First, you need an AssetInformation object for which you want to create an AAS. After that,
# an Asset Administration Shell can be created. Then, it's possible to add Submodels to the AAS. The Submodels can
# contain SubmodelElements.
#
# Step by Step Guide:
# Step 1: create a simple Asset Administration Shell, containing an AssetInformation object
# Step-by-Step Guide:
# Step 1: create a simple Asset Administration Shell, containing AssetInformation object
# Step 2: create a simple Submodel
# Step 3: create a simple Property and add it to the Submodel

Expand Down Expand Up @@ -91,7 +91,7 @@

# =====================================================================
# ALTERNATIVE: step 2 and 3 can also be combined in a single statement:
# Again, we pass the Property to the Submodel's constructor instead of adding it afterwards.
# Again, we pass the Property to the Submodel's constructor instead of adding it afterward.
submodel = model.Submodel(
id_='https://acplt.org/Simple_Submodel',
submodel_element={
Expand Down
10 changes: 5 additions & 5 deletions basyx/aas/examples/tutorial_serialization_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
import basyx.aas.adapter.xml

# 'Details of the Asset Administration Shell' specifies multiple official serialization formats for AAS data. In this
# tutorial, we show, how the Eclipse BaSyx Python library can be used to serialize AAS objects into JSON or XML and to
# create JSON/XML files according to the standardized format. It is also demonstrated, how these files can be parsed to
# tutorial, we show how the Eclipse BaSyx Python library can be used to serialize AAS objects into JSON or XML and to
# create JSON/XML files, according to the standardized format. It is also demonstrated how these files can be parsed to
# restore the AAS objects as Python objects.
#
# Step by Step Guide:
# Step-by-Step Guide:
# Step 1: creating Submodel and Asset Administration Shell objects
# Step 2: serializing single objects to JSON
# Step 3: parsing single objects or custom data structures from JSON
Expand Down Expand Up @@ -56,7 +56,7 @@
# Step 2: Serializing Single Objects to JSON #
##############################################

# Before serializing the data, we should make sure, it's up to data. This is irrelevant for the static AAS objects in
# Before serializing the data, we should make sure, it's up-to-date. This is irrelevant for the static AAS objects in
# this tutorial, but may be important when dealing with dynamic data.
# See `tutorial_dynamic_model.py` for more information on that topic.
aashell.update()
Expand Down Expand Up @@ -103,7 +103,7 @@
obj_store.add(submodel)
obj_store.add(aashell)

# step 4.2: Again, make sure that the data is up to date
# step 4.2: Again, make sure that the data is up-to-date
submodel.update()
aashell.update()

Expand Down
6 changes: 3 additions & 3 deletions basyx/aas/examples/tutorial_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# objects, which can be used to easily get the Submodel objects, which are referenced by the
# `AssetAdministrationShell.submodel` set, etc.
#
# Step by Step Guide:
# Step-by-Step Guide:
# Step 1: creating AssetInformation, Submodel and Asset Administration Shell objects
# Step 2: storing the data in an ObjectStore for easier handling
# Step 3: retrieving objects from the store by their identifier
Expand Down Expand Up @@ -64,8 +64,8 @@
#
# In this tutorial, we use a `DictObjectStore`, which is a simple in-memory store: It just keeps track of the Python
# objects using a dict.
# This may not be a suitable solution, if you need to manage large numbers of objects or objects must kept in a
# persistent memory (i.e. on hard disk). In this case, you may chose the `CouchDBObjectStore` from
# This may not be a suitable solution, if you need to manage large numbers of objects or objects must be kept in a
# persistent memory (i.e. on hard disk). In this case, you may choose the `CouchDBObjectStore` from
# `aas.backends.couchdb` to use a CouchDB database server as persistent storage. Both ObjectStore implementations
# provide the same interface. In addition, the CouchDBObjectStores allows synchronizing the local object with the
# database via a Backend and the update()/commit() mechanism. See the `tutorial_backend_couchdb.py` for more
Expand Down
Loading