Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
Added documentation to properties and package.
  • Loading branch information
tbm0115 committed Mar 16, 2023
1 parent 8917b22 commit 2100cba
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 14 deletions.
3 changes: 2 additions & 1 deletion MtconnectTranspiler/MtconnectTranspiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>MTConnect Transpiler</Title>
<Version>0.0.3</Version>
<Version>0.0.4</Version>
<Authors>mtconnect, tbm0115</Authors>
<Company>MTConnect Institute; TAMS;</Company>
<Description>A library capable of parsing an XMI for the MTConnect Standard and passing it to an implemented transpiler.</Description>
Expand All @@ -18,6 +18,7 @@
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageIcon>icon.png</PackageIcon>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 11 additions & 1 deletion MtconnectTranspiler/Xmi/UML/UmlClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,32 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlClass : PackagedElement
{
/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT)]
public UmlComment[]? Comments { get; set; }

/// <summary>
/// Collection of properties applied to an entity
/// Represents the <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element(s).
/// </summary>
[XPath("./ownedAttribute[@xmi:type='uml:Property']")]
public UmlProperty[]? Properties { get; set; }

/// <summary>
/// Represents the <c>isAbstract</c> attribute in a <c>&lt;packagedElement xmi:type='uml:Class' /&gt;</c> element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.isAbstract, Namespace = "")]
public string _isAbstract { get; set; }
/// <inheritdoc cref="_isAbstract"/>
public bool IsAbstract => _isAbstract?.Equals("true", System.StringComparison.OrdinalIgnoreCase) == true;

[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_RULE)]
public UmlConstraint[]? Constraints { get; set; }

/// <summary>
/// Represents the <c>&lt;generalization xmi:type='uml:Generalization' /&gt;</c> element.
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.GENERALIZATION, Namespace = "")]
public UmlGeneralization? Generalization { get; set; }
}
Expand Down
5 changes: 4 additions & 1 deletion MtconnectTranspiler/Xmi/UML/UmlDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ namespace MtconnectTranspiler.Xmi.UML
public class UmlDataType : PackagedElement
{
/// <summary>
/// Description content in Cameo
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT)]
public UmlComment[]? Comments { get; set; }

/// <summary>
/// Represents the <c>&lt;generalization xmi:type='uml:Generalization' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.GENERALIZATION)]
public UmlGeneralization[]? Generalization { get; set; }
}
Expand Down
5 changes: 4 additions & 1 deletion MtconnectTranspiler/Xmi/UML/UmlEnumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ namespace MtconnectTranspiler.Xmi.UML
public class UmlEnumeration : PackagedElement
{
/// <summary>
/// Collection of enumeration values
/// Represents the <c>&lt;ownedLiteral xmi:type='uml:EnumerationLiteral' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_LITERAL)]
public UmlEnumerationLiteral[]? Items { get; set; }

/// <summary>
/// Represents the <c>&lt;generalization xmi:type='uml:Generalization' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.GENERALIZATION)]
public UmlGeneralization[]? Generalization { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlEnumerationLiteral.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.OWNED_LITERAL, Namespace = "")]
public class UmlEnumerationLiteral : OwnedLiteral
{
/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT, Namespace = "")]
public OwnedComment[]? Comments { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlGeneralization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.GENERALIZATION, Namespace = "")]
public class UmlGeneralization : Generalization
{
/// <summary>
/// Represents the <c>general</c> attribute in a <c>&lt;generalization xmi:type='uml:Generalization' /&gt;</c> element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.GENERAL)]
public string General { get; set; }
}
Expand Down
14 changes: 14 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlPackage : PackagedElement
{
/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT)]
public UmlComment[]? Comments { get; set; }

