Skip to content

[BUG] Error in AAS generation for Operations #998

Description

@mhmmi

How: List of performed steps

  • Create minimal Aspect with one Property and one Operation
  • Result: AspectWithOperation.ttl (attached)
  • Create AAS SMT from AspectWithOperation with samm-cli 2.15.0
    • Run (1) samm aspect .\com.example\1.0.0\AspectWithOperation.ttl to aas --format json
    • Run (2) samm aspect .\com.example\1.0.0\AspectWithOperation.ttl to aas --format xml
  • Validate generated JSON with aas-core3.0 (Python)

What: Actual result vs expected result

Actual result:

The semanticId of the generated Operation submodel element is emitted as a
ModelReference whose first (and only) key has type Operation:

{
  "idShort": "toggle",
  "modelType": "Operation",
  "semanticId": {
    "type": "ModelReference",
    "keys": [
      {
        "type": "Operation",
        "value": "urn:samm:com.example:1.0.0#toggle"
      }
    ]
  }
}

This violates two constraints of the AAS metamodel specification (IDTA-01001):

  • AASd-121: For References, the value of Key/type of the first key of
    Reference/keys shall be one of GloballyIdentifiablesOperation is not.
  • AASd-123: For model references, the value of Key/type of the first key of
    Reference/keys shall be one of AasIdentifiables (AssetAdministrationShell,
    ConceptDescription, Identifiable, Submodel) — Operation is not. A
    fragment key like Operation may only appear in subsequent keys of a model
    reference (AASd-125/126/127).

Verified with aas-core3.0 (Python):

.submodels[0].submodel_elements[1].semantic_id
  Constraint AASd-121: For References the value of type of the first key of keys shall be one of Globally Identifiables.
.submodels[0].submodel_elements[1].semantic_id
  Constraint AASd-123: For model references the value of type of the first key of keys shall be one of AAS identifiables.

The XML output (run 2) contains the equivalent invalid reference.

Note the inconsistency with Property submodel elements in the same output,
which are generated correctly as external references:

{
  "idShort": "status",
  "modelType": "Property",
  "semanticId": {
    "type": "ExternalReference",
    "keys": [
      {
        "type": "GlobalReference",
        "value": "urn:samm:com.example:1.0.0#status"
      }
    ]
  }
}

Expected result:

The Operation's semanticId should — like all other submodel elements generated
from SAMM model elements — be an ExternalReference with a single key of type
GlobalReference carrying the Aspect Model URN:

"semanticId": {
  "type": "ExternalReference",
  "keys": [
    {
      "type": "GlobalReference",
      "value": "urn:samm:com.example:1.0.0#toggle"
    }
  ]
}

Presumed cause:

AspectModelAasVisitor#buildReferenceToOperation hard-codes
KeyTypes.OPERATION together with ReferenceTypes.MODEL_REFERENCE:

final Key key = new DefaultKey.Builder()
      .type( KeyTypes.OPERATION )
      .value( DEFAULT_MAPPER.determineIdentifierFor( operation ) )
      .build();
return new DefaultReference.Builder().type( ReferenceTypes.MODEL_REFERENCE ).keys( key ).build();

Where: (e.g. component, version, url, your system info)

Input (files/screenshots)
AspectWithOperation.ttl.txt

Output (files/screenshots)
AspectWithOperation.json

Additional context (e.g. references)

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedHas been viewed by one of the maintainers and is ready for further work, discussion or other steps.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions