Skip to content

Commit

Permalink
Merge pull request #83 from cimug-org/release-1.12.0
Browse files Browse the repository at this point in the history
Release 1.12.0
  • Loading branch information
admin-cimug authored Feb 22, 2024
2 parents 149fce7 + bcc3e6e commit b9e0b1e
Show file tree
Hide file tree
Showing 27 changed files with 1,913 additions and 265 deletions.
24 changes: 24 additions & 0 deletions CIMToolPlugin/builders/builders.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,29 @@
"style": "profile-doc-rtf",
"datetime": "2022-08-01T00:00:00Z",
"ext": "rtf"
},
"legacy-rdfs": {
"type": "TRANSFORM",
"style": "legacy-rdfs",
"datetime": "2024-01-29T00:00:00Z",
"ext": "legacy.rdfs"
},
"legacy-rdfs-augmented": {
"type": "TRANSFORM",
"style": "legacy-rdfs-augmented",
"datetime": "2024-01-29T00:00:00Z",
"ext": "legacy-augmented.rdfs"
},
"rdfs-augmented-cimcontextor": {
"type": "TRANSFORM",
"style": "rdfs-augmented-cimcontextor",
"datetime": "2024-01-29T00:00:00Z",
"ext": "augmented-cimcontextor.rdfs"
},
"rdfs-2020": {
"type": "TRANSFORM",
"style": "rdfs-2020",
"datetime": "2024-01-30T00:00:00Z",
"ext": "rdfs-2020.rdfs"
}
}
2 changes: 1 addition & 1 deletion CIMToolPlugin/builders/json-schema-draft-07-lite.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
<!-- SimpleType(s) only contain a dataType attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@dataType"/>"</item>
</xsl:when>
<xsl:when test="self::a:EnumeratedType|self::a:ComplexType|self::a:Root">
<xsl:when test="self::a:EnumeratedType|self::a:CompoundType|self::a:ComplexType|self::a:Root">
<!-- ComplexType(s) and Root(s) only contain a baseClass attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@baseClass"/>"</item>
</xsl:when>
Expand Down
2 changes: 1 addition & 1 deletion CIMToolPlugin/builders/json-schema-draft-07.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
<!-- SimpleType(s) only contain a dataType attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@dataType"/>"</item>
</xsl:when>
<xsl:when test="self::a:EnumeratedType|self::a:ComplexType|self::a:Root">
<xsl:when test="self::a:EnumeratedType|self::a:CompoundType|self::a:ComplexType|self::a:Root">
<!-- ComplexType(s) and Root(s) only contain a baseClass attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@baseClass"/>"</item>
</xsl:when>
Expand Down
2 changes: 1 addition & 1 deletion CIMToolPlugin/builders/json-schema-draft-2020-12-lite.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
<!-- SimpleType(s) only contain a dataType attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@dataType"/>"</item>
</xsl:when>
<xsl:when test="self::a:EnumeratedType|self::a:ComplexType|self::a:Root">
<xsl:when test="self::a:EnumeratedType|self::a:CompoundType|self::a:ComplexType|self::a:Root">
<!-- ComplexType(s) and Root(s) only contain a baseClass attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@baseClass"/>"</item>
</xsl:when>
Expand Down
2 changes: 1 addition & 1 deletion CIMToolPlugin/builders/json-schema-draft-2020-12.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
<!-- SimpleType(s) only contain a dataType attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@dataType"/>"</item>
</xsl:when>
<xsl:when test="self::a:EnumeratedType|self::a:ComplexType|self::a:Root">
<xsl:when test="self::a:EnumeratedType|self::a:CompoundType|self::a:ComplexType|self::a:Root">
<!-- ComplexType(s) and Root(s) only contain a baseClass attribute representing modelReference -->
<item>"modelReference": "<xsl:value-of select="@baseClass"/>"</item>
</xsl:when>
Expand Down
272 changes: 272 additions & 0 deletions CIMToolPlugin/builders/legacy-rdfs-augmented.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="a" version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cims="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:a="http://langdale.com.au/2005/Message#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:uml="http://langdale.com.au/2005/UML#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<xsl:output xmlns:xalan="http://xml.apache.org/xslt" method="xml" omit-xml-declaration="no" indent="yes" xalan:indent-amount="4" />
<xsl:param name="copyright" />
<xsl:param name="version"/>
<xsl:param name="baseURI"/>
<xsl:param name="ontologyURI"/>
<xsl:param name="envelope">Profile</xsl:param>
<!-- The following <xsl:text> element is our newline representation where needed. -->
<xsl:param name="newline"><xsl:text>
</xsl:text></xsl:param>