/// <summary>
/// Represents element(s):
/// <list type="bullet">
/// <item><c>&lt;packagedElement xmi:type='uml:Enumeration' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:DataType' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Class' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Stereotype' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Extension' /&gt;</c></item>
/// <item><c>&lt;packagedElement xmi:type='uml:Package' /&gt;</c></item>
/// </list>
/// </summary>
[XPath("./packagedElement[@xmi:type='uml:Enumeration']", typeof(UmlEnumeration)),
XPath("./packagedElement[@xmi:type='uml:DataType']", typeof(UmlDataType)),
XPath("./packagedElement[@xmi:type='uml:Class']", typeof(UmlClass)),
Expand Down
3 changes: 3 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlProfile : PackagedElement
{
/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XPath("./ownedComments[@xmi:type='uml:Comment']")]
public UmlComment[]? Comments { get; set; }

Expand Down
30 changes: 23 additions & 7 deletions MtconnectTranspiler/Xmi/UML/UmlProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,43 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.OWNED_ATTRIBUTE, Namespace = "")]
public class UmlProperty : OwnedAttribute
{
/// <summary>
/// Represents the <c>association</c> attribute in a <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.association, Namespace = "")]
public string _association { get; set; }
internal string _association { get; set; }
/// <inheritdoc cref="_association"/>
public string Association => _association;
// TODO: Lookup the uml:Association[@name] to determine the expected Property Name
// TODO: Figure out how to determine if the associated type is an array. Possibly just a reference to the lowerValue/upperValue elements

/// <summary>
/// Represents the <c>aggregation</c> attribute in a <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.aggregation, Namespace = "")]
public string _aggregation { get; set; }
internal string _aggregation { get; set; }
/// <inheritdoc cref="_aggregation"/>
public string Aggregation => _aggregation;

/// <summary>
/// Represents the <c>visibility</c> attribute in a <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.visibility, Namespace = "")]
public string _visibility { get; set; } = "public";
internal string _visibility { get; set; } = "public";
/// <inheritdoc cref="_visibility"/>
public string Visibility => _visibility;

[XmlAttribute(AttributeName = XmlHelper.XmiStructure.type, Namespace = "")]
public string _type { get; set; }
/// <summary>
/// Reference to the primitive type or the xmi:id of the complex type
/// Represents the <c>type</c> attribute in a <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element.
/// </summary>
public string PropertyType => _type;
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.type, Namespace = "")]
internal string _propertyType { get; set; }
/// <inheritdoc cref="_propertyType"/>
public string PropertyType => _propertyType;

/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT)]
public UmlComment[]? Comments { get; set; }
}
Expand Down
6 changes: 6 additions & 0 deletions MtconnectTranspiler/Xmi/UML/UmlStereotype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ namespace MtconnectTranspiler.Xmi.UML
[Serializable, XmlRoot(ElementName = XmlHelper.XmiStructure.PACKAGED_ELEMENT, Namespace = "")]
public class UmlStereotype : PackagedElement
{
/// <summary>
/// Represents the <c>&lt;ownedComment xmi:type='uml:Comment' /&gt;</c> element(s).
/// </summary>
[XmlElement(ElementName = XmlHelper.XmiStructure.OWNED_COMMENT, Namespace = "")]
public UmlComment[]? Comments { get; set; }

/// <summary>
/// Represents the <c>&lt;ownedAttribute xmi:type='uml:Property' /&gt;</c> element(s).
/// </summary>
[XPath("./*[@xmi:type='uml:Property']")]
public UmlProperty[]? Properties { get; set; }
}
Expand Down
6 changes: 3 additions & 3 deletions MtconnectTranspiler/Xmi/XmiElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ namespace MtconnectTranspiler.Xmi
public abstract class XmiElement : IXmiElement
{
/// <summary>
/// Unique ID within the XMI.
/// Represents the <c>xmi:id</c> attribute in an element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.id, Namespace = XmlHelper.XmiNamespace)]
public virtual string Id { get; set; }

/// <summary>
/// XMI name.
/// Represents the <c>name</c> attribute in an element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.name, Namespace = "")]
public virtual string Name { get; set; }

/// <summary>
/// XMI type.
/// Represents the <c>xmi:type</c> attribute in an element.
/// </summary>
[XmlAttribute(AttributeName = XmlHelper.XmiStructure.type, Namespace = XmlHelper.XmiNamespace)]
public virtual string Type { get; set; }
Expand Down

0 comments on commit 2100cba

Please sign in to comment.