27
27
import org .apache .jena .rdf .model .ResourceFactory ;
28
28
import org .apache .jena .vocabulary .RDF ;
29
29
import org .apache .jena .vocabulary .XSD ;
30
+ import org .eclipse .digitaltwin .aas4j .v3 .model .AasSubmodelElements ;
30
31
import org .eclipse .digitaltwin .aas4j .v3 .model .AdministrativeInformation ;
31
32
import org .eclipse .digitaltwin .aas4j .v3 .model .AssetAdministrationShell ;
32
33
import org .eclipse .digitaltwin .aas4j .v3 .model .AssetKind ;
@@ -101,6 +102,7 @@ public class AspectModelAASVisitor implements AspectVisitor<Environment, Context
101
102
public static final String ADMIN_SHELL_NAME = "defaultAdminShell" ;
102
103
public static final String DEFAULT_LOCALE = "EN" ;
103
104
public static final String CONCEPT_DESCRIPTION_CATEGORY = "APPLICATION_CLASS" ;
105
+ public static final String ID_PREFIX = "id_" ;
104
106
105
107
/**
106
108
* Maps Aspect types to DataTypeIEC61360 Schema types, with no explicit mapping defaulting to
@@ -202,7 +204,7 @@ public Environment visitAspect( final Aspect aspect, Context context ) {
202
204
203
205
final AssetAdministrationShell administrationShell =
204
206
new DefaultAssetAdministrationShell .Builder ()
205
- .idShort ( ADMIN_SHELL_NAME )
207
+ .idShort ( ID_PREFIX + ADMIN_SHELL_NAME )
206
208
.description ( createLangString ( ADMIN_SHELL_NAME , "en" ) )
207
209
.checksum ( "a checksum" )
208
210
.id ( ADMIN_SHELL_NAME )
@@ -291,7 +293,7 @@ private SubmodelElementCollection mapToAasSubModelElementCollection(
291
293
final List <SubmodelElement > submodelElements =
292
294
visitProperties ( entity .getAllProperties (), context );
293
295
return new DefaultSubmodelElementCollection .Builder ()
294
- .idShort ( entity .getName () )
296
+ .idShort ( ID_PREFIX + entity .getName () )
295
297
.displayName ( map ( entity .getPreferredNames () ) )
296
298
.description ( map ( entity .getDescriptions () ) )
297
299
.value ( submodelElements )
@@ -301,7 +303,7 @@ private SubmodelElementCollection mapToAasSubModelElementCollection(
301
303
302
304
private org .eclipse .digitaltwin .aas4j .v3 .model .Property mapToAasProperty ( final Property property ) {
303
305
return new DefaultProperty .Builder ()
304
- .idShort ( property .getName () )
306
+ .idShort ( ID_PREFIX + property .getName () )
305
307
.kind ( ModelingKind .TEMPLATE )
306
308
.valueType ( mapAASXSDataType ( property .getCharacteristic ().flatMap ( Characteristic ::getDataType ).map ( this ::mapType ).orElse ( UNKNOWN_TYPE ) ) )
307
309
.displayName ( map ( property .getPreferredNames () ) )
@@ -325,7 +327,7 @@ private Operation map(
325
327
return new DefaultOperation .Builder ()
326
328
.displayName ( map ( operation .getPreferredNames () ) )
327
329
.description ( map ( operation .getDescriptions () ) )
328
- .idShort ( operation .getName () )
330
+ .idShort ( ID_PREFIX + operation .getName () )
329
331
.inputVariables (
330
332
operation .getInput ().stream ()
331
333
.map ( i -> mapOperationVariable ( i , context ) )
@@ -419,7 +421,7 @@ private void createConceptDescription( final Property property, final Context co
419
421
if ( !context .hasEnvironmentConceptDescription ( property .getAspectModelUrn ().toString () ) ) {
420
422
final ConceptDescription conceptDescription =
421
423
new DefaultConceptDescription .Builder ()
422
- .idShort ( characteristic .getName () )
424
+ .idShort ( ID_PREFIX + characteristic .getName () )
423
425
.displayName ( map ( characteristic .getPreferredNames () ) )
424
426
.embeddedDataSpecifications ( extractEmbeddedDataSpecification ( property ) )
425
427
.id ( extractIdentifier ( property ) )
@@ -433,7 +435,7 @@ private void createConceptDescription( final Aspect aspect, final Context contex
433
435
if ( !context .hasEnvironmentConceptDescription ( aspect .getAspectModelUrn ().toString () ) ) {
434
436
final ConceptDescription conceptDescription =
435
437
new DefaultConceptDescription .Builder ()
436
- .idShort ( aspect .getName () )
438
+ .idShort ( ID_PREFIX + aspect .getName () )
437
439
.displayName ( map ( aspect .getPreferredNames () ) )
438
440
.embeddedDataSpecifications ( extractEmbeddedDataSpecification ( aspect ) )
439
441
.id ( extractIdentifier ( aspect ) )
@@ -502,7 +504,8 @@ private DataTypeIEC61360 mapIEC61360DataType( final String urn ) {
502
504
503
505
private DataTypeDefXsd mapAASXSDataType ( final String urn ) {
504
506
final Resource resource = ResourceFactory .createResource ( urn );
505
- return AAS_XSD_TYPE_MAP .getOrDefault ( resource , DataTypeDefXsd .STRING );
507
+ DataTypeDefXsd dataTypeDefXsd = AAS_XSD_TYPE_MAP .getOrDefault ( resource , DataTypeDefXsd .STRING );
508
+ return dataTypeDefXsd ;
506
509
}
507
510
508
511
private void createSubmodelElement ( final SubmodelElementBuilder op , final Context context ) {
@@ -525,7 +528,7 @@ public Environment visitCollection(
525
528
final SubmodelElementBuilder builder =
526
529
( property ) ->
527
530
new DefaultSubmodelElementCollection .Builder ()
528
- .idShort ( property .getName () )
531
+ .idShort ( ID_PREFIX + property .getName () )
529
532
.displayName ( map ( property .getPreferredNames () ) )
530
533
.description ( map ( property .getDescriptions () ) )
531
534
.value ( Collections .singletonList ( decideOnMapping ( property , context ) ) )
@@ -542,7 +545,8 @@ public Environment visitList(
542
545
final SubmodelElementBuilder builder =
543
546
( property ) ->
544
547
new DefaultSubmodelElementList .Builder ()
545
- .idShort ( property .getName () )
548
+ .idShort ( ID_PREFIX + property .getName () )
549
+ .typeValueListElement ( AasSubmodelElements .DATA_ELEMENT ) // TODO check if more specific type info is required
546
550
.displayName ( map ( property .getPreferredNames () ) )
547
551
.description ( map ( property .getDescriptions () ) )
548
552
.value ( Collections .singletonList ( decideOnMapping ( property , context ) ) )
@@ -557,7 +561,7 @@ public Environment visitSet(
557
561
final SubmodelElementBuilder builder =
558
562
( property ) ->
559
563
new DefaultSubmodelElementCollection .Builder () //TODO according to the standard document this should be SubmodelEleementStruct. However, this type is not available in AAS4J
560
- .idShort ( property .getName () )
564
+ .idShort ( ID_PREFIX + property .getName () )
561
565
.displayName ( map ( property .getPreferredNames () ) )
562
566
.description ( map ( property .getDescriptions () ) )
563
567
.value ( Collections .singletonList ( decideOnMapping ( property , context ) ) )
@@ -573,7 +577,8 @@ public Environment visitSortedSet(
573
577
final SubmodelElementBuilder builder =
574
578
( property ) ->
575
579
new DefaultSubmodelElementList .Builder ()
576
- .idShort ( property .getName () )
580
+ .idShort ( ID_PREFIX + property .getName () )
581
+ .typeValueListElement ( AasSubmodelElements .DATA_ELEMENT ) // TODO check if more specific type info is reuired
577
582
.displayName ( map ( property .getPreferredNames () ) )
578
583
.description ( map ( property .getDescriptions () ) )
579
584
.value ( Collections .singletonList ( decideOnMapping ( property , context ) ) )
@@ -599,7 +604,8 @@ public Environment visitEither(
599
604
}
600
605
final SubmodelElementList aasSubModelElementCollection =
601
606
new DefaultSubmodelElementList .Builder ()
602
- .idShort ( either .getName () )
607
+ .idShort ( ID_PREFIX + either .getName () )
608
+ .typeValueListElement ( AasSubmodelElements .DATA_ELEMENT ) // TODO check if more specific type info is rqujried
603
609
.displayName ( map ( either .getPreferredNames () ) )
604
610
.description ( map ( either .getDescriptions () ) )
605
611
.value ( submodelElements )
0 commit comments