Skip to content

Add cardinality qualifier for optional properties in AAS model#950

Open
Yauhenikapl wants to merge 2 commits into
eclipse-esmf:mainfrom
bci-oss:435-add-qualifier-for-cardinality
Open

Add cardinality qualifier for optional properties in AAS model#950
Yauhenikapl wants to merge 2 commits into
eclipse-esmf:mainfrom
bci-oss:435-add-qualifier-for-cardinality

Conversation

@Yauhenikapl
Copy link
Copy Markdown
Contributor

Description

CLI SAMM2AASX Add qualifier for cardinality

Fixes #435

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Additional notes

@Yauhenikapl Yauhenikapl marked this pull request as ready for review June 4, 2026 10:51
@Yauhenikapl
Copy link
Copy Markdown
Contributor Author

Here results

Model:

@prefix : <urn:samm:org.eclipse.esmf.test:1.0.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix unit: <urn:samm:org.eclipse.esmf.samm:unit:2.2.0#> .

:AspectWithOptionalProperty a samm:Aspect ;
   samm:preferredName "Test Aspect"@en ;
   samm:description "This is a test description"@en ;
   samm:see <http://example.com/> ;
   samm:properties ( [
                        samm:property :testProperty ;
                        samm:optional "true"^^xsd:boolean ;
                     ] ) ;
   samm:operations ( ) .

:testProperty a samm:Property ;
   samm:preferredName "Test Property"@en ;
   samm:description "This is a test property."@en ;
   samm:see <http://example.com/> ;
   samm:see <http://example.com/me> ;
   samm:characteristic samm-c:Text .

Result in xml:

...
<aas:submodels>
    <aas:submodel>
      <aas:idShort>AspectWithOptionalProperty</aas:idShort>
      <aas:description>
        <aas:langStringTextType>
          <aas:language>en</aas:language>
          <aas:text>This is a test description</aas:text>
        </aas:langStringTextType>
      </aas:description>
      <aas:administration/>
      <aas:id>urn:samm:org.eclipse.esmf.test:1.0.0#AspectWithOptionalProperty/submodel</aas:id>
      <aas:kind>Template</aas:kind>
      <aas:semanticId>
        <aas:type>ExternalReference</aas:type>
        <aas:keys>
          <aas:key>
            <aas:type>GlobalReference</aas:type>
            <aas:value>urn:samm:org.eclipse.esmf.test:1.0.0#AspectWithOptionalProperty</aas:value>
          </aas:key>
        </aas:keys>
      </aas:semanticId>
      <aas:supplementalSemanticIds>
        <aas:reference>
          <aas:type>ExternalReference</aas:type>
          <aas:keys>
            <aas:key>
              <aas:type>GlobalReference</aas:type>
              <aas:value>http://example.com/</aas:value>
            </aas:key>
          </aas:keys>
        </aas:reference>
      </aas:supplementalSemanticIds>
      <aas:submodelElements>
        <aas:property>
          <aas:idShort>testProperty</aas:idShort>
          <aas:displayName>
            <aas:langStringNameType>
              <aas:language>en</aas:language>
              <aas:text>Test Property</aas:text>
            </aas:langStringNameType>
          </aas:displayName>
          <aas:semanticId>
            <aas:type>ExternalReference</aas:type>
            <aas:keys>
              <aas:key>
                <aas:type>GlobalReference</aas:type>
                <aas:value>urn:samm:org.eclipse.esmf.test:1.0.0#testProperty</aas:value>
              </aas:key>
            </aas:keys>
          </aas:semanticId>
          <aas:supplementalSemanticIds>
            <aas:reference>
              <aas:type>ExternalReference</aas:type>
              <aas:keys>
                <aas:key>
                  <aas:type>GlobalReference</aas:type>
                  <aas:value>http://example.com/</aas:value>
                </aas:key>
              </aas:keys>
            </aas:reference>
            <aas:reference>
              <aas:type>ExternalReference</aas:type>
              <aas:keys>
                <aas:key>
                  <aas:type>GlobalReference</aas:type>
                  <aas:value>http://example.com/me</aas:value>
                </aas:key>
              </aas:keys>
            </aas:reference>
          </aas:supplementalSemanticIds>
          <aas:qualifiers>
            <aas:qualifier>
              <aas:semanticId>
                <aas:type>ExternalReference</aas:type>
                <aas:keys>
                  <aas:key>
                    <aas:type>GlobalReference</aas:type>
                    <aas:value>https://admin-shell.io/SubmodelTemplates/Cardinality/1/0</aas:value>
                  </aas:key>
                </aas:keys>
              </aas:semanticId>
              <aas:kind>ConceptQualifier</aas:kind>
              <aas:type>SMT/Cardinality</aas:type>
              <aas:valueType>xs:string</aas:valueType>
              <aas:value>ZeroToOne</aas:value>
            </aas:qualifier>
          </aas:qualifiers>
          <aas:valueType>xs:string</aas:valueType>
        </aas:property>
      </aas:submodelElements>
    </aas:submodel>
  </aas:submodels>
  ...

Thanks,
Best Regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] CLI SAMM2AASX Add qualifier for cardinality

1 participant