|
22 | 22 | # step 3: Reading AAS objects and auxiliary files from an AASX package |
23 | 23 |
|
24 | 24 |
|
25 | | -######################################################################################### |
26 | | -# Step 1: Setting up an SupplementaryFileContainer and AAS & submodel with File objects # |
27 | | -######################################################################################### |
| 25 | +######################################################################################## |
| 26 | +# Step 1: Setting up a SupplementaryFileContainer and AAS & submodel with File objects # |
| 27 | +######################################################################################## |
28 | 28 |
|
29 | | -# Let's first create a basic Asset Adminstration Shell with a simple submodel. |
| 29 | +# Let's first create a basic Asset Administration Shell with a simple submodel. |
30 | 30 | # See `tutorial_create_simple_aas.py` for more details. |
31 | 31 |
|
32 | 32 | submodel = model.Submodel( |
|
52 | 52 | object_store = model.DictObjectStore([submodel, aas, unrelated_submodel]) |
53 | 53 |
|
54 | 54 |
|
55 | | -# For holding auxiliary files, which will eventually be added to an AASX package, we need an SupplementaryFileContainer. |
56 | | -# The `DictSupplementaryFileContainer` is a simple SupplementaryFileContainer, that stores the files' contents in simple |
| 55 | +# For holding auxiliary files, which will eventually be added to an AASX package, we need a SupplementaryFileContainer. |
| 56 | +# The `DictSupplementaryFileContainer` is a simple SupplementaryFileContainer that stores the files' contents in simple |
57 | 57 | # bytes objects in memory. |
58 | 58 | file_store = aasx.DictSupplementaryFileContainer() |
59 | 59 |
|
|
62 | 62 | # For this purpose, we need to specify the file's name in the SupplementaryFileContainer. This name is used to reference |
63 | 63 | # the file in the container and will later be used as the filename in the AASX package file. Thus, this file must begin |
64 | 64 | # with a slash and should begin with `/aasx/`. Here, we use `/aasx/suppl/MyExampleFile.pdf`. The |
65 | | -# SupplementaryFileContainer's add_file() method will ensure uniqueness of the name by adding a suffix if a equally |
| 65 | +# SupplementaryFileContainer's add_file() method will ensure uniqueness of the name by adding a suffix if an equally |
66 | 66 | # named file with different contents exists. The final name is returned. |
67 | 67 | # |
68 | 68 | # In addition, we need to specify the MIME type of the file, which is later used in the metadata of the AASX package. |
|
99 | 99 | # objects and fetch the referenced auxiliary files from the SupplementaryFileContainer. |
100 | 100 | # In order to add more than one AAS to the package, we can simply add more Identifiers to the `aas_ids` list. |
101 | 101 | # |
102 | | - # ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is not longer valid to add more |
| 102 | + # ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is no longer valid to add more |
103 | 103 | # than one "aas-spec" part (JSON/XML part with AAS objects) to an AASX package. Thus, `write_aas` MUST |
104 | 104 | # only be called once per AASX package! |
105 | 105 | writer.write_aas(aas_ids=['https://acplt.org/Simple_AAS'], |
|
110 | 110 | # only an AAS and referenced objects) in the AASX package manually. `write_aas_objects()` will also take care of |
111 | 111 | # adding referenced auxiliary files by scanning all submodel objects for contained `File` objects. |
112 | 112 | # |
113 | | - # ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is not longer valid to add more |
| 113 | + # ATTENTION: As of Version 3.0 RC01 of Details of the Asset Administration Shell, it is no longer valid to add more |
114 | 114 | # than one "aas-spec" part (JSON/XML part with AAS objects) to an AASX package. Thus, `write_all_aas_objects` SHALL |
115 | 115 | # only be used as an alternative to `write_aas` and SHALL only be called once! |
116 | 116 | objects_to_be_written: model.DictObjectStore[model.Identifiable] = model.DictObjectStore([unrelated_submodel]) |
|
125 | 125 | writer.write_core_properties(meta_data) |
126 | 126 |
|
127 | 127 | # Closing the AASXWriter will write some required parts with relationships and MIME types to the AASX package file and |
128 | | -# close the package file afterwards. Make sure, to always call `AASXWriter.close()` or use the AASXWriter in a `with` |
| 128 | +# close the package file afterward. Make sure, to always call `AASXWriter.close()` or use the AASXWriter in a `with` |
129 | 129 | # statement (as a context manager) as shown above. |
130 | 130 |
|
131 | 131 |
|
|
145 | 145 | reader.read_into(object_store=new_object_store, |
146 | 146 | file_store=new_file_store) |
147 | 147 |
|
148 | | - # We can also read the meta data |
| 148 | + # We can also read the metadata |
149 | 149 | new_meta_data = reader.get_core_properties() |
150 | 150 |
|
151 | 151 | # We could also read the thumbnail image, using `reader.get_thumbnail()` |
|
0 commit comments