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

Make model.Entity.specific_asset_id a Set of model.SpecificAssetIds #149

Merged
merged 25 commits into from
Nov 14, 2023

Commits on Oct 27, 2023

  1. Configuration menu
    Copy the full SHA
    77e0f86 View commit details
    Browse the repository at this point in the history
  2. - Set Entity.specific_asset_id as Iterable[SpecificAssetId], beca…

    …use the spec has changed
    
    - Add check of constraint AASd-014 for Entity, see https://rwth-iat.github.io/aas-specs/AASiD/AASiD_1_Metamodel/index.html#Entity
    - Add check of constraint AASd-131 for AssetInformation, see https://rwth-iat.github.io/aas-specs/AASiD/AASiD_1_Metamodel/index.html#AssetInformation
    - Refactor de-/serialization of Entity
    - Refactor deserialization of AssetInformation because of check of constraint AASd-131
    zrgt committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    e1fffec View commit details
    Browse the repository at this point in the history
  3. Refactor check_entity_equal()&check_asset_information_equal()

    Add function for checking `Iterable[SpecificAssetId]`
    zrgt committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    92e8618 View commit details
    Browse the repository at this point in the history
  4. Update test files

    - Add globalAssetId for all `ÀssetInformation`
    - Fix Entity.specificAssetIds in test files
    zrgt committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    0ed5d4f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bc66b2a View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2023

  1. Use getter/setter decorators for global_asset_id

    - Use getter/setter decorators for global_asset_id
    - Refactor `Entity.__init__`: use setter for `entity_type` and remove `_validate_asset_ids_for_entity_type()` from init because it will be called in `entity_type` setter
    - Add return type to some init funcs of abstract classes to calm down MyPy
    zrgt committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    91bfe92 View commit details
    Browse the repository at this point in the history
  2. Fix errors from MyPy

    zrgt committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    0386628 View commit details
    Browse the repository at this point in the history
  3. Fix pycodestyle errors

    zrgt committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    2f8a731 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2023

  1. Configuration menu
    Copy the full SHA
    f537658 View commit details
    Browse the repository at this point in the history
  2. Fix wrong example value

    zrgt committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    046ee15 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2023

  1. model.base: fix ConstrainedList.clear() atomicity

    The default inherited `clear()` implementation repeatedly deletes the
    last item of the list until the list is empty. If the last item can be
    deleted successfully, but an item in front of it that will be deleted
    later cannot, this makes `clear()` non-atomic.
    
    Thus, the `clear()` method is now overriden in an atomic way.
    Furthermore, the ConstrainedList atomicity test is fixed to correctly
    test for this as well.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    7a2e341 View commit details
    Browse the repository at this point in the history
  2. model.submodel: remove _string_constraints decorator from Entity

    This decorator silently overrides the `global_asset_id` property,
    resulting in the constraints not being checked properly.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    ff31f45 View commit details
    Browse the repository at this point in the history
  3. model.submodel: move Entity.global_asset_id string constraint check…

    … to setter
    
    This only needs to be checked if the `global_asset_id` changes.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    7ac9aa6 View commit details
    Browse the repository at this point in the history
  4. model.submodel: remove duplicate code in Entity

    `_validate_asset_ids_for_entity_type()` only needs to know whether there
    are `specific_asset_ids` or not. This can be represented by a boolean,
    allowing the delete hook of the `ConstrainedList` to make use of this
    function as well.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    4b8a7ae View commit details
    Browse the repository at this point in the history
  5. model.ass: add _validate_asset_ids() function to AssetInformation

    Similar to `submodel.Entity`, this is done to reduce duplicate code.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    3dcf9ff View commit details
    Browse the repository at this point in the history
  6. model.{aas, submodel}: add set hook to `{AssetInformation, Entity}.sp…

    …ecific_asset_id`
    
    Since `__setitem__` can be used to clear the list as well (e.g.
    `list[:] = ()`), the constraints need to be verified in this case as
    well.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    b853160 View commit details
    Browse the repository at this point in the history
  7. model.submodel: assign values correctly in Entity.__init__

    The attributes need to be assigned bypassing the setters because the
    setters try to access attributes that haven't been set yet for
    constraint validation. Only `global_asset_id` is set via the setter
    as a final constraint validation, and because `global_asset_id` is
    also constrained via a string constraint.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    39a8c48 View commit details
    Browse the repository at this point in the history
  8. model.{aas, submodel}: add getter/setter for `{AssetInformation, Enti…

    …ty}.specific_asset_id`
    
    This prevents setting the attributes without verification of the constraints.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    6b3de29 View commit details
    Browse the repository at this point in the history
  9. model.submodel: verify constraints when SpecificAssetIds are added …

    …to `Entity`
    
    This adds an `item_add_hook` to the `specific_asset_id`
    `ConstrainedList`, which is called whenever a new item is added to the
    list. This is necessary because a co-managed `Entity` is not allowed to
    have specific asset ids, so it shouldn't be possible to add any in this
    case.
    jkhsjdhjs committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    47b2e47 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5e0f160 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    6fb375d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    f11c7f5 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2023

  1. Merge pull request #1 from rwth-iat/entityfix

    improve `AssetInformation` and `Entity` constraint validation + add tests
    zrgt committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    f8a2bf6 View commit details
    Browse the repository at this point in the history
  2. Refactor Entity and AssetInformation

    - Refactor hook funcs param names
    - Set all private attributes, bypassing setters.
    - Place setting of `Entity._global_asset_id` ahead of `Entity._specific_asset_id` to set item_add_hook directly in the ConstrainedList initialization
    - Rename `Entity._validate_asset_ids_for_entity_type` to `Entity._validate_asset_ids`
    - Place check of `global_asset_id` value into `_validate_asset_ids`
    - Run `_validate_asset_ids` at the end of init
    zrgt committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    9ed5704 View commit details
    Browse the repository at this point in the history
  3. Refactor Entity and AssetInformation

    - Bundle check methods together at the end of classes
    - Extract validation of `global_asset_id` to `_validate_asset_ids()`
    - Rename `Entity._validate_asset_ids()` to `_validate_aasd_014` and `AssetInformation._validate_asset_ids()` to `_validate_aasd_131`, as the methods only validate these constraints and not all asset ids
    zrgt committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    0222237 View commit details
    Browse the repository at this point in the history