We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
asset
When parsing an AssetAdministrationShell from json _construct_asset_administration_shell is expecting a type dict in asset element:
_construct_asset_administration_shell
dict
def _construct_asset_administration_shell( cls, dct: Dict[str, object], object_class=model.AssetAdministrationShell) -> model.AssetAdministrationShell: ret = object_class( asset=cls._construct_aas_reference(_get_ts(dct, 'asset', dict), model.Asset), identification=cls._construct_identifier(_get_ts(dct, 'identification', dict)))
However, at that point the asset element is already parsed and fails with:
TypeError: Dict entry 'asset' has unexpected type Asset
Changing the above line to
def _construct_asset_administration_shell( cls, dct: Dict[str, object], object_class=model.AssetAdministrationShell) -> model.AssetAdministrationShell: ret = object_class( asset=get_ts(dct, 'asset', model.Asset), identification=cls._construct_identifier(_get_ts(dct, 'identification', dict)))
seems to fix the problem.
Example python code:
json_ = """ [ { "conceptDictionary": [], "assetRef": { "keys": [ { "idType": "IRI", "type": "Asset", "value": "1030_8141_0112_5510", "local": true } ] }, "identification": { "idType": "IRI", "id": "1220_8141_0112_0875" }, "idShort": "AAS", "dataSpecification": [], "derivedFrom": { "keys": [ { "idType": "IdShort", "type": "AssetAdministrationShell", "value": "6455_1111_0112_4769", "local": true } ] }, "modelType": { "name": "AssetAdministrationShell" }, "asset": { "idShort": "CA", "modelType": { "name": "Asset" }, "identification": { "id": "1030_8141_0112_5510", "idType": "IRI" }, "kind": "Instance" }, "embeddedDataSpecifications": [], "views": [] } ] """ shells = json.loads(json_, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
The text was updated successfully, but these errors were encountered:
Yes, it's retrieving the value of the asset property as a dict in order to construct a Reference object from the dict. In the DotAAS metamodel, references to other objects are described by Reference objects, which point to the actual object. This is also the case for the asset property of an AssetAdministrationShell, you can verify it on page 234 of the spec: https://www.plattform-i40.de/IP/Redaktion/EN/Downloads/Publikation/Details_of_the_Asset_Administration_Shell_Part1_V2.pdf?__blob=publicationFile
Reference
AssetAdministrationShell
Thus, the exemplary JSON structure you gave doesn't adhere to the DotAAS spec in version 2.0.1 and isn't compatible with this implementation.
Sorry, something went wrong.
Thank you very much for the explanation!
AssetAdmistrationShells
Asset
Merge pull request #9 from rwth-iat/http_api/remove_aas_submount
b9ba39a
adapter.http: remove `/aas` submount from AAS repository
No branches or pull requests
When parsing an AssetAdministrationShell from json
_construct_asset_administration_shell
is expecting a typedict
inasset
element:However, at that point the
asset
element is already parsed and fails with:Changing the above line to
seems to fix the problem.
Example python code:
The text was updated successfully, but these errors were encountered: