From a7d05a5e34dfe4ccdbe7ba8b7ef0152b4e49efc1 Mon Sep 17 00:00:00 2001 From: atheate Date: Thu, 7 May 2026 13:50:42 +0200 Subject: [PATCH] [Add] remarks into XML doc of extension method to capture defined constraints Co-Authored-By: Claude Opus 4 (1M context) --- .../Extensions/PropertyExtension.cs | 49 +++ .../HandleBarHelpers/PropertyHelper.cs | 147 +++++++++ .../Uml/core-poco-extend-uml-template.hbs | 10 +- .../Extend/NamespaceExtensionsTestFixture.cs | 2 + .../OwningMembershipExtensionsTestFixture.cs | 33 +- .../RelationshipExtensionsTestFixture.cs | 27 +- .../Extend/AcceptActionUsageExtensions.cs | 29 ++ .../Extend/ActionDefinitionExtensions.cs | 8 + SysML2.NET/Extend/ActionUsageExtensions.cs | 39 +++ .../Extend/ActorMembershipExtensions.cs | 1 + .../Extend/AllocationDefinitionExtensions.cs | 8 + .../Extend/AllocationUsageExtensions.cs | 1 + .../AnalysisCaseDefinitionExtensions.cs | 14 + .../Extend/AnalysisCaseUsageExtensions.cs | 13 + .../Extend/AnnotatingElementExtensions.cs | 25 ++ SysML2.NET/Extend/AnnotationExtensions.cs | 20 ++ .../Extend/AssertConstraintUsageExtensions.cs | 12 + .../Extend/AssignmentActionUsageExtensions.cs | 19 ++ SysML2.NET/Extend/AssociationExtensions.cs | 28 ++ SysML2.NET/Extend/AttributeUsageExtensions.cs | 1 + SysML2.NET/Extend/BehaviorExtensions.cs | 8 + .../Extend/BooleanExpressionExtensions.cs | 1 + .../Extend/CalculationDefinitionExtensions.cs | 2 + .../Extend/CalculationUsageExtensions.cs | 7 + SysML2.NET/Extend/CaseDefinitionExtensions.cs | 34 ++ SysML2.NET/Extend/CaseUsageExtensions.cs | 33 ++ SysML2.NET/Extend/ClassifierExtensions.cs | 9 + .../Extend/CollectExpressionExtensions.cs | 1 + SysML2.NET/Extend/ConcernUsageExtensions.cs | 1 + .../ConjugatedPortDefinitionExtensions.cs | 11 + .../Extend/ConjugatedPortTypingExtensions.cs | 6 + .../Extend/ConnectionDefinitionExtensions.cs | 2 + .../Extend/ConnectionUsageExtensions.cs | 1 + SysML2.NET/Extend/ConnectorExtensions.cs | 46 +++ .../Extend/ConstraintUsageExtensions.cs | 19 ++ .../Extend/ConstructorExpressionExtensions.cs | 7 + SysML2.NET/Extend/ControlNodeExtensions.cs | 15 + SysML2.NET/Extend/DefinitionExtensions.cs | 188 ++++++++++++ SysML2.NET/Extend/ElementExtensions.cs | 4 - .../Extend/EnumerationDefinitionExtensions.cs | 2 + .../Extend/EnumerationUsageExtensions.cs | 1 + .../Extend/EventOccurrenceUsageExtensions.cs | 12 + .../Extend/ExhibitStateUsageExtensions.cs | 2 + SysML2.NET/Extend/ExpressionExtensions.cs | 56 ++++ .../FeatureChainExpressionExtensions.cs | 26 ++ SysML2.NET/Extend/FeatureExtensions.cs | 2 +- .../FeatureReferenceExpressionExtensions.cs | 47 +++ SysML2.NET/Extend/FlowDefinitionExtensions.cs | 2 + SysML2.NET/Extend/FlowExtensions.cs | 49 +++ SysML2.NET/Extend/FlowUsageExtensions.cs | 2 + .../Extend/ForLoopActionUsageExtensions.cs | 19 ++ SysML2.NET/Extend/FunctionExtensions.cs | 15 + SysML2.NET/Extend/IfActionUsageExtensions.cs | 37 +++ .../Extend/IncludeUseCaseUsageExtensions.cs | 1 + .../Extend/IndexExpressionExtensions.cs | 1 + .../InstantiationExpressionExtensions.cs | 17 + .../Extend/InterfaceDefinitionExtensions.cs | 2 + SysML2.NET/Extend/InterfaceUsageExtensions.cs | 1 + SysML2.NET/Extend/InvariantExtensions.cs | 1 + .../Extend/InvocationExpressionExtensions.cs | 8 + SysML2.NET/Extend/ItemUsageExtensions.cs | 7 + SysML2.NET/Extend/LibraryPackageExtensions.cs | 7 + SysML2.NET/Extend/LiteralBooleanExtensions.cs | 1 + .../Extend/LiteralExpressionExtensions.cs | 13 + SysML2.NET/Extend/LiteralIntegerExtensions.cs | 1 + .../Extend/LiteralRationalExtensions.cs | 1 + SysML2.NET/Extend/LiteralStringExtensions.cs | 1 + .../Extend/LoopActionUsageExtensions.cs | 14 + .../Extend/MembershipImportExtensions.cs | 13 + .../MetadataAccessExpressionExtensions.cs | 16 + .../Extend/MetadataFeatureExtensions.cs | 50 +++ SysML2.NET/Extend/MetadataUsageExtensions.cs | 1 + .../Extend/MultiplicityRangeExtensions.cs | 65 ++++ SysML2.NET/Extend/NamespaceExtensions.cs | 218 +++++++++---- .../Extend/NamespaceImportExtensions.cs | 8 + SysML2.NET/Extend/NullExpressionExtensions.cs | 13 + .../Extend/OccurrenceDefinitionExtensions.cs | 2 + .../Extend/OccurrenceUsageExtensions.cs | 13 + .../Extend/OperatorExpressionExtensions.cs | 13 + .../Extend/OwningMembershipExtensions.cs | 12 + SysML2.NET/Extend/PackageExtensions.cs | 22 +- .../Extend/ParameterMembershipExtensions.cs | 6 + SysML2.NET/Extend/PartUsageExtensions.cs | 7 + .../Extend/PerformActionUsageExtensions.cs | 10 + SysML2.NET/Extend/PortDefinitionExtensions.cs | 13 + SysML2.NET/Extend/PortUsageExtensions.cs | 1 + SysML2.NET/Extend/ReferenceUsageExtensions.cs | 11 + SysML2.NET/Extend/RelationshipExtensions.cs | 4 +- .../Extend/RenderingDefinitionExtensions.cs | 8 + SysML2.NET/Extend/RenderingUsageExtensions.cs | 1 + ...quirementConstraintMembershipExtensions.cs | 13 + .../Extend/RequirementDefinitionExtensions.cs | 61 ++++ .../Extend/RequirementUsageExtensions.cs | 60 ++++ .../ReturnParameterMembershipExtensions.cs | 6 + .../SatisfyRequirementUsageExtensions.cs | 15 + .../Extend/SelectExpressionExtensions.cs | 1 + .../Extend/SendActionUsageExtensions.cs | 19 ++ .../Extend/StakeholderMembershipExtensions.cs | 1 + .../Extend/StateDefinitionExtensions.cs | 47 +++ SysML2.NET/Extend/StateUsageExtensions.cs | 52 ++++ SysML2.NET/Extend/StepExtensions.cs | 7 + .../Extend/SubjectMembershipExtensions.cs | 1 + .../Extend/TerminateActionUsageExtensions.cs | 7 + .../Extend/TransitionUsageExtensions.cs | 77 +++++ .../TriggerInvocationExpressionExtensions.cs | 15 + SysML2.NET/Extend/TypeExtensions.cs | 290 ++++++++++++++++++ SysML2.NET/Extend/UsageExtensions.cs | 225 ++++++++++++++ .../Extend/UseCaseDefinitionExtensions.cs | 10 + SysML2.NET/Extend/UseCaseUsageExtensions.cs | 9 + .../VerificationCaseDefinitionExtensions.cs | 14 + .../Extend/VerificationCaseUsageExtensions.cs | 13 + SysML2.NET/Extend/ViewDefinitionExtensions.cs | 35 +++ SysML2.NET/Extend/ViewUsageExtensions.cs | 49 +++ .../Extend/ViewpointDefinitionExtensions.cs | 10 + SysML2.NET/Extend/ViewpointUsageExtensions.cs | 9 + .../Extend/WhileLoopActionUsageExtensions.cs | 25 ++ 116 files changed, 2731 insertions(+), 76 deletions(-) diff --git a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs index 9c337c8f2..f91aeb062 100644 --- a/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs +++ b/SysML2.NET.CodeGenerator/Extensions/PropertyExtension.cs @@ -21,11 +21,14 @@ namespace SysML2.NET.CodeGenerator.Extensions { using System; + using System.Collections.Generic; using System.Linq; using uml4net.Classification; + using uml4net.CommonStructure; using uml4net.Extensions; using uml4net.SimpleClassifiers; + using uml4net.StructuredClassifiers; /// /// Extension class for the @@ -136,5 +139,51 @@ public static string QueryIfStatementContentForNonEmpty(this IProperty property, return "THIS WILL PRODUCE COMPILE ERROR"; } + + /// + /// Returns every from the owning class's OwnedRule that + /// applies to the given derived . The XMI shipped with this + /// project links derivation rules to the owning class (not the specific attribute) and uses + /// the naming convention derive{ClassName}{PropertyName}; both signals are honoured. + /// + /// The property to query. Must not be . + /// An enumerable of constraining s; empty when none apply. + public static IEnumerable QueryOwnedConstraints(this IProperty property) + { + ArgumentNullException.ThrowIfNull(property); + + if (property.Owner is not IClass owningClass) + { + return []; + } + + var explicitMatches = owningClass.OwnedRule + .Where(rule => rule.ConstrainedElement.Contains(property)) + .ToList(); + + if (explicitMatches.Count > 0) + { + return explicitMatches; + } + + var expectedDeriveName = "derive" + owningClass.Name + property.Name.CapitalizeFirstLetter(); + + return owningClass.OwnedRule + .Where(rule => string.Equals(rule.Name, expectedDeriveName, StringComparison.Ordinal)); + } + + /// + /// Returns every directly owned by the given + /// via its OwnedRule namespace facet. Used by the Extend code-generation template to + /// surface the operation's constraint(s) as XML <remarks> blocks. + /// + /// The operation to query. Must not be . + /// An enumerable of s; empty when none are declared. + public static IEnumerable QueryOwnedConstraints(this IOperation operation) + { + ArgumentNullException.ThrowIfNull(operation); + + return operation.OwnedRule; + } } } diff --git a/SysML2.NET.CodeGenerator/HandleBarHelpers/PropertyHelper.cs b/SysML2.NET.CodeGenerator/HandleBarHelpers/PropertyHelper.cs index f5e9af0c6..3c15054c7 100644 --- a/SysML2.NET.CodeGenerator/HandleBarHelpers/PropertyHelper.cs +++ b/SysML2.NET.CodeGenerator/HandleBarHelpers/PropertyHelper.cs @@ -21,6 +21,7 @@ namespace SysML2.NET.CodeGenerator.HandleBarHelpers { using System; + using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; @@ -36,6 +37,7 @@ namespace SysML2.NET.CodeGenerator.HandleBarHelpers using uml4net.Classification; using uml4net.CommonStructure; using uml4net.StructuredClassifiers; + using uml4net.Values; /// /// A handlebars block helper for the interface @@ -1120,6 +1122,151 @@ public static void RegisterPropertyHelper(this IHandlebars handlebars) return property.Type is IClassifier { IsAbstract: true }; }); + + handlebars.RegisterHelper("Property.QueryHasOwnedConstraints", (_, arguments) => + { + if (arguments.Length != 1 || arguments[0] is not IProperty property) + { + throw new HandlebarsException("{{Property.QueryHasOwnedConstraints}} expects a single IProperty argument"); + } + + return HasRenderableConstraint(property.QueryOwnedConstraints()); + }); + + handlebars.RegisterHelper("Operation.QueryHasOwnedConstraints", (_, arguments) => + { + if (arguments.Length != 1 || arguments[0] is not IOperation operation) + { + throw new HandlebarsException("{{Operation.QueryHasOwnedConstraints}} expects a single IOperation argument"); + } + + return HasRenderableConstraint(operation.QueryOwnedConstraints()); + }); + + handlebars.RegisterHelper("Property.WriteOwnedRulesAsRemarksBlock", (writer, _, arguments) => + { + if (arguments.Length != 1 || arguments[0] is not IProperty property) + { + throw new HandlebarsException("{{Property.WriteOwnedRulesAsRemarksBlock}} expects a single IProperty argument"); + } + + writer.WriteSafeString(BuildOwnedRulesRemarksBlock(property.QueryOwnedConstraints())); + }); + + handlebars.RegisterHelper("Operation.WriteOwnedRulesAsRemarksBlock", (writer, _, arguments) => + { + if (arguments.Length != 1 || arguments[0] is not IOperation operation) + { + throw new HandlebarsException("{{Operation.WriteOwnedRulesAsRemarksBlock}} expects a single IOperation argument"); + } + + writer.WriteSafeString(BuildOwnedRulesRemarksBlock(operation.QueryOwnedConstraints())); + }); + } + + /// + /// Builds a complete XML <remarks> block listing every constraint body carried by + /// the supplied sequence, labelled by language. Returns the empty + /// string when no constraint carries an body. + /// + /// The constraints to render. + /// + /// A multi-line string starting with /// <remarks> and ending with /// </remarks>, + /// each line prefixed for direct emission inside the Extend template; empty when nothing to emit. + /// + /// + /// Returns when at least one constraint in + /// carries an with at least one non-blank body line — i.e. when + /// would emit a non-empty <remarks> block. + /// + /// The constraints to evaluate. + /// Whether the helpers would produce any output for these constraints. + private static bool HasRenderableConstraint(IEnumerable constraints) + { + foreach (var constraint in constraints) + { + var opaqueExpression = constraint.Specification?.OfType().FirstOrDefault(); + + if (opaqueExpression?.Body != null && opaqueExpression.Body.Any(body => !string.IsNullOrWhiteSpace(body))) + { + return true; + } + } + + return false; + } + + private static string BuildOwnedRulesRemarksBlock(IEnumerable constraints) + { + var entries = new List<(string Language, string Body)>(); + + foreach (var constraint in constraints) + { + var opaqueExpression = constraint.Specification?.OfType().FirstOrDefault(); + + if (opaqueExpression == null || opaqueExpression.Body == null) + { + continue; + } + + var bodies = opaqueExpression.Body; + var languages = opaqueExpression.Language; + + for (var index = 0; index < bodies.Count; index++) + { + if (string.IsNullOrWhiteSpace(bodies[index])) + { + continue; + } + + var language = languages != null && index < languages.Count && !string.IsNullOrWhiteSpace(languages[index]) + ? languages[index].Trim() + : "Constraint"; + + entries.Add((language, bodies[index].Trim())); + } + } + + if (entries.Count == 0) + { + return string.Empty; + } + + var sb = new StringBuilder(); + sb.AppendLine("/// "); + + for (var index = 0; index < entries.Count; index++) + { + var (language, body) = entries[index]; + + sb.AppendLine($"/// {EscapeXml(language)}:"); + sb.AppendLine("/// "); + + foreach (var line in body.Replace("\r\n", "\n").Replace('\r', '\n').Split('\n')) + { + sb.AppendLine($"/// {EscapeXml(line.TrimEnd())}"); + } + + sb.AppendLine("/// "); + } + + sb.Append("/// "); + + return sb.ToString(); + } + + /// + /// Replaces XML-significant characters with their entity equivalents so the result is safe to + /// embed inside an XML doc comment. + /// + /// The string to escape. + /// The escaped string. + private static string EscapeXml(string value) + { + return value + .Replace("&", "&") + .Replace("<", "<") + .Replace(">", ">"); } /// diff --git a/SysML2.NET.CodeGenerator/Templates/Uml/core-poco-extend-uml-template.hbs b/SysML2.NET.CodeGenerator/Templates/Uml/core-poco-extend-uml-template.hbs index 92dd1252e..77a8b4495 100644 --- a/SysML2.NET.CodeGenerator/Templates/Uml/core-poco-extend-uml-template.hbs +++ b/SysML2.NET.CodeGenerator/Templates/Uml/core-poco-extend-uml-template.hbs @@ -23,7 +23,7 @@ namespace SysML2.NET.Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace thi using System; using System.Collections.Generic; - {{ #Class.WriteEnumerationNameSpaces this}} + {{ #Class.WriteEnumerationNameSpacesWithOperation this}} {{ #Class.WriteNameSpaces this POCO}} /// @@ -37,6 +37,9 @@ namespace SysML2.NET.Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace thi /// /// Computes the derived property. /// +{{#if (Property.QueryHasOwnedConstraints property)}} + {{Property.WriteOwnedRulesAsRemarksBlock property}} +{{/if}} /// /// The subject /// @@ -53,6 +56,9 @@ namespace SysML2.NET.Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace thi {{/each}} {{#each (this.OwnedOperation) as | operation | }} {{ #Documentation operation }} +{{#if (Operation.QueryHasOwnedConstraints operation)}} + {{Operation.WriteOwnedRulesAsRemarksBlock operation}} +{{/if}} /// /// The subject /// @@ -63,7 +69,7 @@ namespace SysML2.NET.Core.POCO.{{ #NamedElement.WriteFullyQualifiedNameSpace thi throw new NotSupportedException("Create a GitHub issue when this method is required"); } {{#unless @last}} - + {{/unless}} {{/each}} } diff --git a/SysML2.NET.Tests/Extend/NamespaceExtensionsTestFixture.cs b/SysML2.NET.Tests/Extend/NamespaceExtensionsTestFixture.cs index 6f683ae49..f3472a73a 100644 --- a/SysML2.NET.Tests/Extend/NamespaceExtensionsTestFixture.cs +++ b/SysML2.NET.Tests/Extend/NamespaceExtensionsTestFixture.cs @@ -217,6 +217,8 @@ public void VerifyComputeVisibleMembershipsOperation() [Test] public void VerifyComputeImportedMembershipsOperation() { + Assert.That(() => ((INamespace)null).ComputeImportedMembershipsOperation([]), Throws.TypeOf()); + var namespaceElement = new Namespace(); Assert.That(namespaceElement.ComputeImportedMembershipsOperation([]), Has.Count.EqualTo(0)); diff --git a/SysML2.NET.Tests/Extend/OwningMembershipExtensionsTestFixture.cs b/SysML2.NET.Tests/Extend/OwningMembershipExtensionsTestFixture.cs index ad9ab2260..ac6ec88d7 100644 --- a/SysML2.NET.Tests/Extend/OwningMembershipExtensionsTestFixture.cs +++ b/SysML2.NET.Tests/Extend/OwningMembershipExtensionsTestFixture.cs @@ -21,32 +21,53 @@ namespace SysML2.NET.Tests.Extend { using System; - + using NUnit.Framework; - + + using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; + using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; + using SysML2.NET.Exceptions; + using SysML2.NET.Extensions; [TestFixture] public class OwningMembershipExtensionsTestFixture { [Test] - public void ComputeOwnedMemberElement_ThrowsArgumentNullException() + public void VerifyComputeOwnedMemberElement() { Assert.That(() => ((IOwningMembership)null).ComputeOwnedMemberElement(), Throws.TypeOf()); + + // OwnedRelatedElement.Count == 0 → IncompleteModelException + var emptyMembership = new OwningMembership(); + Assert.That(() => emptyMembership.ComputeOwnedMemberElement(), Throws.TypeOf()); + + // OwnedRelatedElement.Count == 1 → returns that element + var container = new Namespace(); + var singleMembership = new OwningMembership(); + var ownedElement = new Definition { DeclaredName = "SingleElement" }; + container.AssignOwnership(singleMembership, ownedElement); + Assert.That(singleMembership.ComputeOwnedMemberElement(), Is.SameAs(ownedElement)); + + // OwnedRelatedElement.Count > 1 → IncompleteModelException + var multiMembership = new OwningMembership(); + ((IContainedRelationship)multiMembership).OwnedRelatedElement.Add(new Definition()); + ((IContainedRelationship)multiMembership).OwnedRelatedElement.Add(new Definition()); + Assert.That(() => multiMembership.ComputeOwnedMemberElement(), Throws.TypeOf()); } - + [Test] public void ComputeOwnedMemberElementId_ThrowsNotSupportedException() { Assert.That(() => ((IOwningMembership)null).ComputeOwnedMemberElementId(), Throws.TypeOf()); } - + [Test] public void ComputeOwnedMemberName_ThrowsArgumentNullException() { Assert.That(() => ((IOwningMembership)null).ComputeOwnedMemberName(), Throws.TypeOf()); } - + [Test] public void ComputeOwnedMemberShortName_ThrowsArgumentNullException() { diff --git a/SysML2.NET.Tests/Extend/RelationshipExtensionsTestFixture.cs b/SysML2.NET.Tests/Extend/RelationshipExtensionsTestFixture.cs index 591aaf8bd..a12248d37 100644 --- a/SysML2.NET.Tests/Extend/RelationshipExtensionsTestFixture.cs +++ b/SysML2.NET.Tests/Extend/RelationshipExtensionsTestFixture.cs @@ -21,11 +21,12 @@ namespace SysML2.NET.Tests.Extend { using System; + using System.Linq; using Moq; using NUnit.Framework; - + using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; @@ -34,10 +35,10 @@ namespace SysML2.NET.Tests.Extend public class RelationshipExtensionsTestFixture { [Test] - public void VerfiyComputeRelatedElement() + public void VerifyComputeRelatedElement() { Assert.That(() => ((IRelationship)null).ComputeRelatedElement(), Throws.TypeOf()); - + var relationship = new Mock(); relationship.Setup(x => x.Source).Returns([]); relationship.Setup(x => x.Target).Returns([]); @@ -46,17 +47,29 @@ public void VerfiyComputeRelatedElement() var sourceDefinition = new Definition(); relationship.Setup(x => x.Source).Returns([sourceDefinition]); - + Assert.That(relationship.Object.ComputeRelatedElement(), Is.EquivalentTo([sourceDefinition])); var targetDefinition = new Definition(); relationship.Setup(x => x.Target).Returns([targetDefinition]); - - Assert.That(relationship.Object.ComputeRelatedElement(), Is.EquivalentTo([sourceDefinition, targetDefinition])); + + Assert.That(relationship.Object.ComputeRelatedElement(), Is.EquivalentTo([sourceDefinition, targetDefinition])); + var secondSource = new Definition(); - relationship.Setup(x => x.Source).Returns([sourceDefinition, secondSource]); Assert.That(relationship.Object.ComputeRelatedElement(), Is.EquivalentTo([sourceDefinition, secondSource, targetDefinition])); + + // OCL union semantics on OrderedSet: an element shared between Source and Target must not be duplicated. + var sharedElement = new Definition(); + relationship.Setup(x => x.Source).Returns([sourceDefinition, sharedElement]); + relationship.Setup(x => x.Target).Returns([sharedElement]); + + var dedupedResult = relationship.Object.ComputeRelatedElement(); + + Assert.That(dedupedResult.Count(element => ReferenceEquals(element, sharedElement)), Is.EqualTo(1)); + Assert.That(dedupedResult, Has.Count.EqualTo(2)); + Assert.That(dedupedResult[0], Is.SameAs(sourceDefinition)); + Assert.That(dedupedResult[1], Is.SameAs(sharedElement)); } [Test] diff --git a/SysML2.NET/Extend/AcceptActionUsageExtensions.cs b/SysML2.NET/Extend/AcceptActionUsageExtensions.cs index f21c50315..d569c5549 100644 --- a/SysML2.NET/Extend/AcceptActionUsageExtensions.cs +++ b/SysML2.NET/Extend/AcceptActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,12 @@ internal static class AcceptActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// payloadArgument = argument(1) + /// + /// /// /// The subject /// @@ -80,6 +87,14 @@ internal static IExpression ComputePayloadArgument(this IAcceptActionUsage accep /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// payloadParameter = + /// if parameter->isEmpty() then null + /// else parameter->first() endif + /// + /// /// /// The subject /// @@ -95,6 +110,12 @@ internal static IReferenceUsage ComputePayloadParameter(this IAcceptActionUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// receiverArgument = argument(2) + /// + /// /// /// The subject /// @@ -110,6 +131,14 @@ internal static IExpression ComputeReceiverArgument(this IAcceptActionUsage acce /// /// Check if this AcceptActionUsage is the triggerAction of a TransitionUsage. /// + /// + /// OCL2.0: + /// + /// owningType <> null and + /// owningType.oclIsKindOf(TransitionUsage) and + /// owningType.oclAsType(TransitionUsage).triggerAction->includes(self) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ActionDefinitionExtensions.cs b/SysML2.NET/Extend/ActionDefinitionExtensions.cs index 3a917a366..41dde7716 100644 --- a/SysML2.NET/Extend/ActionDefinitionExtensions.cs +++ b/SysML2.NET/Extend/ActionDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -61,6 +63,12 @@ internal static class ActionDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// action = usage->selectByKind(ActionUsage) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ActionUsageExtensions.cs b/SysML2.NET/Extend/ActionUsageExtensions.cs index a16bca883..83f300beb 100644 --- a/SysML2.NET/Extend/ActionUsageExtensions.cs +++ b/SysML2.NET/Extend/ActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,12 @@ internal static List ComputeActionDefinition(this IActionUsage action /// /// Return the owned input parameters of this ActionUsage. /// + /// + /// OCL2.0: + /// + /// input->select(f | f.owner = self) + /// + /// /// /// The subject /// @@ -96,6 +103,14 @@ internal static List ComputeInputParametersOperation(this IActionUsage /// Return the i-th owned input parameter of the ActionUsage. Return null if the ActionUsage has less /// than i owned input parameters. /// + /// + /// OCL2.0: + /// + /// if inputParameters()->size() < i then null + /// else inputParameters()->at(i) + /// endif + /// + /// /// /// The subject /// @@ -116,6 +131,19 @@ internal static IFeature ComputeInputParameterOperation(this IActionUsage action /// FeatureValue of the i-th owned input parameter of the ActionUsage. Return null if the ActionUsage /// has less than i owned input parameters or the i-th owned input parameter has no FeatureValue. /// + /// + /// OCL2.0: + /// + /// if inputParameter(i) = null then null + /// else + /// let featureValue : Sequence(FeatureValue) = inputParameter(i). + /// ownedMembership->select(oclIsKindOf(FeatureValue)) in + /// if featureValue->isEmpty() then null + /// else featureValue->at(1).value + /// endif + /// endif + /// + /// /// /// The subject /// @@ -136,6 +164,17 @@ internal static IExpression ComputeArgumentOperation(this IActionUsage actionUsa /// ActionUsage but is not the entryAction or exitAction of a StateDefinition or StateUsage. If so, then /// it represents an Action that is a subaction of another Action. /// + /// + /// OCL2.0: + /// + /// isComposite and owningType <> null and + /// (owningType.oclIsKindOf(ActionDefinition) or + /// owningType.oclIsKindOf(ActionUsage)) and + /// (owningFeatureMembership.oclIsKindOf(StateSubactionMembership) implies + /// owningFeatureMembership.oclAsType(StateSubactionMembership).kind = + /// StateSubactionKind::do) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ActorMembershipExtensions.cs b/SysML2.NET/Extend/ActorMembershipExtensions.cs index f2cb25ed0..bb8c08185 100644 --- a/SysML2.NET/Extend/ActorMembershipExtensions.cs +++ b/SysML2.NET/Extend/ActorMembershipExtensions.cs @@ -23,6 +23,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/AllocationDefinitionExtensions.cs b/SysML2.NET/Extend/AllocationDefinitionExtensions.cs index d1fa2e9c5..1bc23168e 100644 --- a/SysML2.NET/Extend/AllocationDefinitionExtensions.cs +++ b/SysML2.NET/Extend/AllocationDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Allocations using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -61,6 +63,12 @@ internal static class AllocationDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// allocation = usage->selectAsKind(AllocationUsage) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AllocationUsageExtensions.cs b/SysML2.NET/Extend/AllocationUsageExtensions.cs index db8bf6e0f..3b4eda2fe 100644 --- a/SysML2.NET/Extend/AllocationUsageExtensions.cs +++ b/SysML2.NET/Extend/AllocationUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Allocations using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/AnalysisCaseDefinitionExtensions.cs b/SysML2.NET/Extend/AnalysisCaseDefinitionExtensions.cs index 7ac668fb8..3737df678 100644 --- a/SysML2.NET/Extend/AnalysisCaseDefinitionExtensions.cs +++ b/SysML2.NET/Extend/AnalysisCaseDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.AnalysisCases using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,18 @@ internal static class AnalysisCaseDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// resultExpression = + /// let results : OrderedSet(ResultExpressionMembership) = + /// featureMembersip-> + /// selectByKind(ResultExpressionMembership) in + /// if results->isEmpty() then null + /// else results->first().ownedResultExpression + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AnalysisCaseUsageExtensions.cs b/SysML2.NET/Extend/AnalysisCaseUsageExtensions.cs index a2d6398be..a55fe778e 100644 --- a/SysML2.NET/Extend/AnalysisCaseUsageExtensions.cs +++ b/SysML2.NET/Extend/AnalysisCaseUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.AnalysisCases using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,18 @@ internal static IAnalysisCaseDefinition ComputeAnalysisCaseDefinition(this IAnal /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// resultExpression = + /// let results : OrderedSet(ResultExpressionMembership) = + /// featureMembersip-> + /// selectByKind(ResultExpressionMembership) in + /// if results->isEmpty() then null + /// else results->first().ownedResultExpression + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AnnotatingElementExtensions.cs b/SysML2.NET/Extend/AnnotatingElementExtensions.cs index 35c20cec4..9e1f79a15 100644 --- a/SysML2.NET/Extend/AnnotatingElementExtensions.cs +++ b/SysML2.NET/Extend/AnnotatingElementExtensions.cs @@ -35,6 +35,14 @@ internal static class AnnotatingElementExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// annotatedElement = + /// if annotation->notEmpty() then annotation.annotatedElement + /// else Sequence{owningNamespace} endif + /// + /// /// /// The subject /// @@ -50,6 +58,15 @@ internal static List ComputeAnnotatedElement(this IAnnotatingElement a /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// annotation = + /// if owningAnnotatingRelationship = null then ownedAnnotatingRelationship + /// else owningAnnotatingRelationship->prepend(owningAnnotatingRelationship) + /// endif + /// + /// /// /// The subject /// @@ -65,6 +82,14 @@ internal static List ComputeAnnotation(this IAnnotatingElement anno /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAnnotatingRelationship = ownedRelationship-> + /// selectByKind(Annotation)-> + /// select(a | a.annotatedElement <> self) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AnnotationExtensions.cs b/SysML2.NET/Extend/AnnotationExtensions.cs index cb101a290..9d673a5b0 100644 --- a/SysML2.NET/Extend/AnnotationExtensions.cs +++ b/SysML2.NET/Extend/AnnotationExtensions.cs @@ -35,6 +35,15 @@ internal static class AnnotationExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// annotatingElement = + /// if ownedAnnotatingElement <> null then ownedAnnotatingElement + /// else owningAnnotatingElement + /// endif + /// + /// /// /// The subject /// @@ -50,6 +59,17 @@ internal static IAnnotatingElement ComputeAnnotatingElement(this IAnnotation ann /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAnnotatingElement = + /// let ownedAnnotatingElements : Sequence(AnnotatingElement) = + /// ownedRelatedElement->selectByKind(AnnotatingElement) in + /// if ownedAnnotatingElements->isEmpty() then null + /// else ownedAnnotatingElements->first() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AssertConstraintUsageExtensions.cs b/SysML2.NET/Extend/AssertConstraintUsageExtensions.cs index 32a80b140..773135ad8 100644 --- a/SysML2.NET/Extend/AssertConstraintUsageExtensions.cs +++ b/SysML2.NET/Extend/AssertConstraintUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Constraints using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,17 @@ internal static class AssertConstraintUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// assertedConstraint = + /// if referencedFeatureTarget() = null then self + /// else if referencedFeatureTarget().oclIsKindOf(ConstraintUsage) then + /// referencedFeatureTarget().oclAsType(ConstraintUsage) + /// else null + /// endif endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AssignmentActionUsageExtensions.cs b/SysML2.NET/Extend/AssignmentActionUsageExtensions.cs index 5a55e3e7a..d25d1ad7b 100644 --- a/SysML2.NET/Extend/AssignmentActionUsageExtensions.cs +++ b/SysML2.NET/Extend/AssignmentActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,18 @@ internal static class AssignmentActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// referent = + /// let unownedFeatures : Sequence(Feature) = ownedMembership-> + /// reject(oclIsKindOf(FeatureMembership)).memberElement-> + /// selectByKind(Feature) in + /// if unownedFeatures->isEmpty() then null + /// else unownedFeatures->first().oclAsType(Feature) + /// endif + /// + /// /// /// The subject /// @@ -95,6 +108,12 @@ internal static IExpression ComputeTargetArgument(this IAssignmentActionUsage as /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// valueExpression = argument(2) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AssociationExtensions.cs b/SysML2.NET/Extend/AssociationExtensions.cs index b3eb6d794..f9ec1b811 100644 --- a/SysML2.NET/Extend/AssociationExtensions.cs +++ b/SysML2.NET/Extend/AssociationExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Kernel.Associations using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -54,6 +56,12 @@ internal static List ComputeAssociationEnd(this IAssociation associati /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// relatedType = associationEnd.type + /// + /// /// /// The subject /// @@ -69,6 +77,14 @@ internal static List ComputeRelatedType(this IAssociation associationSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// sourceType = + /// if relatedType->isEmpty() then null + /// else relatedType->first() endif + /// + /// /// /// The subject /// @@ -84,6 +100,18 @@ internal static IType ComputeSourceType(this IAssociation associationSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// targetType = + /// if relatedType->size() < 2 then OrderedSet{} + /// else + /// relatedType-> + /// subSequence(2, relatedType->size())-> + /// asOrderedSet() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/AttributeUsageExtensions.cs b/SysML2.NET/Extend/AttributeUsageExtensions.cs index 74aaa2598..78dc8528d 100644 --- a/SysML2.NET/Extend/AttributeUsageExtensions.cs +++ b/SysML2.NET/Extend/AttributeUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Attributes using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/BehaviorExtensions.cs b/SysML2.NET/Extend/BehaviorExtensions.cs index 00fdfe333..3a9f2531e 100644 --- a/SysML2.NET/Extend/BehaviorExtensions.cs +++ b/SysML2.NET/Extend/BehaviorExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Kernel.Behaviors using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -55,6 +57,12 @@ internal static List ComputeParameter(this IBehavior behaviorSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// step = feature->selectByKind(Step) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/BooleanExpressionExtensions.cs b/SysML2.NET/Extend/BooleanExpressionExtensions.cs index 0f5e0eb77..16dc8862a 100644 --- a/SysML2.NET/Extend/BooleanExpressionExtensions.cs +++ b/SysML2.NET/Extend/BooleanExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Functions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/CalculationDefinitionExtensions.cs b/SysML2.NET/Extend/CalculationDefinitionExtensions.cs index 4a8e88417..6fb62ca21 100644 --- a/SysML2.NET/Extend/CalculationDefinitionExtensions.cs +++ b/SysML2.NET/Extend/CalculationDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Calculations using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/CalculationUsageExtensions.cs b/SysML2.NET/Extend/CalculationUsageExtensions.cs index 2d4395894..ce00b59b8 100644 --- a/SysML2.NET/Extend/CalculationUsageExtensions.cs +++ b/SysML2.NET/Extend/CalculationUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Calculations using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,12 @@ internal static IFunction ComputeCalculationDefinition(this ICalculationUsage ca /// /// A CalculationUsage is not model-level evaluable. /// + /// + /// OCL2.0: + /// + /// false + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/CaseDefinitionExtensions.cs b/SysML2.NET/Extend/CaseDefinitionExtensions.cs index 86c6c7ef5..930253674 100644 --- a/SysML2.NET/Extend/CaseDefinitionExtensions.cs +++ b/SysML2.NET/Extend/CaseDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Cases using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,14 @@ internal static class CaseDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// actorParameter = featureMembership-> + /// selectByKind(ActorMembership). + /// ownedActorParameter + /// + /// /// /// The subject /// @@ -77,6 +87,19 @@ internal static List ComputeActorParameter(this ICaseDefinition case /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// objectiveRequirement = + /// let objectives: OrderedSet(RequirementUsage) = + /// featureMembership-> + /// selectByKind(ObjectiveMembership). + /// ownedRequirement in + /// if objectives->isEmpty() then null + /// else objectives->first().ownedObjectiveRequirement + /// endif + /// + /// /// /// The subject /// @@ -92,6 +115,17 @@ internal static IRequirementUsage ComputeObjectiveRequirement(this ICaseDefiniti /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// subjectParameter = + /// let subjectMems : OrderedSet(SubjectMembership) = + /// featureMembership->selectByKind(SubjectMembership) in + /// if subjectMems->isEmpty() then null + /// else subjectMems->first().ownedSubjectParameter + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/CaseUsageExtensions.cs b/SysML2.NET/Extend/CaseUsageExtensions.cs index 767f05f26..793d26f86 100644 --- a/SysML2.NET/Extend/CaseUsageExtensions.cs +++ b/SysML2.NET/Extend/CaseUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Cases using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,14 @@ internal static class CaseUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// actorParameter = featureMembership-> + /// selectByKind(ActorMembership). + /// ownedActorParameter + /// + /// /// /// The subject /// @@ -95,6 +104,19 @@ internal static ICaseDefinition ComputeCaseDefinition(this ICaseUsage caseUsageS /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// objectiveRequirement = + /// let objectives: OrderedSet(RequirementUsage) = + /// featureMembership-> + /// selectByKind(ObjectiveMembership). + /// ownedRequirement in + /// if objectives->isEmpty() then null + /// else objectives->first().ownedObjectiveRequirement + /// endif + /// + /// /// /// The subject /// @@ -110,6 +132,17 @@ internal static IRequirementUsage ComputeObjectiveRequirement(this ICaseUsage ca /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// subjectParameter = + /// let subjects : OrderedSet(SubjectMembership) = + /// featureMembership->selectByKind(SubjectMembership) in + /// if subjects->isEmpty() then null + /// else subjects->first().ownedSubjectParameter + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ClassifierExtensions.cs b/SysML2.NET/Extend/ClassifierExtensions.cs index 54033130a..cef3bc35f 100644 --- a/SysML2.NET/Extend/ClassifierExtensions.cs +++ b/SysML2.NET/Extend/ClassifierExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Core.Classifiers using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Root.Annotations; @@ -38,6 +40,13 @@ internal static class ClassifierExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedSubclassification = + /// ownedSpecialization->selectByKind(Subclassification) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/CollectExpressionExtensions.cs b/SysML2.NET/Extend/CollectExpressionExtensions.cs index 164b83a74..4a915934a 100644 --- a/SysML2.NET/Extend/CollectExpressionExtensions.cs +++ b/SysML2.NET/Extend/CollectExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/ConcernUsageExtensions.cs b/SysML2.NET/Extend/ConcernUsageExtensions.cs index a9baaa1c3..605d3977f 100644 --- a/SysML2.NET/Extend/ConcernUsageExtensions.cs +++ b/SysML2.NET/Extend/ConcernUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/ConjugatedPortDefinitionExtensions.cs b/SysML2.NET/Extend/ConjugatedPortDefinitionExtensions.cs index 4b0c95ed8..880e3014b 100644 --- a/SysML2.NET/Extend/ConjugatedPortDefinitionExtensions.cs +++ b/SysML2.NET/Extend/ConjugatedPortDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Ports using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -91,6 +93,15 @@ internal static IPortConjugation ComputeOwnedPortConjugator(this IConjugatedPort /// If the name of the originalPortDefinition is non-empty, then return that with the character ~ /// prepended. /// + /// + /// OCL2.0: + /// + /// let originalName : String = originalPortDefinition.name in + /// if originalName = null then null + /// else '~' + originalName + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ConjugatedPortTypingExtensions.cs b/SysML2.NET/Extend/ConjugatedPortTypingExtensions.cs index 28bb182ec..807119a3a 100644 --- a/SysML2.NET/Extend/ConjugatedPortTypingExtensions.cs +++ b/SysML2.NET/Extend/ConjugatedPortTypingExtensions.cs @@ -38,6 +38,12 @@ internal static class ConjugatedPortTypingExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// portDefinition = conjugatedPortDefinition.originalPortDefinition + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ConnectionDefinitionExtensions.cs b/SysML2.NET/Extend/ConnectionDefinitionExtensions.cs index ce8b2f88e..9f10035f0 100644 --- a/SysML2.NET/Extend/ConnectionDefinitionExtensions.cs +++ b/SysML2.NET/Extend/ConnectionDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Connections using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/ConnectionUsageExtensions.cs b/SysML2.NET/Extend/ConnectionUsageExtensions.cs index 74a398ba0..d53866540 100644 --- a/SysML2.NET/Extend/ConnectionUsageExtensions.cs +++ b/SysML2.NET/Extend/ConnectionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Connections using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/ConnectorExtensions.cs b/SysML2.NET/Extend/ConnectorExtensions.cs index 31fb05651..a84872d21 100644 --- a/SysML2.NET/Extend/ConnectorExtensions.cs +++ b/SysML2.NET/Extend/ConnectorExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Connectors using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Associations; @@ -70,6 +71,23 @@ internal static List ComputeConnectorEnd(this IConnector connectorSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// let commonFeaturingTypes : OrderedSet(Type) = + /// relatedFeature->closure(featuringType)->select(t | + /// relatedFeature->forAll(f | f.isFeaturedWithin(t)) + /// ) in + /// let nearestCommonFeaturingTypes : OrderedSet(Type) = + /// commonFeaturingTypes->reject(t1 | + /// commonFeaturingTypes->exists(t2 | + /// t2 <> t1 and t2->closure(featuringType)->contains(t1) + /// )) in + /// if nearestCommonFeaturingTypes->isEmpty() then null + /// else nearestCommonFeaturingTypes->first() + /// endif + /// + /// /// /// The subject /// @@ -85,6 +103,13 @@ internal static IType ComputeDefaultFeaturingType(this IConnector connectorSubje /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// relatedFeature = connectorEnd.ownedReferenceSubsetting-> + /// select(s | s <> null).subsettedFeature + /// + /// /// /// The subject /// @@ -100,6 +125,15 @@ internal static List ComputeRelatedFeature(this IConnector connectorSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// sourceFeature = + /// if relatedFeature->isEmpty() then null + /// else relatedFeature->first() + /// endif + /// + /// /// /// The subject /// @@ -115,6 +149,18 @@ internal static IFeature ComputeSourceFeature(this IConnector connectorSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// targetFeature = + /// if relatedFeature->size() < 2 then OrderedSet{} + /// else + /// relatedFeature-> + /// subSequence(2, relatedFeature->size())-> + /// asOrderedSet() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ConstraintUsageExtensions.cs b/SysML2.NET/Extend/ConstraintUsageExtensions.cs index b9101a0ff..3971d3e9e 100644 --- a/SysML2.NET/Extend/ConstraintUsageExtensions.cs +++ b/SysML2.NET/Extend/ConstraintUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Constraints using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -82,6 +83,18 @@ internal static IPredicate ComputeConstraintDefinition(this IConstraintUsage con /// an ownedReferenceSubsetting is the featureTarget of the referencedFeature of that /// ownedReferenceSubsetting. /// + /// + /// OCL2.0: + /// + /// if owningFeatureMembership <> null and + /// owningFeatureMembership.oclIsKindOf(RequirementConstraintMembership) and + /// ownedReferenceSubsetting <> null then + /// ownedReferenceSubsetting.referencedFeature.featureTarget + /// else + /// self.oclAsType(OccurrenceUsage).namingFeature() + /// endif + /// + /// /// /// The subject /// @@ -97,6 +110,12 @@ internal static IFeature ComputeRedefinedNamingFeatureOperation(this IConstraint /// /// A ConstraintUsage is not model-level evaluable. /// + /// + /// OCL2.0: + /// + /// false + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ConstructorExpressionExtensions.cs b/SysML2.NET/Extend/ConstructorExpressionExtensions.cs index ff60407dc..2fd066ba8 100644 --- a/SysML2.NET/Extend/ConstructorExpressionExtensions.cs +++ b/SysML2.NET/Extend/ConstructorExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -42,6 +43,12 @@ internal static class ConstructorExpressionExtensions /// A ConstructorExpression is model-level evaluable if all its argument Expressions are model-level /// evaluable. /// + /// + /// OCL2.0: + /// + /// argument->forAll(modelLevelEvaluable(visited)) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ControlNodeExtensions.cs b/SysML2.NET/Extend/ControlNodeExtensions.cs index e8e503ae6..910f14f3c 100644 --- a/SysML2.NET/Extend/ControlNodeExtensions.cs +++ b/SysML2.NET/Extend/ControlNodeExtensions.cs @@ -24,12 +24,14 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; @@ -65,6 +67,19 @@ internal static class ControlNodeExtensions /// Check that the given Multiplicity has lowerBound and upperBound expressions that are model-level /// evaluable to the given lower and upper values. /// + /// + /// OCL2.0: + /// + /// mult <> null and + /// if mult.oclIsKindOf(MultiplicityRange) then + /// mult.oclAsType(MultiplicityRange).hasBounds(lower, upper) + /// else + /// mult.allSuperTypes()->exists( + /// oclisKindOf(MultiplicityRange) and + /// oclAsType(MultiplicityRange).hasBounds(lower, upper) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/DefinitionExtensions.cs b/SysML2.NET/Extend/DefinitionExtensions.cs index dd3913daa..06b933bf9 100644 --- a/SysML2.NET/Extend/DefinitionExtensions.cs +++ b/SysML2.NET/Extend/DefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.DefinitionAndUsage using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -60,6 +62,12 @@ internal static class DefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// directedUsage = directedFeature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -75,6 +83,12 @@ internal static List ComputeDirectedUsage(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAction = ownedUsage->selectByKind(ActionUsage) + /// + /// /// /// The subject /// @@ -90,6 +104,12 @@ internal static List ComputeOwnedAction(this IDefinition definitio /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAllocation = ownedUsage->selectByKind(AllocationUsage) + /// + /// /// /// The subject /// @@ -105,6 +125,12 @@ internal static List ComputeOwnedAllocation(this IDefinition d /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAnalysisCase = ownedUsage->selectByKind(AnalysisCaseUsage) + /// + /// /// /// The subject /// @@ -120,6 +146,12 @@ internal static List ComputeOwnedAnalysisCase(this IDefiniti /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedAttribute = ownedUsage->selectByKind(AttributeUsage) + /// + /// /// /// The subject /// @@ -135,6 +167,12 @@ internal static List ComputeOwnedAttribute(this IDefinition def /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedCalculation = ownedUsage->selectByKind(CalculationUsage) + /// + /// /// /// The subject /// @@ -150,6 +188,12 @@ internal static List ComputeOwnedCalculation(this IDefinition /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedCase = ownedUsage->selectByKind(CaseUsage) + /// + /// /// /// The subject /// @@ -165,6 +209,12 @@ internal static List ComputeOwnedCase(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedConcern = ownedUsage->selectByKind(ConcernUsage) + /// + /// /// /// The subject /// @@ -180,6 +230,12 @@ internal static List ComputeOwnedConcern(this IDefinition definit /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedConnection = ownedUsage->selectByKind(ConnectorAsUsage) + /// + /// /// /// The subject /// @@ -195,6 +251,12 @@ internal static List ComputeOwnedConnection(this IDefinition /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedConstraint = ownedUsage->selectByKind(ConstraintUsage) + /// + /// /// /// The subject /// @@ -210,6 +272,12 @@ internal static List ComputeOwnedConstraint(this IDefinition d /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedEnumeration = ownedUsage->selectByKind(EnumerationUsage) + /// + /// /// /// The subject /// @@ -225,6 +293,12 @@ internal static List ComputeOwnedEnumeration(this IDefinition /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedFlow = ownedUsage->selectByKind(FlowConnectionUsage) + /// + /// /// /// The subject /// @@ -240,6 +314,12 @@ internal static List ComputeOwnedFlow(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedInterface = ownedUsage->selectByKind(ReferenceUsage) + /// + /// /// /// The subject /// @@ -255,6 +335,12 @@ internal static List ComputeOwnedInterface(this IDefinition def /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedItem = ownedUsage->selectByKind(ItemUsage) + /// + /// /// /// The subject /// @@ -270,6 +356,12 @@ internal static List ComputeOwnedItem(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedMetadata = ownedUsage->selectByKind(MetadataUsage) + /// + /// /// /// The subject /// @@ -285,6 +377,12 @@ internal static List ComputeOwnedMetadata(this IDefinition defin /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedOccurrence = ownedUsage->selectByKind(OccurrenceUsage) + /// + /// /// /// The subject /// @@ -300,6 +398,12 @@ internal static List ComputeOwnedOccurrence(this IDefinition d /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedPart = ownedUsage->selectByKind(PartUsage) + /// + /// /// /// The subject /// @@ -315,6 +419,12 @@ internal static List ComputeOwnedPart(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedPort = ownedUsage->selectByKind(PortUsage) + /// + /// /// /// The subject /// @@ -330,6 +440,12 @@ internal static List ComputeOwnedPort(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedReference = ownedUsage->selectByKind(ReferenceUsage) + /// + /// /// /// The subject /// @@ -345,6 +461,12 @@ internal static List ComputeOwnedReference(this IDefinition def /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedRendering = ownedUsage->selectByKind(RenderingUsage) + /// + /// /// /// The subject /// @@ -360,6 +482,12 @@ internal static List ComputeOwnedRendering(this IDefinition def /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedRequirement = ownedUsage->selectByKind(RequirementUsage) + /// + /// /// /// The subject /// @@ -375,6 +503,12 @@ internal static List ComputeOwnedRequirement(this IDefinition /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedState = ownedUsage->selectByKind(StateUsage) + /// + /// /// /// The subject /// @@ -390,6 +524,12 @@ internal static List ComputeOwnedState(this IDefinition definitionS /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedTransition = ownedUsage->selectByKind(TransitionUsage) + /// + /// /// /// The subject /// @@ -405,6 +545,12 @@ internal static List ComputeOwnedTransition(this IDefinition d /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedUsage = ownedFeature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -420,6 +566,12 @@ internal static List ComputeOwnedUsage(this IDefinition definitionSubjec /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedUseCase = ownedUsage->selectByKind(UseCaseUsage) + /// + /// /// /// The subject /// @@ -435,6 +587,12 @@ internal static List ComputeOwnedUseCase(this IDefinition definit /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedVerificationCase = ownedUsage->selectByKind(VerificationCaseUsage) + /// + /// /// /// The subject /// @@ -450,6 +608,12 @@ internal static List ComputeOwnedVerificationCase(this I /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedView = ownedUsage->selectByKind(ViewUsage) + /// + /// /// /// The subject /// @@ -465,6 +629,12 @@ internal static List ComputeOwnedView(this IDefinition definitionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedViewpoint = ownedUsage->selectByKind(ViewpointUsage) + /// + /// /// /// The subject /// @@ -480,6 +650,12 @@ internal static List ComputeOwnedViewpoint(this IDefinition def /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// usage = feature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -495,6 +671,12 @@ internal static List ComputeUsage(this IDefinition definitionSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// variant = variantMembership.ownedVariantUsage + /// + /// /// /// The subject /// @@ -510,6 +692,12 @@ internal static List ComputeVariant(this IDefinition definitionSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// variantMembership = ownedMembership->selectByKind(VariantMembership) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ElementExtensions.cs b/SysML2.NET/Extend/ElementExtensions.cs index 2bef7c8d3..3c748c4bc 100644 --- a/SysML2.NET/Extend/ElementExtensions.cs +++ b/SysML2.NET/Extend/ElementExtensions.cs @@ -344,10 +344,6 @@ internal static bool ValidateIsImpliedIncluded(this IElement elementSubject) /// otherwise, represented as a restricted name according to the lexical structure of the KerML textual /// notation (i.e., surrounded by single quote characters and with special characters escaped). /// - /// - /// No explicit OCL derivation rule in XMI. Derived from UML association semantics: - /// Return name, if that is not null, otherwise the shortName, if that is not null, otherwise null. If the returned value is non-null, it is returned as-is if it has the form of a basic name, or, otherwise, represented as a restricted name according to the lexical structure of the KerML textual notation (i.e., surrounded by single quote characters and with special characters escaped). - /// /// /// The subject /// diff --git a/SysML2.NET/Extend/EnumerationDefinitionExtensions.cs b/SysML2.NET/Extend/EnumerationDefinitionExtensions.cs index f88dd6517..3c81632d4 100644 --- a/SysML2.NET/Extend/EnumerationDefinitionExtensions.cs +++ b/SysML2.NET/Extend/EnumerationDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Enumerations using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/EnumerationUsageExtensions.cs b/SysML2.NET/Extend/EnumerationUsageExtensions.cs index ace7d3ec7..a441f4458 100644 --- a/SysML2.NET/Extend/EnumerationUsageExtensions.cs +++ b/SysML2.NET/Extend/EnumerationUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Enumerations using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/EventOccurrenceUsageExtensions.cs b/SysML2.NET/Extend/EventOccurrenceUsageExtensions.cs index 53e168b97..99b21fb99 100644 --- a/SysML2.NET/Extend/EventOccurrenceUsageExtensions.cs +++ b/SysML2.NET/Extend/EventOccurrenceUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Occurrences using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -63,6 +64,17 @@ internal static class EventOccurrenceUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// eventOccurrence = + /// if referencedFeatureTarget() = null then self + /// else if referencedFeatureTarget().oclIsKindOf(OccurrenceUsage) then + /// referencedFeatureTarget().oclAsType(OccurrenceUsage) + /// else null + /// endif endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ExhibitStateUsageExtensions.cs b/SysML2.NET/Extend/ExhibitStateUsageExtensions.cs index 5ba01ff2f..933041245 100644 --- a/SysML2.NET/Extend/ExhibitStateUsageExtensions.cs +++ b/SysML2.NET/Extend/ExhibitStateUsageExtensions.cs @@ -24,12 +24,14 @@ namespace SysML2.NET.Core.POCO.Systems.States using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; diff --git a/SysML2.NET/Extend/ExpressionExtensions.cs b/SysML2.NET/Extend/ExpressionExtensions.cs index f03ed0ad5..0acc31d11 100644 --- a/SysML2.NET/Extend/ExpressionExtensions.cs +++ b/SysML2.NET/Extend/ExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Functions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -55,6 +56,12 @@ internal static IFunction ComputeFunction(this IExpression expressionSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// isModelLevelEvaluable = modelLevelEvaluable(Set(Element){}) + /// + /// /// /// The subject /// @@ -70,6 +77,19 @@ internal static bool ComputeIsModelLevelEvaluable(this IExpression expressionSub /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// result = + /// let resultParams : Sequence(Feature) = + /// featureMemberships-> + /// selectByKind(ReturnParameterMembership). + /// ownedMemberParameter in + /// if resultParams->notEmpty() then resultParams->first() + /// else null + /// endif + /// + /// /// /// The subject /// @@ -92,6 +112,17 @@ internal static IFeature ComputeResult(this IExpression expressionSubject) /// ResultExpressionMembership. The parameters must not have any ownedFeatures or a FeatureValue, and /// the result Expression must be model-level evaluable. /// + /// + /// OCL2.0: + /// + /// ownedSpecialization->forAll(isImplied) and + /// ownedFeature->forAll(f | + /// (directionOf(f) = FeatureDirectionKind::_'in' or f = result) and + /// f.ownedFeature->isEmpty() and f.valuation = null or + /// f.owningFeatureMembership.oclIsKindOf(ResultExpressionMembership) and + /// f.oclAsType(Expression).modelLevelEvaluable(visited) + /// + /// /// /// The subject /// @@ -113,6 +144,22 @@ internal static bool ComputeModelLevelEvaluableOperation(this IExpression expres /// which, for a fully evaluable Expression, will be a LiteralExpression or a Feature that is not an /// Expression. /// + /// + /// OCL2.0: + /// + /// isModelLevelEvaluable + /// + /// OCL2.0: + /// + /// let resultExprs : Sequence(Expression) = + /// ownedFeatureMembership-> + /// selectByKind(ResultExpressionMembership). + /// ownedResultExpression in + /// if resultExpr->isEmpty() then Sequence{} + /// else resultExprs->first().evaluate(target) + /// endif + /// + /// /// /// The subject /// @@ -132,6 +179,15 @@ internal static List ComputeEvaluateOperation(this IExpression express /// Model-level evaluate this Expression with the given target. If the result is a LiteralBoolean, /// return its value. Otherwise return false. /// + /// + /// OCL2.0: + /// + /// let results: Sequence(Element) = evaluate(target) in + /// result->size() = 1 and + /// results->first().oclIsKindOf(LiteralBoolean) and + /// results->first().oclAsType(LiteralBoolean).value + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/FeatureChainExpressionExtensions.cs b/SysML2.NET/Extend/FeatureChainExpressionExtensions.cs index 40ba6e6d6..c83ccf2f8 100644 --- a/SysML2.NET/Extend/FeatureChainExpressionExtensions.cs +++ b/SysML2.NET/Extend/FeatureChainExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -41,6 +42,19 @@ internal static class FeatureChainExpressionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// targetFeature = + /// let nonParameterMemberships : Sequence(Membership) = ownedMembership-> + /// reject(oclIsKindOf(ParameterMembership)) in + /// if nonParameterMemberships->isEmpty() or + /// not nonParameterMemberships->first().memberElement.oclIsKindOf(Feature) + /// then null + /// else nonParameterMemberships->first().memberElement.oclAsType(Feature) + /// endif + /// + /// /// /// The subject /// @@ -57,6 +71,18 @@ internal static IFeature ComputeTargetFeature(this IFeatureChainExpression featu /// Return the first ownedFeature of the first owned input parameter of this FeatureChainExpression (if /// any). /// + /// + /// OCL2.0: + /// + /// let inputParameters : Feature = ownedFeatures-> + /// select(direction = _'in') in + /// if inputParameters->isEmpty() or + /// inputParameters->first().ownedFeature->isEmpty() + /// then null + /// else inputParameters->first().ownedFeature->first() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/FeatureExtensions.cs b/SysML2.NET/Extend/FeatureExtensions.cs index 29f32f3c5..c69cc13ed 100644 --- a/SysML2.NET/Extend/FeatureExtensions.cs +++ b/SysML2.NET/Extend/FeatureExtensions.cs @@ -1231,7 +1231,7 @@ internal static bool ComputeIsFeaturedWithinOperation(this IFeature featureSubje var anythingMembership = featureSubject.ResolveGlobal("Base::Anything"); var anythingElement = anythingMembership?.MemberElement; - return featureSubject.featuringType.Count == 0 || featureSubject.featuringType.All(f => f == anythingElement); + return featureSubject.featuringType.All(f => f == anythingElement); } if (featureSubject.featuringType.All(f => type.IsCompatibleWith(f))) diff --git a/SysML2.NET/Extend/FeatureReferenceExpressionExtensions.cs b/SysML2.NET/Extend/FeatureReferenceExpressionExtensions.cs index 043183131..16b4a8eb3 100644 --- a/SysML2.NET/Extend/FeatureReferenceExpressionExtensions.cs +++ b/SysML2.NET/Extend/FeatureReferenceExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -41,6 +42,19 @@ internal static class FeatureReferenceExpressionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// referent = + /// let nonParameterMemberships : Sequence(Membership) = ownedMembership-> + /// reject(oclIsKindOf(ParameterMembership)) in + /// if nonParameterMemberships->isEmpty() or + /// not nonParameterMemberships->first().memberElement.oclIsKindOf(Feature) + /// then null + /// else nonParameterMemberships->first().memberElement.oclAsType(Feature) + /// endif + /// + /// /// /// The subject /// @@ -61,6 +75,21 @@ internal static IFeature ComputeReferent(this IFeatureReferenceExpression featur ///
  • has no featuringTypes and, if it has a FeatureValue, the value Expression is model-level /// evaluable.
  • /// + /// + /// OCL2.0: + /// + /// referent.conformsTo('Anything::self') or + /// visited->excludes(referent) and + /// (referent.oclIsKindOf(Expression) and + /// referent.oclAsType(Expression).modelLevelEvaluable(visited->including(referent)) or + /// referent.owningType <> null and + /// (referent.owningType.isOclKindOf(MetaClass) or + /// referent.owningType.isOclKindOf(MetadataFeature)) or + /// referent.featuringType->isEmpty() and + /// (referent.valuation = null or + /// referent.valuation.modelLevelEvaluable(visited->including(referent)))) + /// + /// /// /// The subject /// @@ -87,6 +116,24 @@ internal static bool ComputeRedefinedModelLevelEvaluableOperation(this IFeatureR ///
  • Else, if the referent is not an Expression, return the referent.
  • ///
  • Else return the empty sequence.
  • /// + /// + /// OCL2.0: + /// + /// if not target.oclIsKindOf(Type) then Sequence{} + /// else + /// let feature: Sequence(Feature) = + /// target.oclAsType(Type).feature->select(f | + /// f.ownedRedefinition.redefinedFeature-> + /// includes(referent)) in + /// if feature->notEmpty() then + /// feature.valuation.value.evaluate(target) + /// else if referent.featuringType->isEmpty() + /// then referent + /// else Sequence{} + /// endif endif + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/FlowDefinitionExtensions.cs b/SysML2.NET/Extend/FlowDefinitionExtensions.cs index d7c5d20b7..cbdcb5cec 100644 --- a/SysML2.NET/Extend/FlowDefinitionExtensions.cs +++ b/SysML2.NET/Extend/FlowDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Flows using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/FlowExtensions.cs b/SysML2.NET/Extend/FlowExtensions.cs index 604dd9bbb..539566fbc 100644 --- a/SysML2.NET/Extend/FlowExtensions.cs +++ b/SysML2.NET/Extend/FlowExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Interactions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -43,6 +44,12 @@ internal static class FlowExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// flowEnd = connectorEnd->selectByKind(FlowEnd) + /// + /// /// /// The subject /// @@ -73,6 +80,17 @@ internal static List ComputeInteraction(this IFlow flowSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// payloadFeature = + /// let payloadFeatures : Sequence(PayloadFeature) = + /// ownedFeature->selectByKind(PayloadFeature) in + /// if payloadFeatures->isEmpty() then null + /// else payloadFeatures->first() + /// endif + /// + /// /// /// The subject /// @@ -88,6 +106,15 @@ internal static IPayloadFeature ComputePayloadFeature(this IFlow flowSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// payloadType = + /// if payloadFeature = null then Sequence{} + /// else payloadFeature.type + /// endif + /// + /// /// /// The subject /// @@ -103,6 +130,17 @@ internal static List ComputePayloadType(this IFlow flowSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// sourceOutputFeature = + /// if connectorEnd->isEmpty() or + /// connectorEnd.ownedFeature->isEmpty() + /// then null + /// else connectorEnd.ownedFeature->first() + /// endif + /// + /// /// /// The subject /// @@ -118,6 +156,17 @@ internal static IFeature ComputeSourceOutputFeature(this IFlow flowSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// targetInputFeature = + /// if connectorEnd->size() < 2 or + /// connectorEnd->at(2).ownedFeature->isEmpty() + /// then null + /// else connectorEnd->at(2).ownedFeature->first() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/FlowUsageExtensions.cs b/SysML2.NET/Extend/FlowUsageExtensions.cs index cee915b97..7dd91ac6d 100644 --- a/SysML2.NET/Extend/FlowUsageExtensions.cs +++ b/SysML2.NET/Extend/FlowUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Flows using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -32,6 +33,7 @@ namespace SysML2.NET.Core.POCO.Systems.Flows using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; using SysML2.NET.Core.POCO.Kernel.Connectors; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Kernel.Interactions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; diff --git a/SysML2.NET/Extend/ForLoopActionUsageExtensions.cs b/SysML2.NET/Extend/ForLoopActionUsageExtensions.cs index 13e212e9d..f3d418fa5 100644 --- a/SysML2.NET/Extend/ForLoopActionUsageExtensions.cs +++ b/SysML2.NET/Extend/ForLoopActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,18 @@ internal static class ForLoopActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// loopVariable = + /// if ownedFeature->isEmpty() or + /// not ownedFeature->first().oclIsKindOf(ReferenceUsage) then + /// null + /// else + /// ownedFeature->first().oclAsType(ReferenceUsage) + /// endif + /// + /// /// /// The subject /// @@ -80,6 +93,12 @@ internal static IReferenceUsage ComputeLoopVariable(this IForLoopActionUsage for /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// seqArgument = argument(1) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/FunctionExtensions.cs b/SysML2.NET/Extend/FunctionExtensions.cs index 508dfa098..fbfc150cb 100644 --- a/SysML2.NET/Extend/FunctionExtensions.cs +++ b/SysML2.NET/Extend/FunctionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Kernel.Functions using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -70,6 +72,19 @@ internal static bool ComputeIsModelLevelEvaluable(this IFunction functionSubject /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// result = + /// let resultParams : Sequence(Feature) = + /// featureMemberships-> + /// selectByKind(ReturnParameterMembership). + /// ownedMemberParameter in + /// if resultParams->notEmpty() then resultParams->first() + /// else null + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/IfActionUsageExtensions.cs b/SysML2.NET/Extend/IfActionUsageExtensions.cs index fc731d51c..bdfc90cd1 100644 --- a/SysML2.NET/Extend/IfActionUsageExtensions.cs +++ b/SysML2.NET/Extend/IfActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,18 @@ internal static class IfActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// elseAction = + /// let parameter : Feature = inputParameter(3) in + /// if parameter <> null and parameter.oclIsKindOf(ActionUsage) then + /// parameter.oclAsType(ActionUsage) + /// else + /// null + /// endif + /// + /// /// /// The subject /// @@ -80,6 +93,18 @@ internal static IActionUsage ComputeElseAction(this IIfActionUsage ifActionUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ifArgument = + /// let parameter : Feature = inputParameter(1) in + /// if parameter <> null and parameter.oclIsKindOf(Expression) then + /// parameter.oclAsType(Expression) + /// else + /// null + /// endif + /// + /// /// /// The subject /// @@ -95,6 +120,18 @@ internal static IExpression ComputeIfArgument(this IIfActionUsage ifActionUsageS /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// thenAction = + /// let parameter : Feature = inputParameter(2) in + /// if parameter <> null and parameter.oclIsKindOf(ActionUsage) then + /// parameter.oclAsType(ActionUsage) + /// else + /// null + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/IncludeUseCaseUsageExtensions.cs b/SysML2.NET/Extend/IncludeUseCaseUsageExtensions.cs index 750ceec42..5397ae281 100644 --- a/SysML2.NET/Extend/IncludeUseCaseUsageExtensions.cs +++ b/SysML2.NET/Extend/IncludeUseCaseUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.UseCases using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/IndexExpressionExtensions.cs b/SysML2.NET/Extend/IndexExpressionExtensions.cs index 678985fc6..9ea232011 100644 --- a/SysML2.NET/Extend/IndexExpressionExtensions.cs +++ b/SysML2.NET/Extend/IndexExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/InstantiationExpressionExtensions.cs b/SysML2.NET/Extend/InstantiationExpressionExtensions.cs index d8f9d12bd..85d779d5c 100644 --- a/SysML2.NET/Extend/InstantiationExpressionExtensions.cs +++ b/SysML2.NET/Extend/InstantiationExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -56,6 +57,12 @@ internal static List ComputeArgument(this IInstantiationExpression /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// instantiatedType = instantiatedType() + /// + /// /// /// The subject /// @@ -74,6 +81,16 @@ internal static IType ComputeInstantiatedType(this IInstantiationExpression inst /// Type. Note. This operation is overridden in the subclass /// OperatorExpression. /// + /// + /// OCL2.0: + /// + /// let members : Sequence(Element) = ownedMembership-> + /// reject(oclIsKindOf(FeatureMembership)).memberElement in + /// if members->isEmpty() or not members->first().oclIsKindOf(Type) then null + /// else typeMembers->first().oclAsType(Type) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/InterfaceDefinitionExtensions.cs b/SysML2.NET/Extend/InterfaceDefinitionExtensions.cs index 0a1b9311c..e3bbc880e 100644 --- a/SysML2.NET/Extend/InterfaceDefinitionExtensions.cs +++ b/SysML2.NET/Extend/InterfaceDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Interfaces using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/InterfaceUsageExtensions.cs b/SysML2.NET/Extend/InterfaceUsageExtensions.cs index 8bd4cf901..588ca374c 100644 --- a/SysML2.NET/Extend/InterfaceUsageExtensions.cs +++ b/SysML2.NET/Extend/InterfaceUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Interfaces using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/InvariantExtensions.cs b/SysML2.NET/Extend/InvariantExtensions.cs index c4c38fce4..4d9f5abeb 100644 --- a/SysML2.NET/Extend/InvariantExtensions.cs +++ b/SysML2.NET/Extend/InvariantExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Functions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/InvocationExpressionExtensions.cs b/SysML2.NET/Extend/InvocationExpressionExtensions.cs index 34518595d..b004aad52 100644 --- a/SysML2.NET/Extend/InvocationExpressionExtensions.cs +++ b/SysML2.NET/Extend/InvocationExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -42,6 +43,13 @@ internal static class InvocationExpressionExtensions /// An InvocationExpression is model-level evaluable if all its argument Expressions are model-level /// evaluable and its function is model-level evaluable. /// + /// + /// OCL2.0: + /// + /// argument->forAll(modelLevelEvaluable(visited)) and + /// function.isModelLevelEvaluable + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ItemUsageExtensions.cs b/SysML2.NET/Extend/ItemUsageExtensions.cs index 096c45d69..90bed2b7a 100644 --- a/SysML2.NET/Extend/ItemUsageExtensions.cs +++ b/SysML2.NET/Extend/ItemUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Items using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -64,6 +65,12 @@ internal static class ItemUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// itemDefinition = occurrenceDefinition->selectByKind(Structure) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/LibraryPackageExtensions.cs b/SysML2.NET/Extend/LibraryPackageExtensions.cs index f4262b97e..b8c6323fd 100644 --- a/SysML2.NET/Extend/LibraryPackageExtensions.cs +++ b/SysML2.NET/Extend/LibraryPackageExtensions.cs @@ -23,6 +23,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Packages using System; using System.Collections.Generic; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; @@ -37,6 +38,12 @@ internal static class LibraryPackageExtensions /// /// The libraryNamespace for a LibraryPackage is itself. /// + /// + /// OCL2.0: + /// + /// self + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/LiteralBooleanExtensions.cs b/SysML2.NET/Extend/LiteralBooleanExtensions.cs index 5eec3c048..665f9a24d 100644 --- a/SysML2.NET/Extend/LiteralBooleanExtensions.cs +++ b/SysML2.NET/Extend/LiteralBooleanExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/LiteralExpressionExtensions.cs b/SysML2.NET/Extend/LiteralExpressionExtensions.cs index 28115a833..d39249133 100644 --- a/SysML2.NET/Extend/LiteralExpressionExtensions.cs +++ b/SysML2.NET/Extend/LiteralExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -41,6 +42,12 @@ internal static class LiteralExpressionExtensions /// /// A LiteralExpression is always model-level evaluable. /// + /// + /// OCL2.0: + /// + /// true + /// + /// /// /// The subject /// @@ -59,6 +66,12 @@ internal static bool ComputeRedefinedModelLevelEvaluableOperation(this ILiteralE /// /// The model-level value of a LiteralExpression is itself. /// + /// + /// OCL2.0: + /// + /// Sequence{self} + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/LiteralIntegerExtensions.cs b/SysML2.NET/Extend/LiteralIntegerExtensions.cs index 453f5e2ba..8eabd0ce5 100644 --- a/SysML2.NET/Extend/LiteralIntegerExtensions.cs +++ b/SysML2.NET/Extend/LiteralIntegerExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/LiteralRationalExtensions.cs b/SysML2.NET/Extend/LiteralRationalExtensions.cs index 92c7140bd..cabf2bc06 100644 --- a/SysML2.NET/Extend/LiteralRationalExtensions.cs +++ b/SysML2.NET/Extend/LiteralRationalExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/LiteralStringExtensions.cs b/SysML2.NET/Extend/LiteralStringExtensions.cs index 2dedcbc32..9c6d8b3c9 100644 --- a/SysML2.NET/Extend/LiteralStringExtensions.cs +++ b/SysML2.NET/Extend/LiteralStringExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/LoopActionUsageExtensions.cs b/SysML2.NET/Extend/LoopActionUsageExtensions.cs index 6971d237c..729fd9926 100644 --- a/SysML2.NET/Extend/LoopActionUsageExtensions.cs +++ b/SysML2.NET/Extend/LoopActionUsageExtensions.cs @@ -24,12 +24,14 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; @@ -64,6 +66,18 @@ internal static class LoopActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// bodyAction = + /// let parameter : Feature = inputParameter(2) in + /// if parameter <> null and parameter.oclIsKindOf(Action) then + /// parameter.oclAsType(Action) + /// else + /// null + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/MembershipImportExtensions.cs b/SysML2.NET/Extend/MembershipImportExtensions.cs index a9eee6ad9..f4a9a52ae 100644 --- a/SysML2.NET/Extend/MembershipImportExtensions.cs +++ b/SysML2.NET/Extend/MembershipImportExtensions.cs @@ -38,6 +38,19 @@ internal static class MembershipImportExtensions /// importedMembership is a Namespace, then Memberships are also recursively imported from that /// Namespace. /// + /// + /// OCL2.0: + /// + /// if not isRecursive or + /// not importedElement.oclIsKindOf(Namespace) or + /// excluded->includes(importedElement) + /// then Sequence{importedMembership} + /// else importedElement.oclAsType(Namespace). + /// visibleMemberships(excluded, true, importAll)-> + /// prepend(importedMembership) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/MetadataAccessExpressionExtensions.cs b/SysML2.NET/Extend/MetadataAccessExpressionExtensions.cs index 4cdb09283..2c6600f04 100644 --- a/SysML2.NET/Extend/MetadataAccessExpressionExtensions.cs +++ b/SysML2.NET/Extend/MetadataAccessExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -57,6 +58,12 @@ internal static IElement ComputeReferencedElement(this IMetadataAccessExpression /// /// A MetadataAccessExpression is always model-level evaluable. /// + /// + /// OCL2.0: + /// + /// true + /// + /// /// /// The subject /// @@ -79,6 +86,15 @@ internal static bool ComputeRedefinedModelLevelEvaluableOperation(this IMetadata /// referencedElement and whose ownedFeatures are bound to the values of the MOF properties of the /// referencedElement. /// + /// + /// OCL2.0: + /// + /// referencedElement.ownedElement-> + /// select(oclIsKindOf(MetadataFeature) + /// and annotatedElement->includes(referencedElement))-> + /// including(metaclassFeature()) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/MetadataFeatureExtensions.cs b/SysML2.NET/Extend/MetadataFeatureExtensions.cs index 90da21628..cc84d248d 100644 --- a/SysML2.NET/Extend/MetadataFeatureExtensions.cs +++ b/SysML2.NET/Extend/MetadataFeatureExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Metadata using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Root.Annotations; @@ -39,6 +40,16 @@ internal static class MetadataFeatureExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// metaclass = + /// let metaclassTypes : Sequence(Type) = type->selectByKind(Metaclass) in + /// if metaclassTypes->isEmpty() then null + /// else metaClassTypes->first() + /// endif + /// + /// /// /// The subject /// @@ -56,6 +67,23 @@ internal static IMetaclass ComputeMetaclass(this IMetadataFeature metadataFeatur /// redefined by a feature, then return the result of evaluating the appropriate (model-level evaluable) /// value Expression for it (if any), with the MetadataFeature as the target. /// + /// + /// OCL2.0: + /// + /// let selectedFeatures : Sequence(Feature) = feature-> + /// select(closure(ownedRedefinition.redefinedFeature)-> + /// includes(baseFeature)) in + /// if selectedFeatures->isEmpty() then null + /// else + /// let selectedFeature : Feature = selectedFeatures->first() in + /// let featureValues : FeatureValue = selectedFeature-> + /// closure(ownedRedefinition.redefinedFeature).ownedMember-> + /// selectAsKind(FeatureValue) in + /// if featureValues->isEmpty() then null + /// else featureValues->first().value.evaluate(self) + /// endif + /// + /// /// /// The subject /// @@ -74,6 +102,12 @@ internal static List ComputeEvaluateFeatureOperation(this IMetadataFea /// /// Check if this MetadataFeature has a metaclass which is a kind of SemanticMetadata. /// + /// + /// OCL2.0: + /// + /// specializesFromLibrary('Metaobjects::SemanticMetadata') + /// + /// /// /// The subject /// @@ -90,6 +124,12 @@ internal static bool ComputeIsSemanticOperation(this IMetadataFeature metadataFe /// Check if this MetadataFeature has a metaclass that is a kind of KerML::Element (that is, it is from /// the reflective abstract syntax model). /// + /// + /// OCL2.0: + /// + /// specializesFromLibrary('KerML::Element') + /// + /// /// /// The subject /// @@ -106,6 +146,16 @@ internal static bool ComputeIsSyntacticOperation(this IMetadataFeature metadataF /// If this MetadataFeature reflectively represents a model element, then return the corresponding /// Element instance from the MOF abstract syntax representation of the model. /// + /// + /// English: + /// + /// No OCL + /// + /// OCL2.0: + /// + /// isSyntactic() + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/MetadataUsageExtensions.cs b/SysML2.NET/Extend/MetadataUsageExtensions.cs index 72d8198df..2137f842f 100644 --- a/SysML2.NET/Extend/MetadataUsageExtensions.cs +++ b/SysML2.NET/Extend/MetadataUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Metadata using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/MultiplicityRangeExtensions.cs b/SysML2.NET/Extend/MultiplicityRangeExtensions.cs index 93c932108..a525e357b 100644 --- a/SysML2.NET/Extend/MultiplicityRangeExtensions.cs +++ b/SysML2.NET/Extend/MultiplicityRangeExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Multiplicities using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Functions; @@ -40,6 +41,16 @@ internal static class MultiplicityRangeExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// bound = + /// if upperBound = null then Sequence{} + /// else if lowerBound = null then Sequence{upperBound} + /// else Sequence{lowerBound, upperBound} + /// endif endif + /// + /// /// /// The subject /// @@ -55,6 +66,17 @@ internal static List ComputeBound(this IMultiplicityRange multiplic /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// lowerBound = + /// let ownedExpressions : Sequence(Expression) = + /// ownedMember->selectByKind(Expression) in + /// if ownedExpressions->size() < 2 then null + /// else ownedExpressions->first() + /// endif + /// + /// /// /// The subject /// @@ -70,6 +92,18 @@ internal static IExpression ComputeLowerBound(this IMultiplicityRange multiplici /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// upperBound = + /// let ownedExpressions : Sequence(Expression) = + /// ownedMember->selectByKind(Expression) in + /// if ownedExpressions->isEmpty() then null + /// else if ownedExpressions->size() = 1 then ownedExpressions->at(1) + /// else ownedExpressions->at(2) + /// endif endif + /// + /// /// /// The subject /// @@ -86,6 +120,17 @@ internal static IExpression ComputeUpperBound(this IMultiplicityRange multiplici /// Check whether this MultiplicityRange represents the range bounded by the given values lower and /// upper, presuming the lowerBound and upperBound Expressions are model-level evaluable. /// + /// + /// OCL2.0: + /// + /// valueOf(upperBound) = upper and + /// let lowerValue: UnlimitedNatural = valueOf(lowerBound) in + /// (lowerValue = lower or + /// lowerValue = null and + /// (lower = upper or + /// lower = 0 and upper = *)) + /// + /// /// /// The subject /// @@ -108,6 +153,26 @@ internal static bool ComputeHasBoundsOperation(this IMultiplicityRange multiplic /// Evaluate the given bound Expression (at model level) and return the result represented as a MOF /// UnlimitedNatural value. /// + /// + /// OCL2.0: + /// + /// if bound = null or not bound.isModelLevelEvaluable then + /// null + /// else + /// let boundEval: Sequence(Element) = bound.evaluate(owningType) in + /// if boundEval->size() <> 1 then null else + /// let valueEval: Element = boundEval->at(1) in + /// if valueEval.oclIsKindOf(LiteralInfinity) then * + /// else if valueEval.oclIsKindOf(LiteralInteger) then + /// let value : Integer = + /// valueEval.oclAsKindOf(LiteralInteger).value in + /// if value >= 0 then value else null endif + /// else null + /// endif endif + /// endif + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/NamespaceExtensions.cs b/SysML2.NET/Extend/NamespaceExtensions.cs index a3180f394..e4c864309 100644 --- a/SysML2.NET/Extend/NamespaceExtensions.cs +++ b/SysML2.NET/Extend/NamespaceExtensions.cs @@ -25,7 +25,6 @@ namespace SysML2.NET.Core.POCO.Root.Namespaces using System.Linq; using System.Text; - using SysML2.NET.Comparer; using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; @@ -40,6 +39,12 @@ internal static class NamespaceExtensions /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// importedMembership = importedMemberships(Set{}) + /// + /// /// /// The subject /// @@ -54,6 +59,12 @@ internal static List ComputeImportedMembership(this INamespace name /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// member = membership.memberElement + /// + /// /// /// The subject /// @@ -82,6 +93,12 @@ internal static List ComputeMembership(this INamespace namespaceSub /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// ownedImport = ownedRelationship->selectByKind(Import) + /// + /// /// /// The subject /// @@ -96,10 +113,15 @@ internal static List ComputeOwnedImport(this INamespace namespaceSubjec /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// ownedMember = ownedMembership->selectByKind(OwningMembership).ownedMemberElement + /// + /// /// /// The subject /// - /// OCL Constraint : ownedMember = ownedMembership->selectByKind(OwningMembership).ownedMemberElement /// /// the computed result /// @@ -111,6 +133,12 @@ internal static List ComputeOwnedMember(this INamespace namespaceSubje /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// ownedMembership = ownedRelationship->selectByKind(Membership) + /// + /// /// /// The subject /// @@ -125,6 +153,13 @@ internal static List ComputeOwnedMembership(this INamespace namespa /// /// Return the names of the given element as it is known in this Namespace. /// + /// + /// OCL (KerML XMI): + /// + /// let elementMemberships : Sequence(Membership) = memberships->select(memberElement = element) in + /// memberships.memberShortName->union(memberships.memberName)->asSet() + /// + /// /// /// The subject /// @@ -170,6 +205,17 @@ internal static List ComputeNamesOfOperation(this INamespace namespaceSu /// Returns this visibility of mem relative to this Namespace. If mem is an importedMembership, this is /// the visibility of its Import. Otherwise it is the visibility of the Membership itself. /// + /// + /// OCL (KerML XMI): + /// + /// if importedMembership->includes(mem) then + /// ownedImport->select(importedMemberships(Set{})->includes(mem)).first().visibility + /// else + /// if memberships->includes(mem) then mem.visibility + /// else VisibilityKind::private endif + /// endif + /// + /// /// /// The subject /// @@ -212,6 +258,21 @@ internal static VisibilityKind ComputeVisibilityOfOperation(this INamespace name /// Memberships of all owned Namespaces. When computing imported Memberships, ignore this Namespace and /// any Namespaces in the given excluded set. /// + /// + /// OCL (KerML XMI): + /// + /// let visibleMemberships : OrderedSet(Membership) = + /// if includeAll then membershipsOfVisibility(null, excluded) + /// else membershipsOfVisibility(VisibilityKind::public, excluded) endif + /// in + /// if not isRecursive then visibleMemberships + /// else visibleMemberships->union( + /// ownedMember->selectAsKind(Namespace). + /// select(includeAll or owningMembership.visibility = VisibilityKind::public)-> + /// visibleMemberships(excluded->including(self), true, includeAll)) + /// endif + /// + /// /// /// The subject /// @@ -276,6 +337,12 @@ internal static List ComputeVisibleMembershipsOperation(this INames /// excluding those Imports whose importOwningNamespace is in the excluded set, and excluding /// Memberships that have distinguisibility collisions with each other or with any ownedMembership. /// + /// + /// OCL (KerML XMI): + /// + /// ownedImport.importedMemberships(excluded->including(self)) + /// + /// /// /// The subject /// @@ -287,66 +354,61 @@ internal static List ComputeVisibleMembershipsOperation(this INames /// internal static List ComputeImportedMembershipsOperation(this INamespace namespaceSubject, List excluded) { - var importedMemberships = namespaceSubject.ownedImport.Where(x => !excluded.Contains(x.importOwningNamespace)) - .SelectMany(x => x.ImportedMemberships(excluded)) + if (namespaceSubject == null) + { + throw new ArgumentNullException(nameof(namespaceSubject)); + } + + var excludedWithSelf = new List(excluded) { namespaceSubject }; + + var importedMemberships = namespaceSubject.ownedImport + .SelectMany(import => import.ImportedMemberships(excludedWithSelf)) .Distinct() .ToList(); - var ownedMembershipNames = namespaceSubject.ownedMembership - .Select(membership => membership.MemberName) - .ToHashSet(NullSafeStringComparer.Instance); - - var ownedMembershipShortNames = namespaceSubject.ownedMembership - .Select(membership => membership.MemberShortName) - .ToHashSet(NullSafeStringComparer.Instance); + var ownedMemberships = namespaceSubject.ownedMembership; - var importedNameFrequency = new Dictionary(importedMemberships.Count); - var importedShortNameFrequency = new Dictionary(importedMemberships.Count); - var importedNullNameCount = 0; - var importedNullShortNameCount = 0; + return + [ + ..importedMemberships.Where(import => + ownedMemberships.All(owned => IsDistinguishableMembership(import, owned)) + && importedMemberships.All(other => other == import || IsDistinguishableMembership(import, other))) + ]; + } - foreach (var membership in importedMemberships) + /// + /// Determines whether is distinguishable from + /// according to the default OCL body of Membership::isDistinguishableFrom. + /// + /// + /// OCL (KerML XMI): + /// + /// memberShortName = null and memberName = null or + /// (memberShortName <> other.memberShortName and memberShortName <> other.memberName and + /// memberName <> other.memberShortName and memberName <> other.memberName) + /// + /// + /// + /// The on whose perspective distinguishability is evaluated. + /// + /// + /// The being compared against. + /// + /// + /// when can be distinguished from + /// per the default Membership distinguishability rule; otherwise . + /// + private static bool IsDistinguishableMembership(IMembership left, IMembership right) + { + if (left.MemberShortName == null && left.MemberName == null) { - var memberName = membership.MemberName; - - if (memberName != null) - { - importedNameFrequency[memberName] = importedNameFrequency.TryGetValue(memberName, out var nameCount) ? nameCount + 1 : 1; - } - else - { - importedNullNameCount++; - } - - var memberShortName = membership.MemberShortName; - - if (memberShortName != null) - { - importedShortNameFrequency[memberShortName] = importedShortNameFrequency.TryGetValue(memberShortName, out var shortNameCount) ? shortNameCount + 1 : 1; - } - else - { - importedNullShortNameCount++; - } + return true; } - var nonCollidingImportedMemberships = importedMemberships.Where(membership => - { - var memberName = membership.MemberName; - var memberShortName = membership.MemberShortName; - - var nameCollidesWithOwned = ownedMembershipNames.Contains(memberName) || ownedMembershipShortNames.Contains(memberShortName); - - var nameCollidesWithImported = - (memberName != null && importedNameFrequency.TryGetValue(memberName, out var nameFrequency) && nameFrequency > 1) - || (memberName == null && importedNullNameCount > 1) - || (memberShortName != null && importedShortNameFrequency.TryGetValue(memberShortName, out var shortNameFrequency) && shortNameFrequency > 1) - || (memberShortName == null && importedNullShortNameCount > 1); - - return !nameCollidesWithOwned && !nameCollidesWithImported; - }).ToList(); - - return nonCollidingImportedMemberships; + return left.MemberShortName != right.MemberShortName + && left.MemberShortName != right.MemberName + && left.MemberName != right.MemberShortName + && left.MemberName != right.MemberName; } /// @@ -356,6 +418,14 @@ internal static List ComputeImportedMembershipsOperation(this IName /// of visibility. When computing imported Memberships, ignore this Namespace and any Namespaces in the /// given excluded set. /// + /// + /// OCL (KerML XMI): + /// + /// ownedMembership->select(mem | visibility = null or mem.visibility = visibility)->union( + /// ownedImport->select(imp | visibility = null or imp.visibility = visibility). + /// importedMemberships(excluded->including(self))) + /// + /// /// /// The subject /// @@ -400,6 +470,24 @@ internal static List ComputeMembershipsOfVisibilityOperation(this I /// notation. According to the KerML name resolution rules every qualified name will resolve to either a /// single Membership, or to none. /// + /// + /// OCL (KerML XMI): + /// + /// let qualification : String = qualificationOf(qualifiedName) in + /// let name : String = unqualifiedNameOf(qualifiedName) in + /// if qualification = null then resolveLocal(name) + /// else + /// if qualification = '$' then resolveGlobal(name) + /// else + /// let namespaceMembership : Membership = resolve(qualification) in + /// if namespaceMembership = null or + /// not namespaceMembership.memberElement.oclIsKindOf(Namespace) then null + /// else namespaceMembership.memberElement.oclAsType(Namespace).resolveVisible(name) + /// endif + /// endif + /// endif + /// + /// /// /// The subject /// @@ -495,6 +583,19 @@ internal static IMembership ComputeResolveGlobalOperation(this INamespace namesp /// containing outer scopes as necessary. However, if this Namespace is a root Namespace, then the /// resolution is done directly in global scope. /// + /// + /// OCL (KerML XMI): + /// + /// if owningNamespace = null then resolveGlobal(name) + /// else + /// let memberships : Membership = membership->select(memberShortName = name or memberName = name) + /// in + /// if memberships->notEmpty() then memberships->first() + /// else owningNamspace.resolveLocal(name) + /// endif + /// endif + /// + /// /// /// The subject /// @@ -529,6 +630,15 @@ internal static IMembership ComputeResolveLocalOperation(this INamespace namespa /// /// Resolve a simple name from the visible Memberships of this Namespace. /// + /// + /// OCL (KerML XMI): + /// + /// let memberships : Sequence(Membership) = + /// visibleMemberships(Set{}, false, false)->select(memberShortName = name or memberName = name) + /// in + /// if memberships->isEmpty() then null else memberships->first() endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/NamespaceImportExtensions.cs b/SysML2.NET/Extend/NamespaceImportExtensions.cs index 02f73ec4c..593cc168a 100644 --- a/SysML2.NET/Extend/NamespaceImportExtensions.cs +++ b/SysML2.NET/Extend/NamespaceImportExtensions.cs @@ -38,6 +38,14 @@ internal static class NamespaceImportExtensions /// Memberships are also recursively imported from any ownedMembers of the importedNamespace that are /// themselves Namespaces. /// + /// + /// OCL (KerML XMI): + /// + /// if excluded->includes(importedNamespace) then Sequence{} + /// else importedNamespace.visibleMemberships(excluded, isRecursive, isImportAll) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/NullExpressionExtensions.cs b/SysML2.NET/Extend/NullExpressionExtensions.cs index 8b315d21d..bbfde5e99 100644 --- a/SysML2.NET/Extend/NullExpressionExtensions.cs +++ b/SysML2.NET/Extend/NullExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -41,6 +42,12 @@ internal static class NullExpressionExtensions /// /// A NullExpression is always model-level evaluable. /// + /// + /// OCL2.0: + /// + /// true + /// + /// /// /// The subject /// @@ -59,6 +66,12 @@ internal static bool ComputeRedefinedModelLevelEvaluableOperation(this INullExpr /// /// The model-level value of a NullExpression is an empty sequence. /// + /// + /// OCL2.0: + /// + /// Sequence{} + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/OccurrenceDefinitionExtensions.cs b/SysML2.NET/Extend/OccurrenceDefinitionExtensions.cs index 243f6b224..08bc390d0 100644 --- a/SysML2.NET/Extend/OccurrenceDefinitionExtensions.cs +++ b/SysML2.NET/Extend/OccurrenceDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Occurrences using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/OccurrenceUsageExtensions.cs b/SysML2.NET/Extend/OccurrenceUsageExtensions.cs index 6c027f4b0..3fc34a9a8 100644 --- a/SysML2.NET/Extend/OccurrenceUsageExtensions.cs +++ b/SysML2.NET/Extend/OccurrenceUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Occurrences using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -63,6 +64,18 @@ internal static class OccurrenceUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// individualDefinition = + /// let individualDefinitions : OrderedSet(OccurrenceDefinition) = + /// occurrenceDefinition-> + /// selectByKind(OccurrenceDefinition)-> + /// select(isIndividual) in + /// if individualDefinitions->isEmpty() then null + /// else individualDefinitions->first() endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/OperatorExpressionExtensions.cs b/SysML2.NET/Extend/OperatorExpressionExtensions.cs index 20730663d..6fad5c018 100644 --- a/SysML2.NET/Extend/OperatorExpressionExtensions.cs +++ b/SysML2.NET/Extend/OperatorExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; @@ -42,6 +43,18 @@ internal static class OperatorExpressionExtensions /// The instantiatedType of an OperatorExpression is the resolution of it's operator from one of the /// packages BaseFunctions, DataFunctions, or ControlFunctions from the Kernel Function Library. /// + /// + /// OCL2.0: + /// + /// let libFunctions : Sequence(Element) = + /// Sequence{'BaseFunctions', 'DataFunctions', 'ControlFunctions'}-> + /// collect(ns | resolveGlobal(ns + "::'" + operator + "'"). + /// memberElement) in + /// if libFunctions->isEmpty() then null + /// else libFunctions->first().oclAsType(Type) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/OwningMembershipExtensions.cs b/SysML2.NET/Extend/OwningMembershipExtensions.cs index 6dcfb9ecc..acba59482 100644 --- a/SysML2.NET/Extend/OwningMembershipExtensions.cs +++ b/SysML2.NET/Extend/OwningMembershipExtensions.cs @@ -71,6 +71,12 @@ internal static string ComputeOwnedMemberElementId(this IOwningMembership owning /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// ownedMemberName = ownedMemberElement.name + /// + /// /// /// The subject /// @@ -85,6 +91,12 @@ internal static string ComputeOwnedMemberName(this IOwningMembership owningMembe /// /// Computes the derived property. /// + /// + /// OCL (KerML XMI): + /// + /// ownedMemberShortName = ownedMemberElement.shortName + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/PackageExtensions.cs b/SysML2.NET/Extend/PackageExtensions.cs index 94ad5fe44..d7c1dd911 100644 --- a/SysML2.NET/Extend/PackageExtensions.cs +++ b/SysML2.NET/Extend/PackageExtensions.cs @@ -38,7 +38,12 @@ internal static class PackageExtensions /// /// Computes the derived property. /// - /// OCL2: filterCondition = ownedMembership-> selectByKind(ElementFilterMembership).condition + /// + /// OCL (KerML XMI): + /// + /// filterCondition = ownedMembership->selectByKind(ElementFilterMembership).condition + /// + /// /// /// The subject /// @@ -53,6 +58,12 @@ internal static List ComputeFilterCondition(this IPackage packageSu /// /// Exclude Elements that do not meet all the filterConditions. /// + /// + /// OCL (KerML XMI): + /// + /// self.oclAsType(Namespace).importedMemberships(excluded)->select(m | self.includeAsMember(m.memberElement)) + /// + /// /// /// The subject /// @@ -84,6 +95,15 @@ internal static List ComputeRedefinedImportedMembershipsOperation(t /// /// Determine whether the given element meets all the filterConditions. /// + /// + /// OCL (KerML XMI): + /// + /// let metadataFeatures: Sequence(AnnotatingElement) = + /// element.ownedAnnotation.annotatingElement->selectByKind(MetadataFeature) + /// in + /// self.filterCondition->forAll(cond | metadataFeatures->exists(elem | cond.checkCondition(elem))) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ParameterMembershipExtensions.cs b/SysML2.NET/Extend/ParameterMembershipExtensions.cs index 11e02f686..f8c14f209 100644 --- a/SysML2.NET/Extend/ParameterMembershipExtensions.cs +++ b/SysML2.NET/Extend/ParameterMembershipExtensions.cs @@ -55,6 +55,12 @@ internal static IFeature ComputeOwnedMemberParameter(this IParameterMembership p /// /// Return the required value of the direction of the ownedMemberParameter. By default, this is in. /// + /// + /// OCL2.0: + /// + /// FeatureDirectionKind::_'in' + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/PartUsageExtensions.cs b/SysML2.NET/Extend/PartUsageExtensions.cs index bf261d19c..651850ff0 100644 --- a/SysML2.NET/Extend/PartUsageExtensions.cs +++ b/SysML2.NET/Extend/PartUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Parts using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -64,6 +65,12 @@ internal static class PartUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// itemDefinition->selectByKind(PartDefinition) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/PerformActionUsageExtensions.cs b/SysML2.NET/Extend/PerformActionUsageExtensions.cs index ff5dbbd28..fd823a267 100644 --- a/SysML2.NET/Extend/PerformActionUsageExtensions.cs +++ b/SysML2.NET/Extend/PerformActionUsageExtensions.cs @@ -24,12 +24,14 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; @@ -81,6 +83,14 @@ internal static IActionUsage ComputePerformedAction(this IPerformActionUsage per /// PerformActionUsage. If the PerformActionUsage is its own performedAction, then the naming Feature is /// the same as the usual default for a Usage. /// + /// + /// OCL2.0: + /// + /// if performedAction <> self then performedAction + /// else self.oclAsType(Usage).namingFeature() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/PortDefinitionExtensions.cs b/SysML2.NET/Extend/PortDefinitionExtensions.cs index 112678494..a430239bf 100644 --- a/SysML2.NET/Extend/PortDefinitionExtensions.cs +++ b/SysML2.NET/Extend/PortDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Ports using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -61,6 +63,17 @@ internal static class PortDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// conjugatedPortDefinition = + /// let conjugatedPortDefinitions : OrderedSet(ConjugatedPortDefinition) = + /// ownedMember->selectByKind(ConjugatedPortDefinition) in + /// if conjugatedPortDefinitions->isEmpty() then null + /// else conjugatedPortDefinitions->first() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/PortUsageExtensions.cs b/SysML2.NET/Extend/PortUsageExtensions.cs index 9e8e09ddc..03e6d0a25 100644 --- a/SysML2.NET/Extend/PortUsageExtensions.cs +++ b/SysML2.NET/Extend/PortUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Ports using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/ReferenceUsageExtensions.cs b/SysML2.NET/Extend/ReferenceUsageExtensions.cs index cba6b0123..7f6a98f8c 100644 --- a/SysML2.NET/Extend/ReferenceUsageExtensions.cs +++ b/SysML2.NET/Extend/ReferenceUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.DefinitionAndUsage using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -77,6 +78,16 @@ internal static bool ComputeIsReference(this IReferenceUsage referenceUsageSubje /// If this ReferenceUsage is the payload parameter of a TransitionUsage, then its naming Feature is the /// payloadParameter of the triggerAction of that TransitionUsage (if any). /// + /// + /// OCL2.0: + /// + /// if owningType <> null and owningType.oclIsKindOf(TransitionUsage) and + /// owningType.oclAsType(TransitionUsage).inputParameter(2) = self then + /// owningType.oclAsType(TransitionUsage).triggerPayloadParameter() + /// else self.oclAsType(Usage).namingFeature() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/RelationshipExtensions.cs b/SysML2.NET/Extend/RelationshipExtensions.cs index d83fcab3c..5ff6d0f34 100644 --- a/SysML2.NET/Extend/RelationshipExtensions.cs +++ b/SysML2.NET/Extend/RelationshipExtensions.cs @@ -51,7 +51,9 @@ internal static class RelationshipExtensions /// internal static List ComputeRelatedElement(this IRelationship relationshipSubject) { - return relationshipSubject == null ? throw new ArgumentNullException(nameof(relationshipSubject)) : [..relationshipSubject.Source, ..relationshipSubject.Target]; + return relationshipSubject == null + ? throw new ArgumentNullException(nameof(relationshipSubject)) + : [..relationshipSubject.Source.Union(relationshipSubject.Target)]; } /// diff --git a/SysML2.NET/Extend/RenderingDefinitionExtensions.cs b/SysML2.NET/Extend/RenderingDefinitionExtensions.cs index 1b18d7af7..25a96c1bb 100644 --- a/SysML2.NET/Extend/RenderingDefinitionExtensions.cs +++ b/SysML2.NET/Extend/RenderingDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -60,6 +62,12 @@ internal static class RenderingDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// rendering = usages->selectByKind(RenderingUsage) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/RenderingUsageExtensions.cs b/SysML2.NET/Extend/RenderingUsageExtensions.cs index be1180876..e24239550 100644 --- a/SysML2.NET/Extend/RenderingUsageExtensions.cs +++ b/SysML2.NET/Extend/RenderingUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; diff --git a/SysML2.NET/Extend/RequirementConstraintMembershipExtensions.cs b/SysML2.NET/Extend/RequirementConstraintMembershipExtensions.cs index 83a4d4546..f53dfaa30 100644 --- a/SysML2.NET/Extend/RequirementConstraintMembershipExtensions.cs +++ b/SysML2.NET/Extend/RequirementConstraintMembershipExtensions.cs @@ -56,6 +56,19 @@ internal static IConstraintUsage ComputeOwnedConstraint(this IRequirementConstra /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// referencedConstraint = + /// let referencedFeature : Feature = + /// ownedConstraint.referencedFeatureTarget() in + /// if referencedFeature = null then ownedConstraint + /// else if referencedFeature.oclIsKindOf(ConstraintUsage) then + /// refrencedFeature.oclAsType(ConstraintUsage) + /// else null + /// endif endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/RequirementDefinitionExtensions.cs b/SysML2.NET/Extend/RequirementDefinitionExtensions.cs index d07b1e390..5f6bfda11 100644 --- a/SysML2.NET/Extend/RequirementDefinitionExtensions.cs +++ b/SysML2.NET/Extend/RequirementDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,14 @@ internal static class RequirementDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// actorParameter = featureMembership-> + /// selectByKind(ActorMembership). + /// ownedActorParameter + /// + /// /// /// The subject /// @@ -77,6 +87,15 @@ internal static List ComputeActorParameter(this IRequirementDefiniti /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// assumedConstraint = ownedFeatureMembership-> + /// selectByKind(RequirementConstraintMembership)-> + /// select(kind = RequirementConstraintKind::assumption). + /// ownedConstraint + /// + /// /// /// The subject /// @@ -92,6 +111,14 @@ internal static List ComputeAssumedConstraint(this IRequiremen /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// framedConcern = featureMembership-> + /// selectByKind(FramedConcernMembership). + /// ownedConcern + /// + /// /// /// The subject /// @@ -107,6 +134,15 @@ internal static List ComputeFramedConcern(this IRequirementDefini /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// requiredConstraint = ownedFeatureMembership-> + /// selectByKind(RequirementConstraintMembership)-> + /// select(kind = RequirementConstraintKind::requirement). + /// ownedConstraint + /// + /// /// /// The subject /// @@ -122,6 +158,14 @@ internal static List ComputeRequiredConstraint(this IRequireme /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// stakeholderParameter = featureMembership-> + /// selectByKind(StakholderMembership). + /// ownedStakeholderParameter + /// + /// /// /// The subject /// @@ -137,6 +181,17 @@ internal static List ComputeStakeholderParameter(this IRequirementDe /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// subjectParameter = + /// let subjects : OrderedSet(SubjectMembership) = + /// featureMembership->selectByKind(SubjectMembership) in + /// if subjects->isEmpty() then null + /// else subjects->first().ownedSubjectParameter + /// endif + /// + /// /// /// The subject /// @@ -152,6 +207,12 @@ internal static IUsage ComputeSubjectParameter(this IRequirementDefinition requi /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// text = documentation.body + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/RequirementUsageExtensions.cs b/SysML2.NET/Extend/RequirementUsageExtensions.cs index 1ba1f57ad..919e69f59 100644 --- a/SysML2.NET/Extend/RequirementUsageExtensions.cs +++ b/SysML2.NET/Extend/RequirementUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,14 @@ internal static class RequirementUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// actorParameter = featureMembership-> + /// selectByKind(ActorMembership). + /// ownedActorParameter + /// + /// /// /// The subject /// @@ -80,6 +89,15 @@ internal static List ComputeActorParameter(this IRequirementUsage re /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// assumedConstraint = ownedFeatureMembership-> + /// selectByKind(RequirementConstraintMembership)-> + /// select(kind = RequirementConstraintKind::assumption). + /// ownedConstraint + /// + /// /// /// The subject /// @@ -95,6 +113,14 @@ internal static List ComputeAssumedConstraint(this IRequiremen /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// framedConcern = featureMembership-> + /// selectByKind(FramedConcernMembership). + /// ownedConcern + /// + /// /// /// The subject /// @@ -110,6 +136,15 @@ internal static List ComputeFramedConcern(this IRequirementUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// requiredConstraint = ownedFeatureMembership-> + /// selectByKind(RequirementConstraintMembership)-> + /// select(kind = RequirementConstraintKind::requirement). + /// ownedConstraint + /// + /// /// /// The subject /// @@ -140,6 +175,14 @@ internal static IRequirementDefinition ComputeRequirementDefinition(this IRequir /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// stakeholderParameter = featureMembership-> + /// selectByKind(AStakholderMembership). + /// ownedStakeholderParameter + /// + /// /// /// The subject /// @@ -155,6 +198,17 @@ internal static List ComputeStakeholderParameter(this IRequirementUs /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// subjectParameter = + /// let subjects : OrderedSet(SubjectMembership) = + /// featureMembership->selectByKind(SubjectMembership) in + /// if subjects->isEmpty() then null + /// else subjects->first().ownedSubjectParameter + /// endif + /// + /// /// /// The subject /// @@ -170,6 +224,12 @@ internal static IUsage ComputeSubjectParameter(this IRequirementUsage requiremen /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// text = documentation.body + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ReturnParameterMembershipExtensions.cs b/SysML2.NET/Extend/ReturnParameterMembershipExtensions.cs index f4856cf5c..44d92a181 100644 --- a/SysML2.NET/Extend/ReturnParameterMembershipExtensions.cs +++ b/SysML2.NET/Extend/ReturnParameterMembershipExtensions.cs @@ -42,6 +42,12 @@ internal static class ReturnParameterMembershipExtensions /// The ownedMemberParameter of a ReturnParameterMembership must have direction out. (This is a leaf /// operation that cannot be further redefined.) /// + /// + /// OCL2.0: + /// + /// FeatureDirectionKind::out + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/SatisfyRequirementUsageExtensions.cs b/SysML2.NET/Extend/SatisfyRequirementUsageExtensions.cs index 0f4b9b595..2eedbba1e 100644 --- a/SysML2.NET/Extend/SatisfyRequirementUsageExtensions.cs +++ b/SysML2.NET/Extend/SatisfyRequirementUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,20 @@ internal static IRequirementUsage ComputeSatisfiedRequirement(this ISatisfyRequi /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// satisfyingFeature = + /// let bindings: BindingConnector = ownedMember-> + /// selectByKind(BindingConnector)-> + /// select(b | b.relatedElement->includes(subjectParameter)) in + /// if bindings->isEmpty() or + /// bindings->first().relatedElement->exits(r | r <> subjectParameter) + /// then null + /// else bindings->first().relatedElement->any(r | r <> subjectParameter) + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/SelectExpressionExtensions.cs b/SysML2.NET/Extend/SelectExpressionExtensions.cs index c86871811..461e586a4 100644 --- a/SysML2.NET/Extend/SelectExpressionExtensions.cs +++ b/SysML2.NET/Extend/SelectExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Expressions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; diff --git a/SysML2.NET/Extend/SendActionUsageExtensions.cs b/SysML2.NET/Extend/SendActionUsageExtensions.cs index 7c5998484..48cd617bd 100644 --- a/SysML2.NET/Extend/SendActionUsageExtensions.cs +++ b/SysML2.NET/Extend/SendActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,12 @@ internal static class SendActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// payloadArgument = argument(1) + /// + /// /// /// The subject /// @@ -80,6 +87,12 @@ internal static IExpression ComputePayloadArgument(this ISendActionUsage sendAct /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// receiverArgument = argument(3) + /// + /// /// /// The subject /// @@ -95,6 +108,12 @@ internal static IExpression ComputeReceiverArgument(this ISendActionUsage sendAc /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// senderArgument = argument(2) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/StakeholderMembershipExtensions.cs b/SysML2.NET/Extend/StakeholderMembershipExtensions.cs index 5198fdaee..7741ba909 100644 --- a/SysML2.NET/Extend/StakeholderMembershipExtensions.cs +++ b/SysML2.NET/Extend/StakeholderMembershipExtensions.cs @@ -23,6 +23,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/StateDefinitionExtensions.cs b/SysML2.NET/Extend/StateDefinitionExtensions.cs index 0dd8a4ccb..2239cbb5a 100644 --- a/SysML2.NET/Extend/StateDefinitionExtensions.cs +++ b/SysML2.NET/Extend/StateDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.States using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -61,6 +63,19 @@ internal static class StateDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// doAction = + /// let doMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::do) in + /// if doMemberships->isEmpty() then null + /// else doMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -76,6 +91,19 @@ internal static IActionUsage ComputeDoAction(this IStateDefinition stateDefiniti /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// entryAction = + /// let entryMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::entry) in + /// if entryMemberships->isEmpty() then null + /// else entryMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -91,6 +119,19 @@ internal static IActionUsage ComputeEntryAction(this IStateDefinition stateDefin /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// exitAction = + /// let exitMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::exit) in + /// if exitMemberships->isEmpty() then null + /// else exitMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -106,6 +147,12 @@ internal static IActionUsage ComputeExitAction(this IStateDefinition stateDefini /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// state = action->selectByKind(StateUsage) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/StateUsageExtensions.cs b/SysML2.NET/Extend/StateUsageExtensions.cs index 1def27843..02a71c0f8 100644 --- a/SysML2.NET/Extend/StateUsageExtensions.cs +++ b/SysML2.NET/Extend/StateUsageExtensions.cs @@ -24,12 +24,14 @@ namespace SysML2.NET.Core.POCO.Systems.States using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Kernel.Behaviors; using SysML2.NET.Core.POCO.Kernel.Classes; + using SysML2.NET.Core.POCO.Kernel.Functions; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; using SysML2.NET.Core.POCO.Root.Namespaces; @@ -64,6 +66,19 @@ internal static class StateUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// doAction = + /// let doMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::do) in + /// if doMemberships->isEmpty() then null + /// else doMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -79,6 +94,19 @@ internal static IActionUsage ComputeDoAction(this IStateUsage stateUsageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// entryAction = + /// let entryMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::entry) in + /// if entryMemberships->isEmpty() then null + /// else entryMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -94,6 +122,19 @@ internal static IActionUsage ComputeEntryAction(this IStateUsage stateUsageSubje /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// exitAction = + /// let exitMemberships : Sequence(StateSubactionMembership) = + /// ownedMembership-> + /// selectByKind(StateSubactionMembership)-> + /// select(kind = StateSubactionKind::exit) in + /// if exitMemberships->isEmpty() then null + /// else exitMemberships->at(1) + /// endif + /// + /// /// /// The subject /// @@ -127,6 +168,17 @@ internal static List ComputeStateDefinition(this IStateUsage stateUsa /// it represents a StateAction that is a substate or exclusiveState (for isParallel = false) of another /// StateAction. /// + /// + /// OCL2.0: + /// + /// isComposite and owningType <> null and + /// (owningType.oclIsKindOf(StateDefinition) and + /// owningType.oclAsType(StateDefinition).isParallel = isParallel or + /// owningType.oclIsKindOf(StateUsage) and + /// owningType.oclAsType(StateUsage).isParallel = isParallel) and + /// not owningFeatureMembership.oclIsKindOf(StateSubactionMembership) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/StepExtensions.cs b/SysML2.NET/Extend/StepExtensions.cs index 238acefb6..6068bd186 100644 --- a/SysML2.NET/Extend/StepExtensions.cs +++ b/SysML2.NET/Extend/StepExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Kernel.Behaviors using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; using SysML2.NET.Core.POCO.Root.Annotations; @@ -39,6 +40,12 @@ internal static class StepExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// behavior = type->selectByKind(Behavior) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/SubjectMembershipExtensions.cs b/SysML2.NET/Extend/SubjectMembershipExtensions.cs index 1737b0303..9cd8d5a03 100644 --- a/SysML2.NET/Extend/SubjectMembershipExtensions.cs +++ b/SysML2.NET/Extend/SubjectMembershipExtensions.cs @@ -23,6 +23,7 @@ namespace SysML2.NET.Core.POCO.Systems.Requirements using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; diff --git a/SysML2.NET/Extend/TerminateActionUsageExtensions.cs b/SysML2.NET/Extend/TerminateActionUsageExtensions.cs index 95debe57a..a021ff1d8 100644 --- a/SysML2.NET/Extend/TerminateActionUsageExtensions.cs +++ b/SysML2.NET/Extend/TerminateActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,12 @@ internal static class TerminateActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// terminatedOccurrenceArgument = argument(1) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/TransitionUsageExtensions.cs b/SysML2.NET/Extend/TransitionUsageExtensions.cs index a59d76200..c40649433 100644 --- a/SysML2.NET/Extend/TransitionUsageExtensions.cs +++ b/SysML2.NET/Extend/TransitionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.States using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -66,6 +67,15 @@ internal static class TransitionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// triggerAction = ownedFeatureMembership-> + /// selectByKind(TransitionFeatureMembership)-> + /// select(kind = TransitionFeatureKind::trigger).transitionFeatures-> + /// selectByKind(AcceptActionUsage) + /// + /// /// /// The subject /// @@ -81,6 +91,15 @@ internal static List ComputeEffectAction(this ITransitionUsage tra /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// guardExpression = ownedFeatureMembership-> + /// selectByKind(TransitionFeatureMembership)-> + /// select(kind = TransitionFeatureKind::trigger).transitionFeature-> + /// selectByKind(Expression) + /// + /// /// /// The subject /// @@ -96,6 +115,15 @@ internal static List ComputeGuardExpression(this ITransitionUsage t /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// source = + /// let sourceFeature : Feature = sourceFeature() in + /// if sourceFeature = null then null + /// else sourceFeature.featureTarget.oclAsType(ActionUsage) + /// + /// /// /// The subject /// @@ -111,6 +139,12 @@ internal static IActionUsage ComputeSource(this ITransitionUsage transitionUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// succession = ownedMember->selectByKind(Succession)->at(1) + /// + /// /// /// The subject /// @@ -126,6 +160,20 @@ internal static ISuccession ComputeSuccession(this ITransitionUsage transitionUs /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// target = + /// if succession.targetFeature->isEmpty() then null + /// else + /// let targetFeature : Feature = + /// succession.targetFeature->first().featureTarget in + /// if not targetFeature.oclIsKindOf(ActionUsage) then null + /// else targetFeature.oclAsType(ActionUsage) + /// endif + /// endif + /// + /// /// /// The subject /// @@ -141,6 +189,15 @@ internal static IActionUsage ComputeTarget(this ITransitionUsage transitionUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// triggerAction = ownedFeatureMembership-> + /// selectByKind(TransitionFeatureMembership)-> + /// select(kind = TransitionFeatureKind::trigger).transitionFeature-> + /// selectByKind(AcceptActionUsage) + /// + /// /// /// The subject /// @@ -156,6 +213,14 @@ internal static List ComputeTriggerAction(this ITransitionUs /// /// Return the payloadParameter of the triggerAction of this TransitionUsage, if it has one. /// + /// + /// OCL2.0: + /// + /// if triggerAction->isEmpty() then null + /// else triggerAction->first().payloadParameter + /// endif + /// + /// /// /// The subject /// @@ -173,6 +238,18 @@ internal static IReferenceUsage ComputeTriggerPayloadParameterOperation(this ITr /// first member of the TransitionUsage that is a Feature, that is owned by the TransitionUsage via a /// Membership that is not a FeatureMembership, and whose featureTarget is an ActionUsage. /// + /// + /// OCL2.0: + /// + /// let features : Sequence(Feature) = ownedMembership-> + /// reject(oclIsKindOf(FeatureMembership)).memberElement-> + /// selectByKind(Feature)-> + /// select(featureTarget.oclIsKindOf(ActionUsage)) in + /// if features->isEmpty() then null + /// else features->first() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/TriggerInvocationExpressionExtensions.cs b/SysML2.NET/Extend/TriggerInvocationExpressionExtensions.cs index b9fe4c902..309b6881e 100644 --- a/SysML2.NET/Extend/TriggerInvocationExpressionExtensions.cs +++ b/SysML2.NET/Extend/TriggerInvocationExpressionExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Actions; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -45,6 +46,20 @@ internal static class TriggerInvocationExpressionExtensions /// Triggers package, depending on whether the kind of this TriggerInvocationExpression is when, at or /// after, respectively. /// + /// + /// OCL2.0: + /// + /// resolveGlobal( + /// if kind = TriggerKind::when then + /// 'Triggers::TriggerWhen' + /// else if kind = TriggerKind::at then + /// 'Triggers::TriggerAt' + /// else + /// 'Triggers::TriggerAfter' + /// endif endif + /// ).memberElement.oclAsType(Type) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/TypeExtensions.cs b/SysML2.NET/Extend/TypeExtensions.cs index e80b6695f..7d228815c 100644 --- a/SysML2.NET/Extend/TypeExtensions.cs +++ b/SysML2.NET/Extend/TypeExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Core.Types using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Root.Annotations; using SysML2.NET.Core.POCO.Root.Elements; @@ -38,6 +39,12 @@ internal static class TypeExtensions /// /// Computes the derived property. /// + /// + /// English: + /// + /// differencingType = ownedDifferencing.differencingType + /// + /// /// /// The subject /// @@ -53,6 +60,12 @@ internal static List ComputeDifferencingType(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// directedFeature = feature->select(f | directionOf(f) <> null) + /// + /// /// /// The subject /// @@ -68,6 +81,12 @@ internal static List ComputeDirectedFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// endFeature = feature->select(isEnd) + /// + /// /// /// The subject /// @@ -83,6 +102,12 @@ internal static List ComputeEndFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// feature = featureMembership.ownedMemberFeature + /// + /// /// /// The subject /// @@ -98,6 +123,13 @@ internal static List ComputeFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// featureMembership = ownedFeatureMembership->union( + /// inheritedMembership->selectByKind(FeatureMembership)) + /// + /// /// /// The subject /// @@ -113,6 +145,13 @@ internal static List ComputeFeatureMembership(this IType typ /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// inheritedFeature = inheritedMemberships-> + /// selectByKind(FeatureMembership).memberFeature + /// + /// /// /// The subject /// @@ -128,6 +167,12 @@ internal static List ComputeInheritedFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// inheritedMembership = inheritedMemberships(Set{}, Set{}, false) + /// + /// /// /// The subject /// @@ -143,6 +188,15 @@ internal static List ComputeInheritedMembership(this IType typeSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// input = feature->select(f | + /// let direction: FeatureDirectionKind = directionOf(f) in + /// direction = FeatureDirectionKind::_'in' or + /// direction = FeatureDirectionKind::inout) + /// + /// /// /// The subject /// @@ -158,6 +212,12 @@ internal static List ComputeInput(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// intersectingType = ownedIntersecting.intersectingType + /// + /// /// /// The subject /// @@ -188,6 +248,17 @@ internal static bool ComputeIsConjugated(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// multiplicity = + /// let ownedMultiplicities: Sequence(Multiplicity) = + /// ownedMember->selectByKind(Multiplicity) in + /// if ownedMultiplicities->isEmpty() then null + /// else ownedMultiplicities->first() + /// endif + /// + /// /// /// The subject /// @@ -203,6 +274,15 @@ internal static IMultiplicity ComputeMultiplicity(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// output = feature->select(f | + /// let direction: FeatureDirectionKind = directionOf(f) in + /// direction = FeatureDirectionKind::out or + /// direction = FeatureDirectionKind::inout) + /// + /// /// /// The subject /// @@ -218,6 +298,16 @@ internal static List ComputeOutput(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedConjugator = + /// let ownedConjugators: Sequence(Conjugator) = + /// ownedRelationship->selectByKind(Conjugation) in + /// if ownedConjugators->isEmpty() then null + /// else ownedConjugators->at(1) endif + /// + /// /// /// The subject /// @@ -233,6 +323,13 @@ internal static IConjugation ComputeOwnedConjugator(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedDifferencing = + /// ownedRelationship->selectByKind(Differencing) + /// + /// /// /// The subject /// @@ -248,6 +345,13 @@ internal static List ComputeOwnedDifferencing(this IType typeSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedDisjoining = + /// ownedRelationship->selectByKind(Disjoining) + /// + /// /// /// The subject /// @@ -263,6 +367,12 @@ internal static List ComputeOwnedDisjoining(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedEndFeature = ownedFeature->select(isEnd) + /// + /// /// /// The subject /// @@ -278,6 +388,12 @@ internal static List ComputeOwnedEndFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// English: + /// + /// ownedFeature = ownedFeatureMembership.ownedMemberFeature + /// + /// /// /// The subject /// @@ -293,6 +409,12 @@ internal static List ComputeOwnedFeature(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedFeatureMembership = ownedRelationship->selectByKind(FeatureMembership) + /// + /// /// /// The subject /// @@ -308,6 +430,12 @@ internal static List ComputeOwnedFeatureMembership(this ITyp /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedRelationship->selectByKind(Intersecting) + /// + /// /// /// The subject /// @@ -323,6 +451,13 @@ internal static List ComputeOwnedIntersecting(this IType typeSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedSpecialization = ownedRelationship->selectByKind(Specialization)-> + /// select(s | s.special = self) + /// + /// /// /// The subject /// @@ -338,6 +473,13 @@ internal static List ComputeOwnedSpecialization(this IType type /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedUnioning = + /// ownedRelationship->selectByKind(Unioning) + /// + /// /// /// The subject /// @@ -353,6 +495,12 @@ internal static List ComputeOwnedUnioning(this IType typeSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// unioningType = ownedUnioning.unioningType + /// + /// /// /// The subject /// @@ -368,6 +516,18 @@ internal static List ComputeUnioningType(this IType typeSubject) /// /// The visible Memberships of a Type include inheritedMemberships. /// + /// + /// OCL2.0: + /// + /// let visibleMemberships : OrderedSet(Membership) = + /// self.oclAsType(Namespace). + /// visibleMemberships(excluded, isRecursive, includeAll) in + /// let visibleInheritedMemberships : OrderedSet(Membership) = + /// inheritedMemberships(excluded->including(self), Set{}, isRecursive)-> + /// select(includeAll or visibility = VisibilityKind::public) in + /// visibleMemberships->union(visibleInheritedMemberships) + /// + /// /// /// The subject /// @@ -394,6 +554,13 @@ internal static List ComputeRedefinedVisibleMembershipsOperation(th /// When computing inheritable Memberships, exclude Imports of excludedNamespaces, Specializations of /// excludedTypes, and, if excludeImplied = true, all implied Specializations. /// + /// + /// OCL2.0: + /// + /// removeRedefinedFeatures( + /// inheritableMemberships(excludedNamespaces, excludedTypes, excludeImplied)) + /// + /// /// /// The subject /// @@ -420,6 +587,14 @@ internal static List ComputeInheritedMembershipsOperation(this ITyp /// that are this Type or are in the given set of excludedTypes. If excludeImplied = true, then also /// transitively exclude any supertypes from implied Specializations. /// + /// + /// OCL2.0: + /// + /// let excludingSelf : Set(Type) = excludedType->including(self) in + /// supertypes(excludeImplied)->reject(t | excludingSelf->includes(t)). + /// nonPrivateMemberships(excludedNamespaces, excludingSelf, excludeImplied) + /// + /// /// /// The subject /// @@ -447,6 +622,20 @@ internal static List ComputeInheritableMembershipsOperation(this IT /// exclude Types in the given set of excludedTypes. If excludeImplied = true, then also exclude any /// supertypes from implied Specializations. /// + /// + /// OCL2.0: + /// + /// let publicMemberships : OrderedSet(Membership) = + /// membershipsOfVisibility(VisibilityKind::public, excludedNamespaces) in + /// let protectedMemberships : OrderedSet(Membership) = + /// membershipsOfVisibility(VisibilityKind::protected, excludedNamespaces) in + /// let inheritedMemberships : OrderedSet(Membership) = + /// inheritedMemberships(excludedNamespaces, excludedTypes, excludeImplied) in + /// publicMemberships-> + /// union(protectedMemberships)-> + /// union(inheritedMemberships) + /// + /// /// /// The subject /// @@ -478,6 +667,20 @@ internal static List ComputeNonPrivateMembershipsOperation(this ITy /// whose memberElement is a Feature includes the memberElement and all Features directly or indirectly /// redefined by the memberElement. /// + /// + /// OCL2.0: + /// + /// let reducedMemberships : Sequence(Membership) = + /// memberships->reject(mem1 | + /// memberships->excluding(mem1)-> + /// exists(mem2 | allRedefinedFeaturesOf(mem2)-> + /// includes(mem1.memberElement))) in + /// let redefinedFeatures : Set(Feature) = + /// ownedFeature.redefinition.redefinedFeature->asSet() in + /// reducedMemberships->reject(mem | allRedefinedFeaturesOf(mem)-> + /// exists(feature | redefinedFeatures->includes(feature))) + /// + /// /// /// The subject /// @@ -497,6 +700,14 @@ internal static List ComputeRemoveRedefinedFeaturesOperation(this I /// If the memberElement of the given membership is a Feature, then return all Features directly or /// indirectly redefined by the memberElement. /// + /// + /// OCL2.0: + /// + /// if not membership.memberElement.oclIsType(Feature) then Set{} + /// else membership.memberElement.oclAsType(Feature).allRedefinedFeatures() + /// endif + /// + /// /// /// The subject /// @@ -516,6 +727,12 @@ internal static List ComputeAllRedefinedFeaturesOfOperation(this IType /// If the given feature is a feature of this Type, then return its direction relative to this Type, /// taking conjugation into account. /// + /// + /// OCL2.0: + /// + /// directionOfExcluding(f, Set{}) + /// + /// /// /// The subject /// @@ -535,6 +752,27 @@ internal static List ComputeAllRedefinedFeaturesOfOperation(this IType /// Return the direction of the given feature relative to this Type, excluding a given set of Types from /// the search of supertypes of this Type. /// + /// + /// OCL2.0: + /// + /// let excludedSelf : Set(Type) = excluded->including(self) in + /// if feature.owningType = self then feature.direction + /// else + /// let directions : Sequence(FeatureDirectionKind) = + /// supertypes(false)->excluding(excludedSelf). + /// directionOfExcluding(feature, excludedSelf)-> + /// select(d | d <> null) in + /// if directions->isEmpty() then null + /// else + /// let direction : FeatureDirectionKind = directions->first() in + /// if not isConjugated then direction + /// else if direction = FeatureDirectionKind::_'in' then FeatureDirectionKind::out + /// else if direction = FeatureDirectionKind::out then FeatureDirectionKind::_'in' + /// else direction + /// endif endif endif endif + /// endif + /// + /// /// /// The subject /// @@ -558,6 +796,16 @@ internal static List ComputeAllRedefinedFeaturesOfOperation(this IType /// the general Types from all ownedSpecializations of this type, if excludeImplied = false, or all /// non-implied ownedSpecializations, if excludeImplied = true. /// + /// + /// OCL2.0: + /// + /// if isConjugated then Sequence{conjugator.originalType} + /// else if not excludeImplied then ownedSpecialization.general + /// else ownedSpecialization->reject(isImplied).general + /// endif + /// endif + /// + /// /// /// The subject /// @@ -577,6 +825,12 @@ internal static List ComputeSupertypesOperation(this IType typeSubject, b /// Return this Type and all Types that are directly or transitively supertypes of this Type (as /// determined by the supertypes operation with excludeImplied = false). /// + /// + /// OCL2.0: + /// + /// OrderedSet{self}->closure(supertypes(false)) + /// + /// /// /// The subject /// @@ -592,6 +846,16 @@ internal static List ComputeAllSupertypesOperation(this IType typeSubject /// /// Check whether this Type is a direct or indirect specialization of the given supertype. /// + /// + /// OCL2.0: + /// + /// if isConjugated then + /// ownedConjugator.originalType.specializes(supertype) + /// else + /// allSupertypes()->includes(supertype) + /// endif + /// + /// /// /// The subject /// @@ -612,6 +876,14 @@ internal static bool ComputeSpecializesOperation(this IType typeSubject, IType s /// libraryTypeName must conform to the syntax of a KerML qualified name and must resolve to a Type in /// global scope. /// + /// + /// OCL2.0: + /// + /// let mem : Membership = resolveGlobal(libraryTypeName) in + /// mem <> null and mem.memberElement.oclIsKindOf(Type) and + /// specializes(mem.memberElement.oclAsType(Type)) + /// + /// /// /// The subject /// @@ -631,6 +903,12 @@ internal static bool ComputeSpecializesFromLibraryOperation(this IType typeSubje /// By default, this Type is compatible with an otherType if it directly or indirectly specializes the /// otherType. /// + /// + /// OCL2.0: + /// + /// specializes(otherType) + /// + /// /// /// The subject /// @@ -649,6 +927,18 @@ internal static bool ComputeIsCompatibleWithOperation(this IType typeSubject, IT /// /// Return the owned or inherited Multiplicities for this Type<./code>. /// + /// + /// OCL2.0: + /// + /// if multiplicity <> null then OrderedSet{multiplicity} + /// else + /// ownedSpecialization.general->closure(t | + /// if t.multiplicity <> null then OrderedSet{} + /// else ownedSpecialization.general + /// )->select(multiplicity <> null).multiplicity->asOrderedSet() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/UsageExtensions.cs b/SysML2.NET/Extend/UsageExtensions.cs index f967d7231..891c1fb4c 100644 --- a/SysML2.NET/Extend/UsageExtensions.cs +++ b/SysML2.NET/Extend/UsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.DefinitionAndUsage using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -76,6 +77,12 @@ internal static List ComputeDefinition(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// directedUsage = directedFeature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -91,6 +98,12 @@ internal static List ComputeDirectedUsage(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// isReference = not isComposite + /// + /// /// /// The subject /// @@ -106,6 +119,20 @@ internal static bool ComputeIsReference(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// mayTimeVary = + /// owningType <> null and + /// owningType.specializesFromLibrary('Occurrences::Occurrence') and + /// not ( + /// isPortion or + /// specializesFromLibrary('Links::SelfLink') or + /// specializesFromLibrary('Occurrences::HappensLink') or + /// isComposite and specializesFromLibrary('Actions::Action') + /// ) + /// + /// /// /// The subject /// @@ -121,6 +148,12 @@ internal static bool ComputeMayTimeVary(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedAction = nestedUsage->selectByKind(ActionUsage) + /// + /// /// /// The subject /// @@ -136,6 +169,12 @@ internal static List ComputeNestedAction(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedAllocation = nestedUsage->selectByKind(AllocationUsage) + /// + /// /// /// The subject /// @@ -151,6 +190,12 @@ internal static List ComputeNestedAllocation(this IUsage usage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedAnalysisCase = nestedUsage->selectByKind(AnalysisCaseUsage) + /// + /// /// /// The subject /// @@ -166,6 +211,12 @@ internal static List ComputeNestedAnalysisCase(this IUsage u /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedAttribute = nestedUsage->selectByKind(AttributeUsage) + /// + /// /// /// The subject /// @@ -181,6 +232,12 @@ internal static List ComputeNestedAttribute(this IUsage usageSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedCalculation = nestedUsage->selectByKind(CalculationUsage) + /// + /// /// /// The subject /// @@ -196,6 +253,12 @@ internal static List ComputeNestedCalculation(this IUsage usa /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedCase = nestedUsage->selectByKind(CaseUsage) + /// + /// /// /// The subject /// @@ -211,6 +274,12 @@ internal static List ComputeNestedCase(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedConcern = nestedUsage->selectByKind(ConcernUsage) + /// + /// /// /// The subject /// @@ -226,6 +295,12 @@ internal static List ComputeNestedConcern(this IUsage usageSubjec /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedConnection = nestedUsage->selectByKind(ConnectorAsUsage) + /// + /// /// /// The subject /// @@ -241,6 +316,12 @@ internal static List ComputeNestedConnection(this IUsage usag /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedConstraint = nestedUsage->selectByKind(ConstraintUsage) + /// + /// /// /// The subject /// @@ -256,6 +337,12 @@ internal static List ComputeNestedConstraint(this IUsage usage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// ownedNested = nestedUsage->selectByKind(EnumerationUsage) + /// + /// /// /// The subject /// @@ -271,6 +358,12 @@ internal static List ComputeNestedEnumeration(this IUsage usa /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedFlow = nestedUsage->selectByKind(FlowConnectionUsage) + /// + /// /// /// The subject /// @@ -286,6 +379,12 @@ internal static List ComputeNestedFlow(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedInterface = nestedUsage->selectByKind(ReferenceUsage) + /// + /// /// /// The subject /// @@ -301,6 +400,12 @@ internal static List ComputeNestedInterface(this IUsage usageSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedItem = nestedUsage->selectByKind(ItemUsage) + /// + /// /// /// The subject /// @@ -316,6 +421,12 @@ internal static List ComputeNestedItem(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedMetadata = nestedUsage->selectByKind(MetadataUsage) + /// + /// /// /// The subject /// @@ -331,6 +442,12 @@ internal static List ComputeNestedMetadata(this IUsage usageSubj /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedOccurrence = nestedUsage->selectByKind(OccurrenceUsage) + /// + /// /// /// The subject /// @@ -346,6 +463,12 @@ internal static List ComputeNestedOccurrence(this IUsage usage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedPart = nestedUsage->selectByKind(PartUsage) + /// + /// /// /// The subject /// @@ -361,6 +484,12 @@ internal static List ComputeNestedPart(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedPort = nestedUsage->selectByKind(PortUsage) + /// + /// /// /// The subject /// @@ -376,6 +505,12 @@ internal static List ComputeNestedPort(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedReference = nestedUsage->selectByKind(ReferenceUsage) + /// + /// /// /// The subject /// @@ -391,6 +526,12 @@ internal static List ComputeNestedReference(this IUsage usageSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedRendering = nestedUsage->selectByKind(RenderingUsage) + /// + /// /// /// The subject /// @@ -406,6 +547,12 @@ internal static List ComputeNestedRendering(this IUsage usageSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedRequirement = nestedUsage->selectByKind(RequirementUsage) + /// + /// /// /// The subject /// @@ -421,6 +568,12 @@ internal static List ComputeNestedRequirement(this IUsage usa /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedState = nestedUsage->selectByKind(StateUsage) + /// + /// /// /// The subject /// @@ -436,6 +589,12 @@ internal static List ComputeNestedState(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedTransition = nestedUsage->selectByKind(TransitionUsage) + /// + /// /// /// The subject /// @@ -451,6 +610,12 @@ internal static List ComputeNestedTransition(this IUsage usage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedUsage = ownedFeature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -466,6 +631,12 @@ internal static List ComputeNestedUsage(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedUseCase = nestedUsage->selectByKind(UseCaseUsage) + /// + /// /// /// The subject /// @@ -481,6 +652,12 @@ internal static List ComputeNestedUseCase(this IUsage usageSubjec /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedVerificationCase = nestedUsage->selectByKind(VerificationCaseUsage) + /// + /// /// /// The subject /// @@ -496,6 +673,12 @@ internal static List ComputeNestedVerificationCase(this /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedView = nestedUsage->selectByKind(ViewUsage) + /// + /// /// /// The subject /// @@ -511,6 +694,12 @@ internal static List ComputeNestedView(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// nestedViewpoint = nestedUsage->selectByKind(ViewpointUsage) + /// + /// /// /// The subject /// @@ -556,6 +745,12 @@ internal static IUsage ComputeOwningUsage(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// usage = feature->selectByKind(Usage) + /// + /// /// /// The subject /// @@ -571,6 +766,12 @@ internal static List ComputeUsage(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// variant = variantMembership.ownedVariantUsage + /// + /// /// /// The subject /// @@ -586,6 +787,12 @@ internal static List ComputeVariant(this IUsage usageSubject) /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// variantMembership = ownedMembership->selectByKind(VariantMembership) + /// + /// /// /// The subject /// @@ -602,6 +809,16 @@ internal static List ComputeVariantMembership(this IUsage us /// If this Usage is a variant, then its naming Feature is the referencedFeature of its /// ownedReferenceSubsetting. /// + /// + /// OCL2.0: + /// + /// if not owningMembership.oclIsKindOf(VariantMembership) then + /// self.oclAsType(Feature).namingFeature() + /// else if ownedReferenceSubsetting = null then null + /// else ownedReferenceSubsetting.referencedFeature + /// endif endif + /// + /// /// /// The subject /// @@ -618,6 +835,14 @@ internal static IFeature ComputeRedefinedNamingFeatureOperation(this IUsage usag /// If ownedReferenceSubsetting is not null, return the featureTarget of the referencedFeature of the /// ownedReferenceSubsetting. /// + /// + /// OCL2.0: + /// + /// if ownedReferenceSubsetting = null then null + /// else ownedReferenceSubsetting.referencedFeature.featureTarget + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/UseCaseDefinitionExtensions.cs b/SysML2.NET/Extend/UseCaseDefinitionExtensions.cs index ee1d2716e..602ff5679 100644 --- a/SysML2.NET/Extend/UseCaseDefinitionExtensions.cs +++ b/SysML2.NET/Extend/UseCaseDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.UseCases using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,14 @@ internal static class UseCaseDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// includedUseCase = ownedUseCase-> + /// selectByKind(IncludeUseCaseUsage). + /// useCaseIncluded + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/UseCaseUsageExtensions.cs b/SysML2.NET/Extend/UseCaseUsageExtensions.cs index c278e74f1..f4416a46a 100644 --- a/SysML2.NET/Extend/UseCaseUsageExtensions.cs +++ b/SysML2.NET/Extend/UseCaseUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.UseCases using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,14 @@ internal static class UseCaseUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// includedUseCase = ownedUseCase-> + /// selectByKind(IncludeUseCaseUsage). + /// useCaseIncluded + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/VerificationCaseDefinitionExtensions.cs b/SysML2.NET/Extend/VerificationCaseDefinitionExtensions.cs index 74a0846d6..74719965e 100644 --- a/SysML2.NET/Extend/VerificationCaseDefinitionExtensions.cs +++ b/SysML2.NET/Extend/VerificationCaseDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.VerificationCases using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,18 @@ internal static class VerificationCaseDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// verifiedRequirement = + /// if objectiveRequirement = null then OrderedSet{} + /// else + /// objectiveRequirement.featureMembership-> + /// selectByKind(RequirementVerificationMembership). + /// verifiedRequirement->asOrderedSet() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/VerificationCaseUsageExtensions.cs b/SysML2.NET/Extend/VerificationCaseUsageExtensions.cs index e4b48a3ef..b71a42291 100644 --- a/SysML2.NET/Extend/VerificationCaseUsageExtensions.cs +++ b/SysML2.NET/Extend/VerificationCaseUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.VerificationCases using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,18 @@ internal static IVerificationCaseDefinition ComputeVerificationCaseDefinition(th /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// verifiedRequirement = + /// if objectiveRequirement = null then OrderedSet{} + /// else + /// objectiveRequirement.featureMembership-> + /// selectByKind(RequirementVerificationMembership). + /// verifiedRequirement->asOrderedSet() + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ViewDefinitionExtensions.cs b/SysML2.NET/Extend/ViewDefinitionExtensions.cs index adbfbbd7f..348f69124 100644 --- a/SysML2.NET/Extend/ViewDefinitionExtensions.cs +++ b/SysML2.NET/Extend/ViewDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -61,6 +63,14 @@ internal static class ViewDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// satisfiedViewpoint = ownedRequirement-> + /// selectByKind(ViewpointUsage)-> + /// select(isComposite) + /// + /// /// /// The subject /// @@ -76,6 +86,12 @@ internal static List ComputeSatisfiedViewpoint(this IViewDefini /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// view = usage->selectByKind(ViewUsage) + /// + /// /// /// The subject /// @@ -91,6 +107,14 @@ internal static List ComputeView(this IViewDefinition viewDefinition /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewCondition = ownedMembership-> + /// selectByKind(ElementFilterMembership). + /// condition + /// + /// /// /// The subject /// @@ -106,6 +130,17 @@ internal static List ComputeViewCondition(this IViewDefinition view /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewRendering = + /// let renderings: OrderedSet(ViewRenderingMembership) = + /// featureMembership->selectByKind(ViewRenderingMembership) in + /// if renderings->isEmpty() then null + /// else renderings->first().referencedRendering + /// endif + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ViewUsageExtensions.cs b/SysML2.NET/Extend/ViewUsageExtensions.cs index 8457c6db0..f8e71a04a 100644 --- a/SysML2.NET/Extend/ViewUsageExtensions.cs +++ b/SysML2.NET/Extend/ViewUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,15 @@ internal static class ViewUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// exposedElement = ownedImport->selectByKind(Expose). + /// importedMemberships(Set{}).memberElement-> + /// select(elm | includeAsExposed(elm))-> + /// asOrderedSet() + /// + /// /// /// The subject /// @@ -80,6 +90,14 @@ internal static List ComputeExposedElement(this IViewUsage viewUsageSu /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// satisfiedViewpoint = ownedRequirement-> + /// selectByKind(ViewpointUsage)-> + /// select(isComposite) + /// + /// /// /// The subject /// @@ -95,6 +113,14 @@ internal static List ComputeSatisfiedViewpoint(this IViewUsage /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewCondition = ownedMembership-> + /// selectByKind(ElementFilterMembership). + /// condition + /// + /// /// /// The subject /// @@ -125,6 +151,17 @@ internal static IViewDefinition ComputeViewDefinition(this IViewUsage viewUsageS /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewRendering = + /// let renderings: OrderedSet(ViewRenderingMembership) = + /// featureMembership->selectByKind(ViewRenderingMembership) in + /// if renderings->isEmpty() then null + /// else renderings->first().referencedRendering + /// endif + /// + /// /// /// The subject /// @@ -140,6 +177,18 @@ internal static IRenderingUsage ComputeViewRendering(this IViewUsage viewUsageSu /// /// Determine whether the given element meets all the owned and inherited viewConditions. /// + /// + /// OCL2.0: + /// + /// let metadataFeatures: Sequence(AnnotatingElement) = + /// element.ownedAnnotation.annotatingElement-> + /// select(oclIsKindOf(MetadataFeature)) in + /// self.membership->selectByKind(ElementFilterMembership). + /// condition->forAll(cond | + /// metadataFeatures->exists(elem | + /// cond.checkCondition(elem))) + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ViewpointDefinitionExtensions.cs b/SysML2.NET/Extend/ViewpointDefinitionExtensions.cs index f57c1b7dc..5058444bc 100644 --- a/SysML2.NET/Extend/ViewpointDefinitionExtensions.cs +++ b/SysML2.NET/Extend/ViewpointDefinitionExtensions.cs @@ -23,6 +23,8 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System; using System.Collections.Generic; + using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; using SysML2.NET.Core.POCO.Core.Types; @@ -62,6 +64,14 @@ internal static class ViewpointDefinitionExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewpointStakeholder = framedConcern.featureMemberhsip-> + /// selectByKind(StakeholderMembership). + /// ownedStakeholderParameter + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/ViewpointUsageExtensions.cs b/SysML2.NET/Extend/ViewpointUsageExtensions.cs index 0a37ae422..0165ae277 100644 --- a/SysML2.NET/Extend/ViewpointUsageExtensions.cs +++ b/SysML2.NET/Extend/ViewpointUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Views using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -80,6 +81,14 @@ internal static IViewpointDefinition ComputeViewpointDefinition(this IViewpointU /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// viewpointStakeholder = framedConcern.featureMemberhsip-> + /// selectByKind(StakeholderMembership). + /// ownedStakeholderParameter + /// + /// /// /// The subject /// diff --git a/SysML2.NET/Extend/WhileLoopActionUsageExtensions.cs b/SysML2.NET/Extend/WhileLoopActionUsageExtensions.cs index 1861a02ac..c89f1643b 100644 --- a/SysML2.NET/Extend/WhileLoopActionUsageExtensions.cs +++ b/SysML2.NET/Extend/WhileLoopActionUsageExtensions.cs @@ -24,6 +24,7 @@ namespace SysML2.NET.Core.POCO.Systems.Actions using System.Collections.Generic; using SysML2.NET.Core.Core.Types; + using SysML2.NET.Core.Root.Namespaces; using SysML2.NET.Core.Systems.Occurrences; using SysML2.NET.Core.POCO.Core.Classifiers; using SysML2.NET.Core.POCO.Core.Features; @@ -65,6 +66,18 @@ internal static class WhileLoopActionUsageExtensions /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// untilArgument = + /// let parameter : Feature = inputParameter(3) in + /// if parameter <> null and parameter.oclIsKindOf(Expression) then + /// parameter.oclAsType(Expression) + /// else + /// null + /// endif + /// + /// /// /// The subject /// @@ -80,6 +93,18 @@ internal static IExpression ComputeUntilArgument(this IWhileLoopActionUsage whil /// /// Computes the derived property. /// + /// + /// OCL2.0: + /// + /// whileArgument = + /// let parameter : Feature = inputParameter(1) in + /// if parameter <> null and parameter.oclIsKindOf(Expression) then + /// parameter.oclAsType(Expression) + /// else + /// null + /// endif + /// + /// /// /// The subject ///