Skip to content

Commit

Permalink
IHW: Correcties op validatie van MIM model
Browse files Browse the repository at this point in the history
Zie #255
Hier is beschreven dat het type van een "GEGEVENSGROEP" attribuut
beperkt is, en in ider geval geen  "REFERENTIELIJST" kan zijn.

Ook is een interface acceptabel als type.

Minor, uitbreiding van validatie en MIM format XML schema
  • Loading branch information
arjan authored and arjan committed Nov 21, 2024
1 parent 28647ea commit 9f632e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@
<xs:element name="gegevensgroeptype">
<xs:complexType>
<xs:sequence>
<xs:element ref="mim-ref:GegevensgroeptypeRef"/>
<xs:element ref="mim-ref:GegevensgroeptypeRef" minOccurs="0"/>
<xs:element ref="mim-ext:ConstructieRef" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
Binary file modified src/main/resources/input/IHW/props/IHW.xlsx
Binary file not shown.
11 changes: 9 additions & 2 deletions src/main/resources/xsl/Validator/Imvert2validation.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@
<xsl:next-match/>
</xsl:template>

<xsl:template match="imvert:attribute[../../imvert:stereotype/@id = ('stereotype-name-objecttype')]">
<xsl:template match="imvert:attribute[../../imvert:stereotype/@id = ('stereotype-name-objecttype','stereotype-name-composite')]" priority="1">
<!--setup-->
<xsl:variable name="class" select="../.."/>
<xsl:variable name="defining-class" select="if (imvert:type-id) then imf:get-construct-by-id(imvert:type-id) else ()"/>
Expand All @@ -894,6 +894,13 @@
imvert:stereotype/@id = 'stereotype-name-attributegroup' and not($defining-class/imvert:designation = 'class'),
'[1] type must be an UML class', imf:string-group(imf:get-config-stereotypes('stereotype-name-attributegroup'),' or '))"/>

<xsl:sequence select="imf:report-error(.,
imvert:stereotype/@id = 'stereotype-name-attributegroup' and not($defining-class/imvert:stereotype/@id = ('stereotype-name-attribute','stereotype-name-composite','stereotype-name-interface')),
'[1] type is not allowed here: [2]', (
imf:string-group(imf:get-config-stereotypes('stereotype-name-attributegroup'),' or '),
imf:get-config-stereotypes($defining-class/imvert:stereotype/@id)
))"/>

<!-- Is het attribuut goed gestereotypeerd? -->
<!--TODO alle relaties tussen construct van een bepaald stereotype valideren op basis van primary en context/parent info uit configuratiebestand. Dus als eerste aparte slag na canocalisatie. -->
<xsl:variable name="allowed-primary-stereotype-ids" select="$configuration-metamodel-file/stereotypes/stereo[construct = 'attribute' and context/parent-stereo = 'stereotype-name-objecttype' and @primary = 'yes']/@id" as="xs:string*"/>
Expand All @@ -904,7 +911,7 @@
<xsl:next-match/>
</xsl:template>

<xsl:template match="imvert:attribute[../../imvert:stereotype/@id = ('stereotype-name-composite','stereotype-name-complextype')]">
<xsl:template match="imvert:attribute[../../imvert:stereotype/@id = ('stereotype-name-composite','stereotype-name-complextype')]" priority="2">
<!--setup-->
<xsl:variable name="class" select="../.."/>
<xsl:variable name="defining-class" select="if (imvert:type-id) then imf:get-construct-by-id(imvert:type-id) else ()"/>
Expand Down

0 comments on commit 9f632e0

Please sign in to comment.