PyI40AAS merge requestshttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests2022-07-20T15:12:05+02:00https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/84readme: link basyx-python-sdk2022-07-20T15:12:05+02:00Leon Mauritz Möllerreadme: link basyx-python-sdkThis PR links the new basyx-python-sdk in the README.This PR links the new basyx-python-sdk in the README.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/83examples: change AAS submodel reference keys to local=True2021-11-04T07:35:01+01:00Leon Mauritz Möllerexamples: change AAS submodel reference keys to local=True...so the AASX Package Explorer can find the submodels.
Also change the ComplianceTool test files accordingly....so the AASX Package Explorer can find the submodels.
Also change the ComplianceTool test files accordingly.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/81model.base: add method for adding objects to namespaces2021-09-07T14:03:49+02:00Leon Mauritz Möllermodel.base: add method for adding objects to namespacesThis MR implements this feature by adding a method to each relevant namespace, that iterates over the respective `NamespaceSets` and adds the object to the first `NamespaceSet` with a matching `attribute_name`, such as `id_short`, `type`...This MR implements this feature by adding a method to each relevant namespace, that iterates over the respective `NamespaceSets` and adds the object to the first `NamespaceSet` with a matching `attribute_name`, such as `id_short`, `type` or `name`.
The SubmodelElement collections `SubmodelElementCollectionOrderedUniqueSemanticId` and `SubmodelElementCollectionUnorderedUniqueSemanticId` both inherit from `SubmodelElementCollectionOrdered` and `SubmodelElementCollectionUnordered` respectively. Both `__init__` methods call `super().__init__` (e.g. `SubmodelElementCollectionOrdered.__init__`), which creates a `NamespaceSet` for `self.value`. `self.value` is then overwritten by a new `NamespaceSet` for the unique `semantic_id` functionality, leaving an unused `NamespaceSet` in `self.namespace_element_sets`.
The functionality implemented in this MR would add new `Referable` objects to the first `NamespaceSet` in `self.namespace_element_sets`, that has `id_short` in its `attribute_name_list`. For the `SubmodelElementCollections` with a `UniqueSemanticId` namespace, this would be the unused `NamespaceSet`. Thus, this unused `NamespaceSet` has to be removed first in the respective `__init__` function.
Alongside, this MR also fixes some docstrings and shortens some code.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/77Documentation for v2.0.12021-08-12T13:32:46+02:00Sebastian Heppners.heppner@iat.rwth-aachen.deDocumentation for v2.0.1The sphinx documentation of v2.0.1The sphinx documentation of v2.0.1Sebastian Heppners.heppner@iat.rwth-aachen.deSebastian Heppners.heppner@iat.rwth-aachen.dehttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/74Merge docs/sphinx_autodocs into improve/V30RC012021-08-12T13:32:46+02:00Sebastian Heppners.heppner@iat.rwth-aachen.deMerge docs/sphinx_autodocs into improve/V30RC01The sphinx documentation should be up to date to v3.0 now.
- [x] I suspect that the automatic part of the merge from improve/V30RC01 broke something that I am unable to find the exact problem, mypy complains about:
```
aas\model\sub...The sphinx documentation should be up to date to v3.0 now.
- [x] I suspect that the automatic part of the merge from improve/V30RC01 broke something that I am unable to find the exact problem, mypy complains about:
```
aas\model\submodel.py:77: error: Incompatible types in assignment (expression has type "NamespaceSet[Constraint]", variable has type "Set[Constraint]")
aas\model\submodel.py:139: error: Incompatible types in assignment (expression has type "NamespaceSet[Constraint]", variable has type "Set[Constraint]")
```
- [x] There is a collection of docstrings that may need a rework in Issue #115.
For those who want to review the documentation, here is how you build it:
- Navigate to `docs/`
- Execute `make html` over the command line
- You can find the documentation in `/docs/build/html/`. The main page is called `index.html`.Sebastian Heppners.heppner@iat.rwth-aachen.deSebastian Heppners.heppner@iat.rwth-aachen.dehttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/80model.base: fix object identifier change + add tests2021-07-08T08:28:47+02:00Leon Mauritz Möllermodel.base: fix object identifier change + add testsWhen changing the identifier (`id_short`, `semantic_id`, `name` or `type`) of
and object, all namespace sets of the respective namespace are checked
and updated. This may cause an error if the parent namespace has
namespace sets that are...When changing the identifier (`id_short`, `semantic_id`, `name` or `type`) of
and object, all namespace sets of the respective namespace are checked
and updated. This may cause an error if the parent namespace has
namespace sets that aren't structured by the attribute that is updated,
causing an error in `NamespaceSet.__contains__()` or
`NamespaceSet.contains_id()`.
This is fixed by excepting such errors and returning False instead.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/76README.md: Update Features, Project Structure and License2021-06-15T11:16:49+02:00Sebastian Heppners.heppner@iat.rwth-aachen.deREADME.md: Update Features, Project Structure and LicenseUpdate README to be more up to date to the actual project structureUpdate README to be more up to date to the actual project structureSebastian Heppners.heppner@iat.rwth-aachen.deSebastian Heppners.heppner@iat.rwth-aachen.dehttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/78model.base: fix id_short validation2021-04-28T16:26:00+02:00Leon Mauritz Möllermodel.base: fix id_short validationIn RegEx, the `$` asserts the end of a string or line. When used in
re.match() it asserts the end of the string by default, unless the last
character is a newline symbol (`\n`). Then it asserts the end of the string
*before* the newline....In RegEx, the `$` asserts the end of a string or line. When used in
re.match() it asserts the end of the string by default, unless the last
character is a newline symbol (`\n`). Then it asserts the end of the string
*before* the newline. Thus the first regex check doesn't filter valid
id_shorts ending in a newline, which it should.
See https://docs.python.org/3.9/library/re.html#index-2
Using re.fullmatch() instead fixes this issue, making the `^` and `$`
unnecessary as well.
Next to adding a test for this behaviour this commit also simplifies the
check for an alphabetical character at the start of the id_short.
And although both checks could also be merged into one, they are left
separate to be able to report more accurate errors.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/79model.base: fix id_short validation2021-04-28T16:24:35+02:00Leon Mauritz Möllermodel.base: fix id_short validationThis commit backports 445b1d8f6ec8740c2946b1ed06318f17c2744bcb from
fix/id_short_validation (!78).
In RegEx, the `$` asserts the end of a string or line. When used in
re.match() it asserts the end of the string by default, unless the la...This commit backports 445b1d8f6ec8740c2946b1ed06318f17c2744bcb from
fix/id_short_validation (!78).
In RegEx, the `$` asserts the end of a string or line. When used in
re.match() it asserts the end of the string by default, unless the last
character is a newline symbol (`\n`). Then it asserts the end of the string
*before* the newline. Thus the first regex check doesn't filter valid
id_shorts ending in a newline, which it should.
See https://docs.python.org/3.9/library/re.html#index-2
Using re.fullmatch() instead fixes this issue, making the `^` and `$`
unnecessary as well.
Next to adding a test for this behaviour this commit also simplifies the
check for an alphabetical character at the start of the id_short.
And although both checks could also be merged into one, they are left
separate to be able to report more accurate errors.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/61adapter.json: support serializing/deserializing stripped objects2021-02-20T22:18:52+01:00Leon Mauritz Mölleradapter.json: support serializing/deserializing stripped objectsThis MR adds the ability to serialize and deserialize stripped objects to the JSON adapter, see #91.
It also adds the `read_aas_json_file_into()` method and thus closes #63.
Furthermore it does some minor cleanup, see individual comm...This MR adds the ability to serialize and deserialize stripped objects to the JSON adapter, see #91.
It also adds the `read_aas_json_file_into()` method and thus closes #63.
Furthermore it does some minor cleanup, see individual commits for details.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/75Create AASX reading/writing tutorial for DotAAS V 3.02021-02-15T12:00:15+01:00Michael ThiesCreate AASX reading/writing tutorial for DotAAS V 3.0Based on !73 and !69.Based on !73 and !69.https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/69Update AASX writing to DotAAS V3.0RC012021-02-10T11:13:33+01:00Michael ThiesUpdate AASX writing to DotAAS V3.0RC01Changes the signature and behaviour of `AASXWriter.write_aas()`.
Requires some additional work to:
* [x] adapt sample files of compliance tool tests to changed example data.
* [x] fix return type annotation of `UniqueIdShortNamespace.__...Changes the signature and behaviour of `AASXWriter.write_aas()`.
Requires some additional work to:
* [x] adapt sample files of compliance tool tests to changed example data.
* [x] fix return type annotation of `UniqueIdShortNamespace.__iter__`https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/73Create AASX reading/writing tutorial2021-02-10T11:13:29+01:00Michael ThiesCreate AASX reading/writing tutorialThis PR adds a tutorial script to the examples module, demonstrating how to use the `aas.adapter.aasx` module for reading and writing AASX package files.
The tutorial is based on the current master / 0.2.x branch, i.e. it uses the old A...This PR adds a tutorial script to the examples module, demonstrating how to use the `aas.adapter.aasx` module for reading and writing AASX package files.
The tutorial is based on the current master / 0.2.x branch, i.e. it uses the old AASXWriter interface, corresponding to DotAAS up to version 2.0.1. It needs to be adapted to the new interface, introduced by !69. This should probably be done in !69.
Fixes #69 (for now).https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/72adapter.xml: Finally fix deserialization of empty <qualifier> tags2021-02-01T17:58:25+01:00Michael Thiesadapter.xml: Finally fix deserialization of empty <qualifier> tagsEmpty qualifier tags are allowed per the XSD schema and a frequently
used in XML documents created by the AASX Package Explorer (i.a. in AASX
package files).
Follow up to 516bf1e7, which tried to fix this, but only replaced the
KeyError...Empty qualifier tags are allowed per the XSD schema and a frequently
used in XML documents created by the AASX Package Explorer (i.a. in AASX
package files).
Follow up to 516bf1e7, which tried to fix this, but only replaced the
KeyError with an IndexError.
Fixes #132https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/57Improve/xml deserialization2021-02-01T13:53:21+01:00Leon Mauritz MöllerImprove/xml deserializationThis merge request adds the customizing pattern from the json serialization to the xml serialization - which is now not necessary anymore for it's original usecase, but will be useful for parsing stripped xml elements in the http api.
...This merge request adds the customizing pattern from the json serialization to the xml serialization - which is now not necessary anymore for it's original usecase, but will be useful for parsing stripped xml elements in the http api.
Furthermore, the functions `read_aas_xml_file_into()` and `read_aas_xml_element()` were added. `read_aas_xml_element()` should originally accept a type and a decoder class, but because mypy doesn't narrow down type variables for `if type_ is SomeType` and the issue was still present with `if issubclass(type_, SomeType)`, despite it narrowing down the type, I decided to change the API and just pass a constructor function to it, as I think that it is prettier than telling mypy to ignore the type at the end of each line.
see #63 #91
fixes #74https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/71model: Fix Referable.id_short property: Update parent Namespace on change2021-02-01T10:35:35+01:00Michael Thiesmodel: Fix Referable.id_short property: Update parent Namespace on change... enhances tests to catch this bug, as well.
Fixes #125... enhances tests to catch this bug, as well.
Fixes #125https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/70model: Fix recursive update_from: Don't mess up NamespaceSet references2021-01-27T13:47:54+01:00Michael Thiesmodel: Fix recursive update_from: Don't mess up NamespaceSet referencesFixes #127Fixes #127https://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/64Fix some CouchDB and update/commit things2021-01-14T18:05:36+01:00Michael ThiesFix some CouchDB and update/commit things* Register CouchDB backend class automatically
* Add tutorial for CouchDB usage
* Dont't reset _backend_map during backend tests
* Improve code style* Register CouchDB backend class automatically
* Add tutorial for CouchDB usage
* Dont't reset _backend_map during backend tests
* Improve code stylehttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/68test.model.test_base: Add test for function update_from for base.Referable2021-01-12T11:00:29+01:00Sebastian Heppners.heppner@iat.rwth-aachen.detest.model.test_base: Add test for function update_from for base.ReferableThis adds the missing test for `model.base.Referable.update_from()`.This adds the missing test for `model.base.Referable.update_from()`.Sebastian Heppners.heppner@iat.rwth-aachen.deSebastian Heppners.heppner@iat.rwth-aachen.dehttps://git.rwth-aachen.de/acplt/pyi40aas/-/merge_requests/65Improve/model2020-11-25T10:42:55+01:00Leon Mauritz MöllerImprove/modelImprove our implementation of the DotAAS metamodel by making abstract classes _really_ abstract (so they can't be instantiated), removing the `_`-suffix of function parameters in the model and more. See commits for details.
When removin...Improve our implementation of the DotAAS metamodel by making abstract classes _really_ abstract (so they can't be instantiated), removing the `_`-suffix of function parameters in the model and more. See commits for details.
When removing the underscore suffix from function parameters, I only removed the suffix from parameters that were keyword arguments, because the value of positional parameters is usual given without specifying the parameter name.
Thus a few parameters still have their `_`-suffix in the model:
```bash
$ grep -Pn "\w+_: " --exclude-dir=__pycache__ aas/model/*
aas/model/base.py:221: type_: KeyElements,
aas/model/base.py:228: :param type_: Denote which kind of entity is referenced. In case type = GlobalReference then the element is a
aas/model/base.py:363: id_: str,
aas/model/base.py:368: :param id_: Identifier of the element. Its type is defined in id_type.
aas/model/base.py:669: type_: Type[_RT]):
aas/model/base.py:676: :param: type_: The type of the referenced object (additional parameter, not from the AAS Metamodel)
aas/model/base.py:685: def resolve(self, provider_: "provider.AbstractObjectProvider") -> _RT:
aas/model/base.py:901: type_: QualifierType,
aas/model/base.py:909: :param type_: The type of the qualifier that is applied to the element.
aas/model/base.py:1195: def insert(self, index: int, object_: _RT) -> None:
aas/model/datatypes.py:401:def trivial_cast(value, type_: Type[AnyXSDType]) -> AnyXSDType: # workaround. We should be able to use a TypeVar here
aas/model/datatypes.py:416: :param type_: Target type to cast into. Must be an XSD type from this module
aas/model/datatypes.py:513:def from_xsd(value: str, type_: Type[AnyXSDType]) -> AnyXSDType: # workaround. We should be able to use a TypeVar here
aas/model/datatypes.py:517: :param type_: The expected XSD type (from this module). It is required to chose the correct conversion.
```
Let's discuss here whether we also want to remove the suffix of the `type_` and `id_` parameters in `base.py`. I checked, `type()` or `id()` isn't used in the respective scopes (only in `datatypes.py`).