Coder Social home page Coder Social logo

aas4j's Introduction

Eclipse AAS4J

📰 The Eclipse AAS4J 1.0.2 release is available on Maven Central Repository and includes the following artifacts implementing the AAS Specs – Part 1 V3.0 (final): aas4j-dataformat-core, aas4j-dataformat-aasx, aas4j-dataformat-xml, aas4j-dataformat-json, aas4j-dataformat-parent, and aas4j-model.

Eclipse AAS4J implements the specification of the Asset Administration Shell (AAS) such as metamodels, submodels, serialization and deserialization modules, validators, and transformation libraries based on the AAS specifications. It also contains all classes and properties as defined by the document 'Specification of the Asset Administration Shell Part 1: Meta-Model' published on Industrial Digital Twin Association (IDTA).

Note: AAS libraries for java previously available in admin-shell-io.

Project Structure

Eclipse AA4J consists of the following components:

  • AAS Model
  • Dataformat AASX
  • Dataformat Core
  • Dataformat JSON
  • Dataformat XML

AAS Model

The AAS Model is an implementation of the Asset Administration Shell metamodel in Java. It contains all classes and properties as defined by the document 'Details of the Asset Administration Shell' published on Industrial Digital Twin Association (IDTA).

Please refer to AAS Model README for more information.

Dataformat Library

Eclipse AA4J contains an AAS Java Dataformat Library. The AAS Java Dataformat Library is a collection of software modules to serialize and deserialze instances of the Asset Administration Shell from and to Java instances. De-/serialization works according to the dataformat schemas published in the document 'Details of the Asset Administration Shell', published on Industrial Digital Twin Association (IDTA).

Build and Use

You can build the project using Maven by simply executing at the repository root:

mvn clean package

or by integrating the respective modules as dependencies from Maven Central Repository, for instance:

<dependency>
  <groupId>org.eclipse.digitaltwin.aas4j</groupId>
  <artifactId>aas4j-model</artifactId>
  <version>1.0.2</version>
</dependency>

AAS4J Project Structure

The project contains several modules:

  • dataformat-parent Maven parent module that contains the respective de-/serializers for the different data formats.
  • dataformat-core Location of the general classes and interfaces that are used by more than one de-/serializer.
  • dataformat-aasx AASX de-/serializer
  • dataformat-json JSON de-/serializer
  • dataformat-xml XML de-/serializer
  • model Meta-model classes be instantiated

AAS4J's predecessor contained serialization modules for AutomationML and OPC UA for which however no longer up-to-date specifications exist. Implementation is halted until the specs have been updated. Additionally, the RDF serializer and the validator have been removed temporarily from this repo but are planned to be reintroduced in the future.

Additionally, the sources that are used for generating the static documentation using DocFX in the gh-pages branch are located in the docs folder.

Support

Current status of the project is incubating.

If you find any issue, please, file it at https://github.com/eclipse-aas4j/aas4j/issues. Note that some issues might affect the AAS specifications that are not addressed here but at the corrsponding workstreams (AAS in Details) for the Industrial Digital Twin Association (IDTA).

You can contact us via our mailing list ([email protected]).

