PyI40AAS issueshttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues2022-01-20T18:13:00+01:00https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/152Example AAS with constraint violation2022-01-20T18:13:00+01:00Igor GarmaevExample AAS with constraint violationOperationVariable in ExampleOperation-Object from create_full_example() has kind=ModelingType.INSTANCE. It is a Constraint violation.OperationVariable in ExampleOperation-Object from create_full_example() has kind=ModelingType.INSTANCE. It is a Constraint violation.https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/150IEC61360ConceptDescription recognized as ConceptDescription2022-01-19T07:38:33+01:00Igor GarmaevIEC61360ConceptDescription recognized as ConceptDescription"Weight" IEC61360ConceptDescription in [17_ABB.aasx](http://www.admin-shell-io.com/samples/aasx/17_ABB.aasx) is recognized as ConceptDescription."Weight" IEC61360ConceptDescription in [17_ABB.aasx](http://www.admin-shell-io.com/samples/aasx/17_ABB.aasx) is recognized as ConceptDescription.Leon Mauritz MöllerLeon Mauritz Möllerhttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues/149ConceptDescription will not be saved2022-01-10T14:58:04+01:00Igor GarmaevConceptDescription will not be savedConceptDescription will not be saved
Steps to reproduce the bug:
- Create Asset
- Create ConceptDescription
- Create Submodel with semantic_id Ref to ConceptDescription
- Create Shell with Ref to Asset and Ref to Submodel
- Save Shell i...ConceptDescription will not be saved
Steps to reproduce the bug:
- Create Asset
- Create ConceptDescription
- Create Submodel with semantic_id Ref to ConceptDescription
- Create Shell with Ref to Asset and Ref to Submodel
- Save Shell in .aasx in xml (AASXWriter.write_aas)
- Open Shell: ConceptDescription does not existhttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues/145Fix id_short checks and default values2021-11-10T17:23:25+01:00Michael ThiesFix id_short checks and default valuesid_short constraint checks are broken on multiple branches. Additionally, they seem not to be standard compliant w.r.t. optional/mandatory-ness. And, the default value for optional id_short attributes in the constructor arguments (on V3....id_short constraint checks are broken on multiple branches. Additionally, they seem not to be standard compliant w.r.t. optional/mandatory-ness. And, the default value for optional id_short attributes in the constructor arguments (on V3.0RC02) should not be "NotSet", but None.
For mandatory id_short (according to the standard) we could still allow `id_short == None` as long as the object is not part of a Namespace (i.e. as long as `parent is None`).https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/144AASX package explorer could not find submodels in example generated by test/a...2021-10-29T17:31:38+02:00Igor GarmaevAASX package explorer could not find submodels in example generated by test/adapter/aasx/test_aasx.pyI've generated an AASX-file with test/adapter/aasx/test_aasx.py und tried to load it to AASX package explorer. AASX package explorer opened the file, but it could not find submodels. [test.aasx](/uploads/927fcd07feb259bb9c6087f68e233162/...I've generated an AASX-file with test/adapter/aasx/test_aasx.py und tried to load it to AASX package explorer. AASX package explorer opened the file, but it could not find submodels. [test.aasx](/uploads/927fcd07feb259bb9c6087f68e233162/test.aasx)Leon Mauritz MöllerTorben MinyIgor GarmaevLeon Mauritz Möller2021-11-03https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/142model.aas: Initializing an AssetAdministrationShell does not add the submodel...2021-10-06T09:47:01+02:00Sebastian Heppners.heppner@iat.rwth-aachen.demodel.aas: Initializing an AssetAdministrationShell does not add the submodel to the proper NamespaceWhen initializing an AssetAdministrationShell (like in the examples):
```
submodel = model.Submodel(
identification=model.Identifier(
id_="https://example.com/resources/sm/testSubmodel",
id_type=model.Identif...When initializing an AssetAdministrationShell (like in the examples):
```
submodel = model.Submodel(
identification=model.Identifier(
id_="https://example.com/resources/sm/testSubmodel",
id_type=model.IdentifierType.IRI
),
id_short="SimulationModels"
)
aas = model.AssetAdministrationShell(
asset=model.AASReference.from_referable(model.Asset(
kind=model.AssetKind.INSTANCE,
identification=model.Identifier(
id_="https://example.com/resources/asset/{}".format(id_short),
id_type=model.IdentifierType.IRI
)
)),
identification=model.Identifier(
id_="https://example.com/resources/aas/{}".format(id_short),
id_type=model.IdentifierType.IRI
),
submodel={model.AASReference.from_referable(submodel)}
)
```
the submodel is not added to the AAS namespace:
```
s = aas.get_referable(id_short="SimulationModels")
>> KeyError: 'Referable with id_short SimulationModels not found in this namespace'
```https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/134NamespaceSet: update_nss_from() on V30RC01 does not update Qualifiers and Ext...2021-02-22T12:25:17+01:00Michael ThiesNamespaceSet: update_nss_from() on V30RC01 does not update Qualifiers and Extensions correctlyThis issue is only relevant for the V30RC01 branch.
In the current version of the improve/V30RC01-branch, the `update_nss_from()` method of NamespaceSets does not consider Qualifiers and Extensions correctly. If a Referable object with ...This issue is only relevant for the V30RC01 branch.
In the current version of the improve/V30RC01-branch, the `update_nss_from()` method of NamespaceSets does not consider Qualifiers and Extensions correctly. If a Referable object with Qualifiers or Extensions is updated from another Referable object, only new and deleted Qualifiers/Extensions will be updated, whereas changed Qualifiers/Extensions are not updated. This is due to the missing code in `base.py` near line 1477: https://git.rwth-aachen.de/acplt/pyi40aas/-/blob/6711a5bb3f9d951e59d3c4311600b1b5a6413bd1/aas/model/base.py#L1477
Since Qualifiers and Extensions are not Referable and thus have no `update_from()` method, we cannot update them recursively. Instead, we should just replace the old objects with the new ones. In fact, this simplyfies the whole `update_nss_from()` behaviour: We don't have to divide into new, deleted and update Qualifiers/Extensions, but instead, we can simply remove all of these objects from `self` and move all of the ones from `other` into `self`. Thus, I propose to add a high-level `if` statement, that checks if the NamespaceSet uses the `id_short` attribute for identification: If it does, we can use the old behaviour of `update_nss_from()` (we don't even need to check the type of the objects), if not, we should use the simplified updating (deleting and moving).Leon Mauritz MöllerLeon Mauritz Möllerhttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues/133model: Uniqueness checks are not functional2021-02-22T09:59:23+01:00Leon Mauritz Möllermodel: Uniqueness checks are not functional`Referable.update_from()` patches the `self` object with the `other` object by iterating over the attributes of the `other` objects using the python built-in `vars()`. `vars()` only iterates over an objects attributes, not properties e.g...`Referable.update_from()` patches the `self` object with the `other` object by iterating over the attributes of the `other` objects using the python built-in `vars()`. `vars()` only iterates over an objects attributes, not properties e.g. getter/setter functions. The `id_short` attribute of `Referable` is a property, which performs additional checks when setting the `id_short`, such as checking for uniqueness within the namespace by searching the objects contained in the `parent` object. The actual value of the `id_short` is stored in the protected attribute `_id_short`.
Since `_id_short` is an attribute and `id_short` is a property, the `vars()` built-in returns the `_id_short` attribute instead of the `id_short` property, which causes `update_from()` to update the `_id_short` directly, skipping the setter function and thus the uniqueness check.
This is also the case for the `semantic_id` property of `HasSemantics`, which also checks for uniqueness.
A solution proposed by @sebastian.heppner and @mhthies is to add dictionaries to each class, mapping the protected attributes to the respective property. These dictionaries would then be searched by `update_from()`, which can then set the property instead of the attribute.
---
Another issue is that this uniqueness check is not performed for objects contained in one or more `AbstractObjectStore`, because these are not referenced by the `parent` attribute.
---
The third and final issue is located in `NamespaceSet.update_nss_from()`. [...]
---
Each fix has to be backported to the not yet existent `V2.0` branch.
**Progress Tracker:**
- [ ] Uniqueness not checked in `Referable.update_from()`
- [ ] No uniqueness check for objects inside an `AbstractObjectStore`
- [ ] `NamespaceSet.update_nss_from()`https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/132xml: IndexError when parsing XML with empty <qualifier/> tags2021-02-01T17:58:25+01:00Ghost Userxml: IndexError when parsing XML with empty <qualifier/> tagsI used the AASX Package Explorer (version 2021-01-16.alpha) to create a minimal AASX file with one asset, one AAS, one submodel and one property (see [test1.aasx](/uploads/d8346c248f78415c28e5a5f025cfe7f7/test1.aasx)). When opening the ...I used the AASX Package Explorer (version 2021-01-16.alpha) to create a minimal AASX file with one asset, one AAS, one submodel and one property (see [test1.aasx](/uploads/d8346c248f78415c28e5a5f025cfe7f7/test1.aasx)). When opening the file with PyI40AAS, I get an `IndexError`:
```
Traceback (most recent call last):
File "open-aas.py", line 16, in <module>
reader.read_into(object_store, file_store)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\aasx.py", line 139, in read_into
self._read_aas_part_into(aas_part, object_store, file_store, read_identifiables, override_existing)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\aasx.py", line 180, in _read_aas_part_into
for obj in self._parse_aas_part(part_name):
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\aasx.py", line 210, in _parse_aas_part
return read_aas_xml_file(p)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 1398, in read_aas_xml_file
read_aas_xml_file_into(object_store, file, **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 1366, in read_aas_xml_file_into
for element in _child_construct_multiple(list_, element_tag, constructor, decoder_.failsafe):
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 326, in _failsafe_construct_multiple
parsed = _failsafe_construct(element, constructor, failsafe, **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 280, in _failsafe_construct
return constructor(element, **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 982, in construct_submodel
constructed = _failsafe_construct(submodel_element[0], cls.construct_submodel_element, cls.failsafe)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 280, in _failsafe_construct
return constructor(element, **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 665, in construct_submodel_element
return cls.construct_data_element(element, abstract_class_name="SubmodelElement", **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 685, in construct_data_element
return data_elements[element.tag](element, **kwargs)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 851, in construct_property
cls._amend_abstract_attributes(property_, element)
File "c:\users\krahlro\venv\aas\src\pyi40aas\aas\adapter\xml\xml_deserialization.py", line 446, in _amend_abstract_attributes
constructed = _failsafe_construct(constraint[0], cls.construct_constraint, cls.failsafe)
File "src\lxml\etree.pyx", line 1161, in lxml.etree._Element.__getitem__
IndexError: list index out of range
```
This is the code I used to open the file:
```python
filename = sys.argv[1]
try:
object_store = model.DictObjectStore()
file_store = aasx.DictSupplementaryFileContainer()
with aasx.AASXReader(filename) as reader:
reader.read_into(object_store, file_store)
cp = reader.get_core_properties()
print(filename, "SUCCESS", cp, sep="\t")
except:
print(filename, "ERROR", sep="\t", flush=True)
traceback.print_exc()
```
The error occurs both with the 0.2.0 release and the current development version 852c6f0a2571407030d9d49c8d72189a52dc9a85.https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/127model: Referable.update_from() not working properly for contained Referable o...2021-01-27T13:47:54+01:00Ghost Usermodel: Referable.update_from() not working properly for contained Referable objectsHi there,
I was testing the examples folder - especially the backend couchdb part - and there is a problem with the line `example_submodel1.update()`. Lines above that work fine. Seems like there is something wrong with `.update()` and ...Hi there,
I was testing the examples folder - especially the backend couchdb part - and there is a problem with the line `example_submodel1.update()`. Lines above that work fine. Seems like there is something wrong with `.update()` and `.commit()` ?
I'm receiving these errors:
```
PS C:\Users\samed\Desktop\pyi40aas\aas\examples> & "C:/Program Files/Python37/python.exe" "c:/Users/samed/Desktop/pyi40aas/aas/examples/tutorial_backend_couchdb.py"
Traceback (most recent call last):
File "C:\Users\samed\AppData\Roaming\Python\Python37\site-packages\aas\backend\backends.py", line 154, in get_backend
return _backends_map[scheme]
KeyError: 'couchdb'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:/Users/samed/Desktop/pyi40aas/aas/examples/tutorial_backend_couchdb.py", line 118, in <module>
example_submodel1.update()
File "C:\Users\samed\AppData\Roaming\Python\Python37\site-packages\aas\model\base.py", line 507, in update
backends.get_backend(self.source).update_object(updated_object=self,
File "C:\Users\samed\AppData\Roaming\Python\Python37\site-packages\aas\backend\backends.py", line 156, in get_backend
raise UnknownBackendException("Could not find Backend for source '{}'".format(url)) from e
aas.backend.backends.UnknownBackendException: Could not find Backend for source 'couchdb://localhost:5984/aas_test/IRI-http%3A%2F%2Facplt.org%2FSubmodels%2FAssets%2FTestAsset%2FIdentification'
```
Thanks and kind regards,
Samedhttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues/125model: Refereable._set_id_short should change the id_short entry in the Names...2021-02-01T10:35:36+01:00Michael Thiesmodel: Refereable._set_id_short should change the id_short entry in the Namespace's _backend dictCurrently we only check for duplicate id_shorts in the same Namespace, when an id_short is changed (#100). However, we must also update the NamespaceSet with the new id_short of the Referable object to ensure correct duplicate checking a...Currently we only check for duplicate id_shorts in the same Namespace, when an id_short is changed (#100). However, we must also update the NamespaceSet with the new id_short of the Referable object to ensure correct duplicate checking and id_short-resolving in the future.
This must also be implemented for other unique attributes in the future (see #121).Torben MinyTorben Minyhttps://git.rwth-aachen.de/acplt/pyi40aas/-/issues/124model: Fix docstring of AASReference.__init__ w.r.t. to target_type parameter2021-10-28T21:12:49+02:00Igor Garmaevmodel: Fix docstring of AASReference.__init__ w.r.t. to target_type parameterDelete `target_type` parameter in `__init__` of `AASReference`. Use for `type` type of last element of `key`.
If it is not possible, please fix doc of `__init__`: replace "type_" with "target_type"Delete `target_type` parameter in `__init__` of `AASReference`. Use for `type` type of last element of `key`.
If it is not possible, please fix doc of `__init__`: replace "type_" with "target_type"https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/107aasx: OPCPackageWriter.write_relationships() is called twice when submodel_sp...2020-11-02T15:02:36+01:00Leon Mauritz Mölleraasx: OPCPackageWriter.write_relationships() is called twice when submodel_split_parts is TrueThe following warnings are logged when running the AASX tests:
```
/usr/lib/python3.8/zipfile.py:1517: UserWarning: Duplicate name: 'aasx/https___acplt_org_Test_AssetAdministrationShell/_rels/https___acplt_org_Test_AssetAdministrationShe...The following warnings are logged when running the AASX tests:
```
/usr/lib/python3.8/zipfile.py:1517: UserWarning: Duplicate name: 'aasx/https___acplt_org_Test_AssetAdministrationShell/_rels/https___acplt_org_Test_AssetAdministrationShell.aas.xml.rels'
return self._open_to_write(zinfo, force_zip64=force_zip64)
/usr/lib/python3.8/zipfile.py:1517: UserWarning: Duplicate name: 'aasx/https___acplt_org_Test_AssetAdministrationShell/_rels/https___acplt_org_Test_AssetAdministrationShell.aas.json.rels'
return self._open_to_write(zinfo, force_zip64=force_zip64)
```
These are caused by `AASXWriter.write_aas()` calling `write_relationships()` by itself when `submodel_split_parts` is `True`. Since `write_aas()` also calls `write_aas_objects()`, which also writes relationships, this results in two calls to `write_relationships()` for the same AAS, which in turn results in duplicate names being written to the file.https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/96examples.data.example_aas: Missing namespace initialization for `create_examp...2020-10-13T12:24:39+02:00Sebastian Heppners.heppner@iat.rwth-aachen.deexamples.data.example_aas: Missing namespace initialization for `create_example_submodel`If you try:
```
test_submodel = create_example_submodel()
test_submodel.get_referable("ExampleProperty")
```
you recieve:
```
KeyError: 'Referable with id_short ExampleProperty not found in this namespace'
```
This function (and possi...If you try:
```
test_submodel = create_example_submodel()
test_submodel.get_referable("ExampleProperty")
```
you recieve:
```
KeyError: 'Referable with id_short ExampleProperty not found in this namespace'
```
This function (and possibly all the other `create_example...`-functions) is/are missing the creation of a `NamespaceSet` containing all the sub-elements, something like:
```
example_submodel_namespace_set = NamespaceSet(parent=example_submodel, items=[example_property, ...])
example_submodel.namespace_element_sets = [example_submodel_namespace_set]
```
Though, shouldn't these namespaces in general be created automatically with initializing the objects?https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/93aasx: Support AASX packages with XML + JSON parts (redundant serialization of...2020-10-28T11:52:35+01:00Michael Thiesaasx: Support AASX packages with XML + JSON parts (redundant serialization of same objects)https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/71compliance-tool: Remove hard-coded path of XML and JSON schema2020-04-30T11:03:33+02:00Michael Thiescompliance-tool: Remove hard-coded path of XML and JSON schemaSince the tests are not installed in a deployment environment, the hard-coded path in the compliance tool of the XML and JSON Schema in the `test` directory will not be valid.
Instead, we should allow users to download the Schema files ...Since the tests are not installed in a deployment environment, the hard-coded path in the compliance tool of the XML and JSON Schema in the `test` directory will not be valid.
Instead, we should allow users to download the Schema files themselves (from wherever) and tell the tool about their location, e.g. as an additional cli option.Alpha Release 0.1.0https://git.rwth-aachen.de/acplt/pyi40aas/-/issues/64test: AASXWriterTest fails sometimes2020-04-20T09:18:37+02:00Leon Mauritz Möllertest: AASXWriterTest fails sometimesIt's rare, but the AASXWriterTest can fail:
```
FAIL [0.038s]: test_writing_reading_example_aas (test.adapter.aasx.test_aasx.AASXWriterTest)
----------------------------------------------------------------------
Traceback (most recent ca...It's rare, but the AASXWriterTest can fail:
```
FAIL [0.038s]: test_writing_reading_example_aas (test.adapter.aasx.test_aasx.AASXWriterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jkhsjdhjs/git/pyAAS/test/adapter/aasx/test_aasx.py", line 96, in test_writing_reading_example_aas
self.assertEqual(new_cp.created, cp.created)
AssertionError: datetime.datetime(2020, 4, 3, 0, 59, 3, 500681) != datetime.datetime(2020, 4, 3, 0, 59, 3, 500682)
----------------------------------------------------------------------
```
bash script to reproduce it via brute force (execute in project root):
```bash
#!/usr/bin/env bash
i=1
while PYTHONPATH=".:$PYTHONPATH" python -m unittest test.adapter.aasx.test_aasx.AASXWriterTest; do
(( i++ ))
done
echo "test attempt $i failed"
```
Using this script you should be able to reproduce the issue in usually less than 200 attempts.
Issue first occured on Arch Linux with linux 5.5.13-arch2-1 and Python 3.8.2.
Reproduced on a Raspberry Pi 1 B running Raspbian buster with linux 4.19.66+ and Python 3.7.3.