<xsl:template match="a:Catalog">
<xsl:value-of select="$newline"/>
<xsl:if test="$copyright and $copyright != ''">
<xsl:comment><xsl:value-of select="$newline"/><xsl:value-of select="$copyright" disable-output-escaping="yes"/><xsl:value-of select="$newline"/></xsl:comment>
</xsl:if>
<xsl:value-of select="$newline"/>
<rdf:RDF>
<xsl:attribute name="xml:base" select="$ontologyURI"/>
<xsl:variable name="rdf" as="node()*">
<xsl:apply-templates select=".//*"/>
</xsl:variable>
<xsl:perform-sort select="$rdf">
<xsl:sort select="@rdf:about"/>
</xsl:perform-sort>
</rdf:RDF>
</xsl:template>

<!-- ============================================================================================================ -->
<!-- START SECTION: (Packages, ComplexType, Root, EnumeratedType, SimpleType, Complex, & CompoundType(s) -->
<!-- templates) i.e. All "top level" element in the XML profile definition file... -->
<!-- ============================================================================================================ -->
<xsl:template match="a:Package">
<rdf:Description rdf:about="#{substring-after(@basePackage, '#')}">
<xsl:for-each select="a:ParentPackage">
<cims:belongsToCategory rdf:resource="#{substring-after(@basePackage, '#')}"/>
</xsl:for-each>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#ClassCategory"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
</rdf:Description>
</xsl:template>

<xsl:template match="a:Root|a:ComplexType|a:EnumeratedType">
<rdf:Description rdf:about="#{substring-after(@baseClass, '#')}">
<cims:belongsToCategory rdf:resource="#{substring-after(@packageURI, '#')}"/>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<!-- For top level classes (i.e. a:Root, a:ComplexType, a:EnumeratedType) we obtain the name
of the class for the rdfs:label using the @baseClass attribute. This is different than
what appears later in this XSLT for attributes and associations where the rdfs:label is
determined using the @name attribute -->
<rdfs:label><xsl:value-of select="substring-after(@baseClass, '#')"/></rdfs:label>
<xsl:if test="a:SuperType">
<!-- The name of the superclass is determined using the @baseClass attribute
(and not the a:SuperType/@name) -->
<rdfs:subClassOf rdf:resource="#{substring-after(a:SuperType/@baseClass, '#')}"/>
</xsl:if>
</rdf:Description>
</xsl:template>

<xsl:template match="a:SimpleType">
<rdf:Description rdf:about="#{substring-after(@dataType, '#')}">
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
</rdf:Description>
</xsl:template>
<!-- ============================================================================================================ -->
<!-- END SECTION: Package, Complex, ComplexType, Root, & CompoundType(s) TYPE DEFINITION templates -->
<!-- ============================================================================================================ -->


<!-- ============================================================================================================ -->
<!-- START SECTION: (Simple, Domain, Instance, Reference attribute & association templates) -->
<!-- ============================================================================================================ -->
<xsl:template match="a:Simple">
<rdf:Description rdf:about="#{substring-after(@baseProperty, '#')}">
<cims:dataType rdf:resource="{@dataType}"/>
<cims:multiplicity rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#M:{if (@minOccurs = @maxOccurs) then @minOccurs else concat(@minOccurs, '..', replace(@maxOccurs, 'unbounded', 'n'))}"/>
<!-- This conditional is a "safety check" in the event that a a:Stereotype of type #attribute doesn't already
exist. In that case we ensure we add it. This since all a:Domain elements are attributes. -->
<xsl:if test="not(a:Stereotype[contains(., '#attribute')])">
<cims:stereotype rdf:resource="http://langdale.com.au/2005/UML#attribute"/>
</xsl:if>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:domain rdf:resource="#{substring-before(substring-after(@baseProperty, '#'), '.')}"/>
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
</rdf:Description>
</xsl:template>

<xsl:template match="a:Domain">
<rdf:Description rdf:about="#{substring-after(@baseProperty, '#')}">
<cims:dataType rdf:resource="#{substring-after(@dataType, '#')}"/>
<cims:multiplicity rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#M:{if (@minOccurs = @maxOccurs) then @minOccurs else concat(@minOccurs, '..', replace(@maxOccurs, 'unbounded', 'n'))}"/>
<!-- This conditional is a "safety check" in the event that a a:Stereotype of type #attribute doesn't already
exist. In that case we ensure we add it. This since all a:Domain elements are attributes. -->
<xsl:if test="not(a:Stereotype[contains(., '#attribute')])">
<cims:stereotype rdf:resource="http://langdale.com.au/2005/UML#attribute"/>
</xsl:if>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:domain rdf:resource="#{substring-before(substring-after(@baseProperty, '#'), '.')}"/>
<!-- Note: this is intentionally using the @name attribute to source the label for a
domain attribute defined for the class. -->
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
</rdf:Description>
</xsl:template>

<!-- ======================================================================= -->
<!-- Elements of type a:Instance are always associations and not attributes. -->
<!-- ======================================================================= -->
<xsl:template match="a:Instance|a:InverseInstance">
<!-- Create the primary association -->
<rdf:Description rdf:about="#{substring-after(@baseProperty, '#')}">
<xsl:if test="@inverseBaseProperty">
<cims:inverseRoleName rdf:resource="#{substring-after(@inverseBaseProperty, '#')}"/>
</xsl:if>
<cims:multiplicity rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#M:{if (@minOccurs = @maxOccurs) then @minOccurs else concat(@minOccurs, '..', replace(@maxOccurs, 'unbounded', 'n'))}"/>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:domain rdf:resource="#{substring-before(substring-after(@baseProperty, '#'), '.')}"/>
<!-- Note: this is intentionally using the @name attribute to source the label for an
association or attribute within the class. -->
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
<rdfs:range rdf:resource="#{@type}"/>
</rdf:Description>
</xsl:template>

<xsl:template match="a:Reference|a:InverseReference">
<!-- Create the association -->
<rdf:Description rdf:about="#{substring-after(@baseProperty, '#')}">
<xsl:if test="@inverseBaseProperty">
<cims:inverseRoleName rdf:resource="#{substring-after(@inverseBaseProperty, '#')}"/>
</xsl:if>
<cims:multiplicity rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#M:{if (@minOccurs = @maxOccurs) then @minOccurs else concat(@minOccurs, '..', replace(@maxOccurs, 'unbounded', 'n'))}"/>
<!-- When an @inverseBaseProperty is missing it is a clear indicator that this is not actually an association but
rather is an attribute that the end user has not pulled in the type for in CIMTool while doing constructing
the profile. When that happens it appears as an a:Reference element and therefore the below conditional is
required.
-->
<xsl:if test="not(@inverseBaseProperty) and not(a:Stereotype[contains(., '#attribute')])">
<cims:stereotype rdf:resource="http://langdale.com.au/2005/UML#attribute"/>
</xsl:if>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:domain rdf:resource="#{substring-before(substring-after(@baseProperty, '#'), '.')}"/>
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
<rdfs:range rdf:resource="#{@type}"/>
</rdf:Description>
</xsl:template>

<xsl:template match="a:Enumerated">
<rdf:Description rdf:about="#{substring-after(@baseProperty, '#')}">
<cims:multiplicity rdf:resource="http://iec.ch/TC57/1999/rdf-schema-extensions-19990926#M:{if (@minOccurs = @maxOccurs) then @minOccurs else concat(@minOccurs, '..', replace(@maxOccurs, 'unbounded', 'n'))}"/>
<xsl:if test="not(a:Stereotype[contains(., '#attribute')])">
<cims:stereotype rdf:resource="http://langdale.com.au/2005/UML#attribute"/>
</xsl:if>
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:domain rdf:resource="#{substring-before(substring-after(@baseProperty, '#'), '.')}"/>
<!-- Note: this is intentionally using the @name attribute to source the label for an
enumerated attribute within a class. -->
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
<rdfs:range rdf:resource="#{@type}"/>
</rdf:Description>
</xsl:template>

<xsl:template match="a:EnumeratedValue">
<rdf:Description rdf:about="#{substring-after(@baseResource, '#')}">
<xsl:for-each select="a:Stereotype">
<xsl:sort select="." order="ascending" />
<xsl:variable name="stereotype" select="."/>
<cims:stereotype rdf:resource="{$stereotype}"/>
</xsl:for-each>
<rdf:type rdf:resource="#{substring-before(substring-after(@baseResource, '#'), '.')}"/>
<xsl:if test="a:Comment|a:Note"><rdfs:comment><xsl:apply-templates select="." mode="comments"/></rdfs:comment></xsl:if>
<rdfs:label><xsl:value-of select="@name"/></rdfs:label>
</rdf:Description>
</xsl:template>
<!-- ============================================================================================================ -->
<!-- END SECTION: (ComplexType, Root, and EnumeratedType attribute & association templates) -->
<!-- ============================================================================================================ -->

<!--
<xsl:template match="a:Complex">
<xs:element name="{@name}" minOccurs="{@minOccurs}" maxOccurs="{@maxOccurs}" sawsdl:modelReference="{@baseProperty}">
<xsl:call-template name="annotate"/>
<xs:complexType sawsdl:modelReference="{@baseClass}">
<xsl:call-template name="type_body"/>
</xs:complexType>
</xs:element>
</xsl:template>
<xsl:template match="a:Choice[a:Stereotype='http://langdale.com.au/2005/UML#preserve']">
<xs:element name="{@name}" minOccurs="{@minOccurs}" maxOccurs="{@maxOccurs}" sawsdl:modelReference="{@baseProperty}">
<xsl:call-template name="annotate"/>
<xs:complexType>
<xs:choice>
<xsl:apply-templates/>
</xs:choice>
</xs:complexType>
</xs:element>
</xsl:template>
<xsl:template match="a:SimpleEnumerated">
<xs:element name="{@name}" minOccurs="{@minOccurs}" maxOccurs="{@maxOccurs}" sawsdl:modelReference="{@baseProperty}">
<xsl:call-template name="annotate"/>
<xs:simpleType sawsdl:modelReference="{@baseClass}">
<xs:restriction base="xs:string">
<xsl:apply-templates/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xsl:template>
<xsl:template match="a:CompoundType" mode="declare">
<xs:complexType name="{@name}" sawsdl:modelReference="{@baseClass}">
<xsl:call-template name="annotate"/>
<xsl:call-template name="type_body"/>
</xs:complexType>
</xsl:template>
-->
<xsl:template match="." mode="comments">
<xsl:for-each select="a:Comment|a:Note">
<xsl:value-of select="."/><xsl:if test="position()!=last()"><xsl:value-of select="$newline"/></xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="text()">
<!-- dont pass text through -->
</xsl:template>
</xsl:stylesheet>
Loading

0 comments on commit b9e0b1e

Please sign in to comment.