Feel free also to (subscribe to our mailing list)[https://accounts.eclipse.org/mailing-list/aas4j-dev]

How to Contribute

We always look for contributions, bug reports, feature requests etc. Please, read https://github.com/eclipse-digitaltwin/aas4j/blob/main/CONTRIBUTING.md for more information.

Contributors

An updated list of the committers can be found here: https://projects.eclipse.org/projects/dt.aas4j/who

This project was initiated by SAP and Fraunhofer to provide a foundation for the AAS development and to foster its dissemination.

License

Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.

Copyright 2023 SAP SE or an SAP affiliate company and Eclipse AAS4J contributors.

The serializers contained in this repository provide the functionalities to serialize and deserialize instances of the Asset Administration Shell (AAS) data model from and to the AAS Java Model library. It is licensed under the Apache License 2.0 (see LICENSE).

The Model uses the concepts of the document "Specifications of Asset Administration Shell" published on Industrial Digital Twin Association (IDTA) which is licensed under Creative Commons CC BY 4.0.

aas4j's People

Contributors

andreas-schilling avatar arnoweiss avatar chris-volk avatar dependabot[bot] avatar fischerrene avatar frankschnicke avatar fvolz avatar kenwenzel avatar mjacoby avatar sebbader-sap avatar tobiaskraft avatar twebermartins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aas4j's Issues

No ReleaseCandidate Version in Package Path

From #3:
Would it be possible to go for a package name only containing the target version (v3) and not also including the current working version (in this case rc02)? I don't see a benefit having the sub-package.

Only the additional effort on the consumer side - when fetching a new version - to update all imports. Also when we come to v3 final, the rc-package will be removed and the build within consumer projects will fail.

Originally posted by @Smudo99 in #3 (comment)

Clearify Development/Release Process

Follow-up ticket from admin-shell-io/java-serializer#61

We need to clarify how the development & release process works, w.r.t. branch-naming, tagging, and release.
Previously (under admin-shell.io), a push on main branch triggered a maven release. Current pipeline seems to trigger a maven release when a Github release is made.
I propose changing the pipeline to trigger upon creating of a tag following the format vX.Y.Z and don't release on Github at all (maybe SNAPSHOTs but they can also be released via maven).

We should also define additional things like

  • How to do hot fixes, i.e. fixes an older released versions (e.g. create branch before creating a release tag and keep that branch)
  • How to keep dependencies up-to-date (only for latest version or also older versions?)

Dependabot for AAS4J

Pretty self-explanatory. We keep having issues with CVEs and API-changes in dependencies. We can streamline the process if there is a default-PR when a dependency is updated.

AASX XML generated with jackson 2.13.* is invalid

from admin-shell-io/java-serializer#66:

"
Using the AASX XML generator with jackson-dataformat-xml versions 2.13.* results in invalid XML.

The deepest child elements are not prefixed.
Here is the generated XML with version jackson-dataformat-xml 2.13.3

<?xml version='1.0' encoding='UTF-8'?>
<aas:aasenv xmlns:aas="http://www.admin-shell.io/aas/3/0" xmlns:IEC61360="http://www.admin-shell.io/IEC61360/3/0" xmlns:abac="http://www.admin-shell.io/aas/abac/3/0" xmlns:aas_common="http://www.admin-shell.io/aas_common/3/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.admin-shell.io/aas/3/0 AAS.xsd http://www.admin-shell.io/IEC61360/3/0 IEC61360.xsd http://www.admin-shell.io/aas/abac/3/0 AAS_ABAC.xsd">
    <aas:assetAdministrationShells>
        <aas:assetAdministrationShell>
            <idShort>defaultAdminShell</idShort>  <!-- missing prefix is here! -->
        </aas:assetAdministrationShell>
    </aas:assetAdministrationShells>
    <aas:assets>
        <aas:asset>
            <idShort>defaultAsset</idShort> <!-- missing prefix is here! -->
        </aas:asset>
    </aas:assets>
......

Here is the generated XML with version jackson-dataformat-xml 2.12.7:

<?xml version='1.0' encoding='UTF-8'?>
<aas:aasenv xmlns:aas="http://www.admin-shell.io/aas/3/0" xmlns:IEC61360="http://www.admin-shell.io/IEC61360/3/0" xmlns:abac="http://www.admin-shell.io/aas/abac/3/0" xmlns:aas_common="http://www.admin-shell.io/aas_common/3/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.admin-shell.io/aas/3/0 AAS.xsd http://www.admin-shell.io/IEC61360/3/0 IEC61360.xsd http://www.admin-shell.io/aas/abac/3/0 AAS_ABAC.xsd">
    <aas:assetAdministrationShells>
        <aas:assetAdministrationShell>
            <aas:idShort>defaultAdminShell</aas:idShort> <!-- prefixes are set correctly -->
        </aas:assetAdministrationShell>
    </aas:assetAdministrationShells>
    <aas:assets>
        <aas:asset>
            <aas:idShort>defaultAsset</aas:idShort> <!-- prefixes are set correctly -->
        </aas:asset>
    </aas:assets>

We detected this issue after an upgrade of Spring Boot that depends on Jackson 2.13.3.
"

Upgrade the dataformat-rdf module to RC02

89694e9 has a fixed version of the JSON-LD unit tests. However, I have only fixed the mixins and the main test file. I assume the other rdf files under src/test/resources need to be upgraded, too.

UnitTests for SubmodelElementLists in the Serialisers

The change from SubmodelElementStruct back to SubmodelElementCollection resulted in a replacement of all SubmodelElementLists and SubmodelElementStructs to SubmodelElementCollections due to the conducted copy-replace activity.

This leads to the current situation that the ordered nature of SubmodelElementLists is not tested in the UnitTests.

This issue is a reminder for us to add such tests as soon as the functional features of v3.0.RC02 have been implemented.

AssetAdministrationShellEnvironmentSerializer sets empty lists to null during XML serialization and breaks serialized Environment

The AssetAdministrationShellEnvironmentSerializer has an side effect on the Environment that is being serialized and thus it is broken afterwards.
It's not possible to serialize it a second time, e.g. to write both XML and AASX files.

The problematic part of the code is the following (line 125ff):

private void writeWrappedArray(ToXmlGenerator xgen, QName wrapper, QName wrapped, List<?> list)
            throws IOException {
        // overwrite all empty list with null, as the schema does not allow empty XML lists
        for (Object obj : list) ReflectionHelper.setEmptyListsToNull(obj);

The comment explains the measure, however the serializer should handle this issue differently. If this is not possible it probably would be best to keep track of which fields have been replaced with null and revert the change afterwards.

Apparently, wrong entry xs:NonNegativeInteger in XSD of this repo

AAS XML Schema is not validating. One reason might be
the entry

<xs:enumeration value="xs:NonNegativeInteger"/>

in AAS.xsd:994

XML Schema validation gives the following error (sorry error is generated in German)

lineNumber: 202; columnNumber: 63; cvc-enumeration-valid: Wert 'xs:NonNegativeInteger' ist nicht Facet-gültig in Bezug auf Enumeration '[xs:anyURI, xs:base64Binary, xs:boolean, xs:date, xs:dateTime, xs:dateTimeStamp, xs:decimal, xs:double, xs:duration, xs:float, xs:gDay, xs:gMonth, xs:gMonthDay, xs:gYear, xs:gYearMonth, xs:hexBinary, xs:string, xs:time, xs:dayTimeDuration, xs:yearMonthDuration, xs:integer, xs:long, xs:int, xs:short, xs:byte, xs:nonNegativeInteger, xs:positiveInteger, xs:unsignedLong, xs:unsignedInt, xs:unsignedShort, xs:unsignedByte, xs:nonPositiveInteger, xs:negativeInteger]'. Er muss ein Wert aus der Enumeration sein.

The generated output looks like this

<aas:property>
   <aas:category>VARIABLE</aas:category>
   <aas:idShort>testPropertyWithMinLengthConstraint</aas:idShort>
   <aas:kind>Template</aas:kind>
   <aas:semanticId>
      <aas:type>ModelReference</aas:type>
      <aas:keys>
         <aas:key>
            <aas:type>ConceptDescription</aas:type>
            <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithMinLengthConstraint</aas:value>
         </aas:key>
      </aas:keys>
   </aas:semanticId>
   <aas:valueType>xs:NonNegativeInteger</aas:valueType>
   <aas:value>Unknown</aas:value>
</aas:property>

It appears to have more like this

<aas:valueType> xs:nonNegativeInteger </aas:valueType>

It seems a mistake in the AAS.xsd was not properly migrated from
https://github.com/admin-shell-io/aas-specs/blob/ee3cdf493601f0f7f4b8c258285d324701a8c0eb/schemas/xml/AAS.xsd#L994

@arnoweiss thanks for the hint.

Invalid XML-Serialization of Property:displayName

When serializing a property with a displayName, the <displayName> foobar <\displayName> tag is missing. Example:

<aas:property>
          <category>VARIABLE</category>
          <idShort>capacityGroupId</idShort>
          <aas:description>
            <aas:langString>
              <aas:language>en</aas:language>
              <aas:text>The Capacity Group ID identifies the capacity group on a global level.</aas:text>
            </aas:langString>
          </aas:description>
          <kind>Template</kind>
          <semanticId>
            <aas:keys>
              <aas:key>
                <aas:type>ConceptDescription</aas:type>
                <aas:value>urn:bamm:io.catenax.capacity_group:1.0.0#capacityGroupId</aas:value>
              </aas:key>
            </aas:keys>
          </semanticId>
          <valueType>xs:string</valueType>
          <value>0157ba42-d2a8-4e28-8565-7b07830c1110</value>
          <aas:langString>                                        <!-- Error starts here-->
            <aas:language>en</aas:language>
            <aas:text>Capacity Group ID</aas:text>
          </aas:langString>                                       <!-- Error ends here-->
</aas:property>

As it should, this does not validate against the xsd indicating an error in the last section of the example. The whole environment as AAS-XML can be provided at request (Github doesn't allow to attach XML to tickets for whatever reason)

No packages exists

Hi,

I am trying to convert an .aasx (xml) file to json. However, there isn't any packages published in this new repository. Packages exist in the old repo https://github.com/orgs/admin-shell-io/packages?repo_name=java-serializer.

Also there is env.GITHUB_REPOSITORY parameter in pom.xml which is not filled properly and not documented.

Proper Default Handling for HasKind/kind

Part 1 states that HasKind/kind has the default value Instance:
image

However, the current behaviour is that, for instance, a Submodel with no kind element returns null if executing getKind().

Proposal for discussion (alternative#1):
Let's change the functionality for getKind() to something like if (this.kind != null) { return this.kind } else { return ModelingKind.Intance }

pro:

  • if the deserialised Submodel has no kind attribute, so has its serialised version (would be different if we initialise it with ModelingKind.Intance)
  • no null value returned as the actual value is not null

con:

  • customisation of the generator only for HasKind necessary

Alternative#2:
Initialise with ModelingKind.Intance

con:

  • customisation of the generator only for HasKind necessary
  • deserialisation-serialization cycle "creates" the hasKind attribute

Alternative#3:
leave it for the business logic to handle kind = null

pro:

  • no custom adjustments in the generator

con:

  • what if the business application developer is not aware of the default value?

Fix JSON Unit Tests

The dataformat-json module of the initial version (PR #2) currently passes only one of the created tests. The others fail due to the upgrade of the model to version 3.0.RC02. The code needs to be reviewed and the compared AAS JSON files in the test/resources folder updated.

Update LICENSE

The LICENSE should be updated:

  • Change old license of Plattform Industrie 4.0 documents -from CC BY-ND 3.0 DE to CC BY-3.0 (see [here for more details](reative Commons CC BY-ND 3.0 DE))

  • Do we need the header with the copyright? This is stopping that GitHub automatic identifies the Open Source License used in this project

Use custom XMLInputFactory and XMLOutputFactory for XML and AASX

Currently the XmlSerializer and XmlDeserializer rely on the standard behavior of Jackson and in the end of the JRE to create instances for XMLInputFactory and XMLOutputFactory.

In some environments - for example within an OSGi container - it may be necessary to provide custom instances for XMLInputFactory and XMLOutputFactory because the JRE is not able to load them from an OSGi bundle.

To use custom instances it is currently required to create subclasses and overwrite the buildMapper methods and replicate the contained code.
I would suggest to extend the constructors for passing an instance of com.fasterxml.jackson.dataformat.xml.XmlFactory.

Also AASXSerializer and AASXDeserializer allow to pass custom instances of the XML (de)serializers but additionaly create a default instance as can be seen here:

private XmlDeserializer deserializer = new XmlDeserializer();

I'll prepare a PR for this issue.

Discriminator definition not in Metamodel?

Where is this Discriminator defined? Seems like AAS4j and Admin-Shell.io make use of the same discriminator "modelType" and I guess it would be important for interoperability to have the same discriminator for all JSON-Representations of the Metamodel? Shouldn't this be part of the Specification of the Metamodel?

[Feature] Copy constructor in base classes

Currently, there's no proper way to copy a meta-model-instance. The classes don't implement Cloneable or offer a copy constructor. Especially when creating multiple instances of an object (like multiple Properties in a SubmodelElementList) from a template (single Property in a SubmodelElementList) this would come in quite handy.

Establish AAS4J contribution guidelines

o ACTION (Thiago) - Look for existing OSS project guidelines ( https://github.com/eclipse/rdf4j/blob/main/.github/CONTRIBUTING.md) and select one that fits our needs

o DECISION - Work with forks

o DECISION GitHub – Main (maintained current release) & Branch (development of new features), Releases (Maven Central)

• Release Review / Eclipse Foundation with IP Review

o ACTION (See roadmap, Frank) CI: use GitHub Actions and Eclipse infrastructure (Maven Central Account, Jenkin) (TO DO)

o OPEN / TO BE DISCUSSED ASAP - Versioning and how to deal with V3 RC02 and V3 (final, stable)
• Issue / requirements: some companies require v.1.x.y so that it can be used in production

Enable more than one DataSpecificationContent

c116cf7 contains a working version for DataSpecificationIEC61360. However, were is already one other mentioned DataSpecificationTemplate in the specifications, namely DataSpecificationPhysicalUnit.

There are two options how to tackle this:

  1. Create (recreate?) custom Deserialisers for DataSpecificationContent
  2. Require an attribute similar to modelType in the schemas

Add SupplementalSemanticIds to Test files

The concept of supplemental semanticIds was introduced with V3RC02. It's not yet present in the test files and should be added to the Full-Examples in at least json, xml and Java.

Add Part 2 Classes

The model currently contains only the classes of the AAS metamodel (aka. Part 1) but the API (aka. Part 2) also introduces further classes. One example are the Descriptors for the registry endpoints. I think it's reasonable to also include the Part 2 classes in this repo, maybe as another module (model-api-classes?) or directly in the current model project.

supplementalSemanticIds not properly serialized in XML output

In the XML serialization of an AAS it seems the Reference to a suplementalSemanticId is not properly serialized.
instead of providing a tag keys to the supplementalSemanticIds are directly added below the tg.

The code I use to generate supplementalSemanticIds can be found here: io.openmanufacturing.sds.aspectmodel.aas.AspectModelAASVisitor#buildReferenceForSeeElement:389
and looks like this:

final Key key =
      new DefaultKey.Builder()
            .type( KeyTypes.GLOBAL_REFERENCE )
            .value( seeReference )
            .build();
return new DefaultReference.Builder().type( ReferenceTypes.GLOBAL_REFERENCE ).keys( key ).build();

It generates the following output:

<aas:supplementalSemanticIds>
  <aas:type>GlobalReference</aas:type>
  <aas:keys>
    <aas:key>
      <aas:type>GlobalReference</aas:type>
      <aas:value>[http://example.com/me</aas:value](http://example.com/me%3c/aas:value)>
    </aas:key>
  </aas:keys>

But the output should look like this according to the XML Schema:
´´`
aas:supplementalSemanticIds
aas:reference
aas:type</aas:type>
aas:keys
aas:key
aas:type</aas:type>
aas:value</aas:value>
</aas:key>
</aas:keys>
</aas:reference>


Migrate old issues

Please, migrate issues from old repositories (aas-model, aas-serializer, ...)

XSD validation fails due to types xsd:gYear, xsd:gMonth, xsd:gYearMonth, xsd:gMonthDay serialized with lower case second letter (xs:gyear, xs:gmonth, xs:gyearMonth, xs:gmonthDay)

AAS XML Schema is not validating due to

org.xml.sax.SAXParseException; lineNumber: 74; columnNumber: 50; cvc-enumeration-valid: Wert 'xs:gyear' ist nicht Facet-gültig in Bezug auf Enumeration '[xs:anyURI, xs:base64Binary, xs:boolean, xs:date, xs:dateTime, xs:dateTimeStamp, xs:decimal, xs:double, xs:duration, xs:float, xs:gDay, xs:gMonth, xs:gMonthDay, xs:gYear, xs:gYearMonth, xs:hexBinary, xs:string, xs:time, xs:dayTimeDuration, xs:yearMonthDuration, xs:integer, xs:long, xs:int, xs:short, xs:byte, xs:nonNegativeInteger, xs:positiveInteger, xs:unsignedLong, xs:unsignedInt, xs:unsignedShort, xs:unsignedByte, xs:nonPositiveInteger, xs:negativeInteger]'. Er muss ein Wert aus der Enumeration sein.

Relevant part of the generated AAS XML file is below.

The problematic lines are
74 with <aas:valueType>xs:gyear</aas:valueType>
90 with <aas:valueType>xs:gmonth</aas:valueType>
122 with <aas:valueType>xs:gyearMonth</aas:valueType>
138 with <aas:valueType>xs:gmonthDay</aas:valueType>

It seems names of the time types is not properly generated.

The input values I have checked and are ok and look like

bamm:dataType xsd:gYear ;
bamm:dataType xsd:gMonth ;
bamm:dataType xsd:gYearMonth ;
bamm:dataType xsd:gMonthDay ;

Source

<?xml version='1.0' encoding='UTF-8'?>
<aas:environment xmlns:aas="https://admin-shell.io/aas/3/0/RC02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://admin-shell.io/aas/3/0/RC02 AAS.xsd">
   <aas:assetAdministrationShells>
      <aas:assetAdministrationShell>
         <aas:idShort>defaultAdminShell</aas:idShort>
         <aas:description>
            <aas:langString>
               <aas:language>en</aas:language>
               <aas:text>defaultAdminShell</aas:text>
            </aas:langString>
         </aas:description>
         <aas:checksum>a checksum</aas:checksum>
         <aas:administration/>
         <aas:id>defaultAdminShell</aas:id>
         <aas:embeddedDataSpecifications>
            <aas:embeddedDataSpecification>
               <aas:dataSpecification>
                  <aas:type>GlobalReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>GlobalReference</aas:type>
                        <aas:value>Optional[urn:bamm:io.openmanufacturing.test:1.0.0#AspectWithGTypeForRangeConstraints]</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:dataSpecification>
               <aas:dataSpecificationContent>
                  <aas:dataSpecificationIec61360>
                     <aas:preferredName>
                        <aas:langString>
                           <aas:language>EN</aas:language>
                           <aas:text>AspectWithGTypeForRangeConstraints</aas:text>
                        </aas:langString>
                     </aas:preferredName>
                     <aas:value>AspectWithGTypeForRangeConstraints</aas:value>
                  </aas:dataSpecificationIec61360>
               </aas:dataSpecificationContent>
            </aas:embeddedDataSpecification>
         </aas:embeddedDataSpecifications>
         <aas:assetInformation>
            <aas:assetKind>Instance</aas:assetKind>
         </aas:assetInformation>
      </aas:assetAdministrationShell>
   </aas:assetAdministrationShells>
   <aas:submodels>
      <aas:submodel>
         <aas:idShort>AspectWithGTypeForRangeConstraints</aas:idShort>
         <aas:checksum>-1451635856</aas:checksum>
         <aas:administration/>
         <aas:id>Optional[urn:bamm:io.openmanufacturing.test:1.0.0#AspectWithGTypeForRangeConstraints]/submodel</aas:id>
         <aas:kind>Template</aas:kind>
         <aas:semanticId>
            <aas:type>ModelReference</aas:type>
            <aas:keys>
               <aas:key>
                  <aas:type>ConceptDescription</aas:type>
                  <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#AspectWithGTypeForRangeConstraints</aas:value>
               </aas:key>
            </aas:keys>
         </aas:semanticId>
         <aas:submodelElements>
            <aas:property>
               <aas:category>VARIABLE</aas:category>
               <aas:idShort>testPropertyWithGYear</aas:idShort>
               <aas:kind>Template</aas:kind>
               <aas:semanticId>
                  <aas:type>ModelReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>ConceptDescription</aas:type>
                        <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithGYear</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:semanticId>
               <aas:valueType>xs:gyear</aas:valueType>
               <aas:value>Unknown</aas:value>
            </aas:property>
            <aas:property>
               <aas:category>VARIABLE</aas:category>
               <aas:idShort>testPropertyWithGMonth</aas:idShort>
               <aas:kind>Template</aas:kind>
               <aas:semanticId>
                  <aas:type>ModelReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>ConceptDescription</aas:type>
                        <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithGMonth</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:semanticId>
               <aas:valueType>xs:gmonth</aas:valueType>
               <aas:value>Unknown</aas:value>
            </aas:property>
            <aas:property>
               <aas:category>VARIABLE</aas:category>
               <aas:idShort>testPropertyWithGDay</aas:idShort>
               <aas:kind>Template</aas:kind>
               <aas:semanticId>
                  <aas:type>ModelReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>ConceptDescription</aas:type>
                        <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithGDay</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:semanticId>
               <aas:valueType>xs:string</aas:valueType>
               <aas:value>Unknown</aas:value>
            </aas:property>
            <aas:property>
               <aas:category>VARIABLE</aas:category>
               <aas:idShort>testPropertyWithGYearMonth</aas:idShort>
               <aas:kind>Template</aas:kind>
               <aas:semanticId>
                  <aas:type>ModelReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>ConceptDescription</aas:type>
                        <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithGYearMonth</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:semanticId>
               <aas:valueType>xs:gyearMonth</aas:valueType>
               <aas:value>Unknown</aas:value>
            </aas:property>
            <aas:property>
               <aas:category>VARIABLE</aas:category>
               <aas:idShort>testPropertyWithGMonthYear</aas:idShort>
               <aas:kind>Template</aas:kind>
               <aas:semanticId>
                  <aas:type>ModelReference</aas:type>
                  <aas:keys>
                     <aas:key>
                        <aas:type>ConceptDescription</aas:type>
                        <aas:value>urn:bamm:io.openmanufacturing.test:1.0.0#testPropertyWithGMonthYear</aas:value>
                     </aas:key>
                  </aas:keys>
               </aas:semanticId>
               <aas:valueType>xs:gmonthDay</aas:valueType>
               <aas:value>Unknown</aas:value>
            </aas:property>
         </aas:submodelElements>
      </aas:submodel>
   </aas:submodels>
´``


.equals methods for collection-like elements

For some collection-like AAS type classes the equals method does not work as expected, e.g.

Property property1 = new DefaultProperty.Builder()
		.idShort("property1")
		.build();
Property property2 = new DefaultProperty.Builder()
		.idShort("property2")
		.build();
SubmodelElementCollection smc1 = new DefaultSubmodelElementCollection.Builder()
		.value(List.of(property1, property2))
		.build();
SubmodelElementCollection smc2 = new DefaultSubmodelElementCollection.Builder()
		.value(List.of(property2, property1))
		.build();
// expected: true, actual: false
boolean equals = Objects.equals(smc1, smc2);

returns false although SubmodelElementCollection is defined to not be ordered. Same goes for Submodel class.

For SubmodelElementList this issue is more complex as it has the ordered property.

Property property1 = new DefaultProperty.Builder()
		.idShort("property1")
		.build();
Property property2 = new DefaultProperty.Builder()
		.idShort("property2")
		.build();
SubmodelElementList smc1 = new DefaultSubmodelElementList.Builder()
		.value(List.of(property1, property2))
		.build();
SubmodelElementList smc2 = new DefaultSubmodelElementList.Builder()                
		.value(List.of(property2, property1))
		.build();
smc1.setOrderRelevant(false);
smc2.setOrderRelevant(false);
// expected: true, actual: false
boolean equalsWithoutOrder = Objects.equals(smc1, smc2);
smc1.setOrderRelevant(true);
// expected: false, actual: false
boolean equalsWithOrderOneElement = Objects.equals(smc1, smc2);
smc2.setOrderRelevant(true);
// expected: false, actual: false
boolean equalsWithOrder = Objects.equals(smc1, smc2);

All .equals calls return false in this example, whereas equalsWithoutOrder should be true as order should be ignored.

This behavior is not compliant with the current specification.
However, there is a discussion if the specification should be updated to ensure order in such collections (admin-shell-io/aas-specs#248).

Before any release we should make sure that we are compliant to the specification.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.