Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ the document 'Details of the Asset Administration Shell', published on
You can build the project using Maven by simply executing at the repository
root:

`mvn clean install`
`mvn clean package`

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

```
<dependency>
Expand All @@ -23,7 +23,6 @@ or by integrating the respective modules as dependencies, for instance:
<version>latest-version</version>
<dependency>
```
> **_NOTE:_** The library is yet not available as dependency but will be deployed via Maven Central in the future.

# Project Structure

Expand All @@ -45,21 +44,21 @@ We always look for contributions, bug reports, feature requests etc. Simply open

# Contributors

| Name | Affiliation | Github Account | parent | core | aasx | json | xml | json-ld | validator|
--- | --- | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---:
| Name | Affiliation | Github Account | parent | core | aasx | json | xml | json-ld | ua-nodeset | validator|
--- | --- | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---:| :---:
| Mohammad Alreeni | Fraunhofer IWU | []() | | | | | x | | |
| Sebastian Bader | Fraunhofer IAIS | [sebbader](https://github.com/sebbader) | x | | | | | x | x |
| Matthias Böckmann | Fraunhofer IAIS | [maboeckmann](https://github.com/maboeckmann) | x | | | | | x | x |
| Maximilian Conradi | Fraunhofer IESE | []() | | | x | | x | | |
| Helge Dickel | SAP SE | [heldic](https://github.com/heldic) | x | | | x | x | | |
| Daniel Espen | Fraunhofer IESE | [daespen](https://github.com/daespen) | | x | x | x | x | | |
| Michael Jacoby | Fraunhofer IOSB| [mjacoby](https://github.com/mjacoby) | x | x | | x | x | | |
| Jens Müller | Fraunhofer IOSB | [JensMueller2709](https://github.com/JensMueller2709) | | | | x | | | |
| Orthodoxos Kipouridis | SAP SE | [akiskips](https://github.com/akiskips) | x | | | x | x | | |
| Bastian Rössl | Fraunhofer IOSB-INA | [br-iosb](https://github.com/br-iosb) | | | | x | | | |
| Frank Schnicke | Fraunhofer IESE | [frankschnicke](https://github.com/frankschnicke) | | | x | | x | | |
| Manuel Sauer | SAP SE | [Manu3756](https://github.com/Manu3756) | x | | | | | | |
| Arno Weiss | Fraunhofer IWU | [alw-iwu](https://github.com/alw-iwu) | | | | x | | | |
| Sebastian Bader | Fraunhofer IAIS | [sebbader](https://github.com/sebbader) | x | | | | | x | | x |
| Matthias Böckmann | Fraunhofer IAIS | [maboeckmann](https://github.com/maboeckmann) | x | | | | | x | | x |
| Maximilian Conradi | Fraunhofer IESE | []() | | | x | | x | | | |
| Helge Dickel | SAP SE | [heldic](https://github.com/heldic) | x | | | x | x | | | |
| Daniel Espen | Fraunhofer IESE | [daespen](https://github.com/daespen) | | x | x | x | x | | | |
| Michael Jacoby | Fraunhofer IOSB| [mjacoby](https://github.com/mjacoby) | x | x | | x | x | | | |
| Jens Müller | Fraunhofer IOSB | [JensMueller2709](https://github.com/JensMueller2709) | | | | x | | | | |
| Orthodoxos Kipouridis | SAP SE | [akiskips](https://github.com/akiskips) | x | | | x | x | | | |
| Bastian Rössl | Fraunhofer IOSB-INA | [br-iosb](https://github.com/br-iosb) | | | | x | | | x | |
| Frank Schnicke | Fraunhofer IESE | [frankschnicke](https://github.com/frankschnicke) | | | x | | x | | | |
| Manuel Sauer | SAP SE | [Manu3756](https://github.com/Manu3756) | x | | | | | | | |
| Arno Weiss | Fraunhofer IWU | [alw-iwu](https://github.com/alw-iwu) | | | | x | | | x | |

This project was initiated by SAP and Fraunhofer to provide a foundation for the
AAS development and to foster its dissemination.
6 changes: 3 additions & 3 deletions dataformat-uanodeset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -132,7 +132,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- excluding generated classes and mappers which are not meant to be used directly -->
<excludePackageNames>com.kscs.util.*:org.opcfoundation.*:io.adminshell.aas.v3.dataformat.i4aas.mappers:io.adminshell.aas.v3.dataformat.i4aas.mappers.*</excludePackageNames>
<excludePackageNames>com.kscs.util.*:org.opcfoundation.*:io.adminshell.aas.v3.dataformat.i4aas.mappers:io.adminshell.aas.v3.dataformat.i4aas.mappers.*:io.adminshell.aas.v3.dataformat.i4aas.parsers</excludePackageNames>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@
*/
package io.adminshell.aas.v3.dataformat.i4aas;

import javax.xml.bind.JAXBException;

import org.opcfoundation.ua._2011._03.uanodeset.UANodeSet;

import io.adminshell.aas.v3.dataformat.DeserializationException;
import io.adminshell.aas.v3.dataformat.Deserializer;
import io.adminshell.aas.v3.dataformat.i4aas.parsers.EnvironmentParser;
import io.adminshell.aas.v3.dataformat.i4aas.parsers.ParserContext;
import io.adminshell.aas.v3.model.AssetAdministrationShellEnvironment;

/**
Expand All @@ -29,8 +35,15 @@ public class I4AASDeserializer implements Deserializer {
* reads a I4AAS as string and return the model object
*/
@Override
public AssetAdministrationShellEnvironment read(String value) throws DeserializationException {
throw new UnsupportedOperationException("Not Implemented yet.");
public AssetAdministrationShellEnvironment read(String input) throws DeserializationException {
try {
UANodeSet unmarshall = new UANodeSetUnmarshaller().unmarshall(input);
ParserContext parserContext = new ParserContext(unmarshall);
AssetAdministrationShellEnvironment parsedEnvironment = new EnvironmentParser(parserContext.getEnvironment(), parserContext).parse();
return parsedEnvironment;
} catch (JAXBException e) {
throw new DeserializationException("Deserialization failed on unmarshalling.", e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.adminshell.aas.v3.dataformat.i4aas;

import javax.xml.bind.JAXBException;

import org.opcfoundation.ua._2011._03.uanodeset.UANodeSet;
import org.opcfoundation.ua._2011._03.uanodeset.UAObject;

Expand All @@ -30,15 +31,31 @@
*
*/
public class I4AASSerializer implements Serializer {

private boolean addMissingSemanticIdsToDictionary;

/**
* I4AASSerializer with addMissingSemanticIdsToDictionary defaults to true
*/
public I4AASSerializer() {
this(true);
}

/**
* @param addMissingSemanticIdsToDictionary handles missing semanticIds in OPC UA Dictionary (caused by missing AAS Concept Description) by adding them automatically
*/
public I4AASSerializer(boolean addMissingSemanticIdsToDictionary) {
this.addMissingSemanticIdsToDictionary = addMissingSemanticIdsToDictionary;
}

/**
* takes a AAS model and returns a I4AAS as string.
*/
@Override
public String write(AssetAdministrationShellEnvironment aasEnvironment) throws SerializationException {
MappingContext mappingContext = new MappingContext(aasEnvironment);
mappingContext.setAddMissingSemanticIdsToDictionary(addMissingSemanticIdsToDictionary);
UAObject uaEnv = new EnvironmentMapper(mappingContext.getEnvironment(), mappingContext).map();

//map action
UANodeSet nodeset = mappingContext.getNodeSet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

import org.opcfoundation.ua._2008._02.types.ListOfExtensionObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.opcfoundation.ua._2011._03.uanodeset.UAObject;
import org.opcfoundation.ua._2011._03.uanodeset.UAVariable;

import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASUtils;
import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASIdentifier;
import io.adminshell.aas.v3.model.AdministrativeInformation;

Expand All @@ -32,8 +31,8 @@ public AdministrationMapper(AdministrativeInformation src, MappingContext ctx) {
@Override
protected UAObject createTargetObject() {
target = UAObject.builder().withNodeId(ctx.newModelNodeIdAsString())
.withBrowseName(createI4AASBrowseName("Administration"))
.withDisplayName(createLocalizedText("Administration")).build();
.withBrowseName(createI4AASBrowseName(ADMINISTRATION_BROWSENAME))
.withDisplayName(createLocalizedText(ADMINISTRATION_BROWSENAME)).build();
addTypeReference(I4AASIdentifier.AASAdministrativeInformationType);
return target;
}
Expand All @@ -43,13 +42,13 @@ protected void mapAndAttachChildren() {
if (source != null) {
String revision = source.getRevision();
if (revision != null) {
UAVariable revisionStringProperty = new StringPropertyMapper("Revision", revision, ctx,
UAVariable revisionStringProperty = new StringPropertyMapper(ADMINISTRATION_REVISION_BROWSENAME, revision, ctx,
ctx.getI4aasNsIndex()).map();
attachAsProperty(target, revisionStringProperty);
}
String version = source.getVersion();
if (version != null) {
UAVariable versionStringProperty = new StringPropertyMapper("Version", version, ctx,
UAVariable versionStringProperty = new StringPropertyMapper(ADMINISTRATION_VERSION_BROWSENAME, version, ctx,
ctx.getI4aasNsIndex()).map();
attachAsProperty(target, versionStringProperty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
import java.util.List;

import org.opcfoundation.ua._2011._03.uanodeset.UAObject;

import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASIdentifier;
import io.adminshell.aas.v3.model.AssetAdministrationShell;
import io.adminshell.aas.v3.model.AssetInformation;
import io.adminshell.aas.v3.model.DataTypeIEC61360;
import io.adminshell.aas.v3.model.HasDataSpecification;
import io.adminshell.aas.v3.model.Submodel;

public class AssetAdministrationShellMapper extends IdentifiableMapper<AssetAdministrationShell> implements HasDataSpecificationMapper {

Expand All @@ -49,25 +47,27 @@ protected void mapAndAttachChildren() {

private void mapAsset() {
AssetInformation assetInformation = source.getAssetInformation();
UAObject uaAsset = new AssetInformationMapper(assetInformation, ctx).map();
attachAsComponent(target, uaAsset);
if (assetInformation != null) {
UAObject uaAsset = new AssetInformationMapper(assetInformation, ctx).map();
attachAsComponent(target, uaAsset);
}
}

private void mapSubmodels() {
UAObject smFolder = createReferenceList("Submodel");
UAObject smFolder = createReferenceList(AAS_SUBMODELREFERENCES_LIST_BROWSENAME);
List<io.adminshell.aas.v3.model.Reference> submodels = source.getSubmodels();
for (int i = 0; i < submodels.size(); i++) {
io.adminshell.aas.v3.model.Reference reference = submodels.get(i);
UAObject createSubmodelReferenceUaObject = new ReferenceMapper(reference, ctx,
"Submodel:" + reference.getKeys().get(0).getValue()).map();
SM_DISPLAYNAME_PREFIX + reference.getKeys().get(0).getValue()).map();
attachAsComponent(smFolder, createSubmodelReferenceUaObject);
}
}

private void mapDerivedFrom() {
io.adminshell.aas.v3.model.Reference derivedFrom = source.getDerivedFrom();
if (derivedFrom != null) {
UAObject uaDerivedFrom = new ReferenceMapper(derivedFrom, ctx, "DerivedFrom").map();
UAObject uaDerivedFrom = new ReferenceMapper(derivedFrom, ctx, AAS_DERIVEDFROM_BROWSENAME).map();
attachAsComponent(target, uaDerivedFrom);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import org.opcfoundation.ua._2011._03.uanodeset.UAVariable;

import io.adminshell.aas.v3.dataformat.i4aas.mappers.sme.FileMapper;
import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASUtils;
import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASIdentifier;
import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.UaIdentifier;
import io.adminshell.aas.v3.model.AssetInformation;
import io.adminshell.aas.v3.model.AssetKind;
import io.adminshell.aas.v3.model.File;
Expand All @@ -39,8 +37,8 @@ public AssetInformationMapper(AssetInformation src, MappingContext ctx) {
@Override
protected UAObject createTargetObject() {
target = UAObject.builder().withNodeId(ctx.newModelNodeIdAsString())
.withBrowseName(createI4AASBrowseName("AssetInformation"))
.withDisplayName(createLocalizedText("AssetInformation")).build();
.withBrowseName(createI4AASBrowseName(AAS_ASSETINFORMATION_BROWSENAME))
.withDisplayName(createLocalizedText(AAS_ASSETINFORMATION_BROWSENAME)).build();
addTypeReference(I4AASIdentifier.AASAssetInformationType);
return target;
}
Expand All @@ -53,26 +51,26 @@ protected void mapAndAttachChildren() {

Reference globalAssetId = source.getGlobalAssetId();
if (globalAssetId != null) {
UAObject uaIdentification = new ReferenceMapper(globalAssetId, ctx, "GlobalAssetId").map();
UAObject uaIdentification = new ReferenceMapper(globalAssetId, ctx, ASSETINFO_GLOBAL_ASSET_ID_BROWSENAME).map();
attachAsComponent(target, uaIdentification);
}

UAObject uaBomList = createReferenceList("BillOfMaterial");
UAObject uaBomList = createReferenceList(ASSETINFO_BILL_OF_MATERIAL_BROWSENAME);
List<Reference> billOfMaterials = source.getBillOfMaterials();
for (int i = 0; i < billOfMaterials.size(); i++) {
Reference reference = billOfMaterials.get(i);
UAObject uaBomListEntry = new ReferenceMapper(reference, ctx, "BillOfMaterial_" + i).map();
UAObject uaBomListEntry = new ReferenceMapper(reference, ctx, ASSETINFO_BILL_OF_MATERIAL_BROWSENAME + "_" + i).map();
attachAsComponent(uaBomList, uaBomListEntry);
}

File defaultThumbnail = source.getDefaultThumbnail();
if (defaultThumbnail != null) {
UAObject uaThumbnail = new FileMapper(defaultThumbnail, ctx, "DefaultThumbnail", ctx.getI4aasNsIndex())
UAObject uaThumbnail = new FileMapper(defaultThumbnail, ctx, ASSETINFO_DEFAULT_THUMBNAIL_BROWSENAME, ctx.getI4aasNsIndex())
.map();
attachAsComponent(target, uaThumbnail);
}

UAObject folder = createIdentifierKeyValuePairList("SpecificAssetId");
UAObject folder = createIdentifierKeyValuePairList(ASSETINFO_SPECIFIC_ASSET_ID_BROWSENAME);
for (IdentifierKeyValuePair identifierKeyValuePair : source.getSpecificAssetIds()) {
UAObject uaIdKVP = new IdentifierKeyValuePairMapper(identifierKeyValuePair, ctx).map();
attachAsComponent(folder, uaIdKVP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.opcfoundation.ua._2008._02.types.ObjectFactory;
import org.opcfoundation.ua._2011._03.uanodeset.UAVariable;

import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASUtils;
import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.UaIdentifier;

public class BooleanPropertyMapper extends I4AASMapper<Boolean, UAVariable> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import io.adminshell.aas.v3.dataformat.i4aas.mappers.utils.I4AASIdentifier;
import io.adminshell.aas.v3.model.ConceptDescription;
import io.adminshell.aas.v3.model.Identifier;
import io.adminshell.aas.v3.model.IdentifierType;
import io.adminshell.aas.v3.model.Reference;

Expand All @@ -32,14 +33,22 @@ public ConceptDescriptionMapper(ConceptDescription src, MappingContext ctx) {
protected UAObject createTargetObject() {
target = super.createTargetObject();

IdentifierType idType = source.getIdentification().getIdType();
if (IdentifierType.IRI == idType) {
addTypeReference(I4AASIdentifier.AASIriConceptDescriptionType);
} else if (IdentifierType.IRDI == idType) {
addTypeReference(I4AASIdentifier.AASIrdiConceptDescriptionType);
} else if (IdentifierType.CUSTOM == idType) {
addTypeReference(I4AASIdentifier.AASCustomConceptDescriptionType);
Identifier identification = source.getIdentification();
if (identification != null) {
IdentifierType idType = identification.getIdType();
if (IdentifierType.IRI == idType) {
addTypeReference(I4AASIdentifier.AASIriConceptDescriptionType);
} else if (IdentifierType.IRDI == idType) {
addTypeReference(I4AASIdentifier.AASIrdiConceptDescriptionType);
} else if (IdentifierType.CUSTOM == idType) {
addTypeReference(I4AASIdentifier.AASCustomConceptDescriptionType);
}
if (identification.getIdentifier() != null) {
//conflict: I4AAS says idshort, OPC UA says value
target.setBrowseName(createModelBrowseName(identification.getIdentifier()));
}
}

return target;
}

Expand Down
Loading