### Launch JupyterLab Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Starts the JupyterLab environment after the SysML kernel and extension have been installed. Navigate to your notebook directory first. ```bash # Navigate to notebook directory cd # Start JupyterLab jupyter lab ``` -------------------------------- ### SysML Usage Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example demonstrating usages of definitions for parts, attributes, and ports. ```sysml part def Vehicle { part engine : Engine; // Usage of Engine definition attribute mass : Real [unit = kg]; // Usage of mass attribute port dataPort : DataPort; // Usage of data port } ``` -------------------------------- ### Install Graphviz on Linux Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the Graphviz package using apt-get on Debian-based Linux distributions. This ensures Graphviz is available before Conda installation. ```bash sudo apt-get install graphviz ``` -------------------------------- ### SysML Succession Connector Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a succession connector to establish ordering relationships between actions. ```sysml action def Sequence { succession connector { end step1 to step2; end step2 to step3; } } ``` -------------------------------- ### Install Jupyter SysML Kernel (Windows) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the SysML/KerML Jupyter kernel and JupyterLab extension on Windows systems using a batch file. Ensure Java and Conda are installed and in PATH. ```cmd cd \install\jupyter install.bat ``` -------------------------------- ### Run install.sh Script (Linux/macOS) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Execute the installation script on Linux and macOS after making it executable. ```bash ./install.sh ``` -------------------------------- ### Make install.sh Executable (Linux/macOS) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Grant execute permissions to the install script on Linux and macOS before running it. ```bash chmod +x ./install.sh ``` -------------------------------- ### Complete Vehicle System Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md A comprehensive SysML v2 example defining a vehicle system, including attributes, parts, behavior, requirements, and allocations. ```sysml package VehicleSystem { // Define attribute types attribute def Mass : Real [unit = kg]; attribute def Speed : Real [unit = mps]; // Define the vehicle structure part def Vehicle { attribute mass : Mass; composite part engine : Engine; composite part wheels : Wheel[4]; } // Define a specific car part def Car specializes Vehicle { attribute maxSpeed : Speed = 200.0 [unit = mps]; } // Define behavior action def Drive { in attribute vehicle : Vehicle; in attribute distance : Real; out attribute fuelUsed : Real; } // Define requirement requirement def SpeedRequirement { doc /* * The vehicle shall achieve maximum speed * of at least 200 km/h */ subject vehicle : Vehicle; } // Allocate functions to parts allocation { allocatedFrom Drive; allocatedTo Car.engine; } } ``` -------------------------------- ### Start JupyterLab (Linux/macOS) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Launch JupyterLab from the command line. This will open in a browser window. ```bash jupyter lab ``` -------------------------------- ### Install Graphviz on macOS Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the Graphviz package using Homebrew on macOS. This is a prerequisite for some Conda installations that depend on Graphviz. ```bash brew install graphviz ``` -------------------------------- ### List Installed Conda Packages Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Lists all packages installed within the current Conda environment. Useful for verifying installations. ```bash conda list ``` -------------------------------- ### SysML Interface Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'SystemInterface' with input and output ports for data and results. ```SysML interface def SystemInterface { in port input : DataType; out port output : ResultType; } ``` -------------------------------- ### Verify Jupyter Installation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Checks the installed version of Jupyter. This is part of the overall installation verification process. ```bash jupyter --version ``` -------------------------------- ### Install Jupyter SysML Kernel (Linux/macOS) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the SysML/KerML Jupyter kernel and JupyterLab extension on Linux and macOS systems. Ensure Java and Conda are installed and in PATH. ```bash # Navigate to install directory cd /install/jupyter # Make script executable chmod +x ./install.sh # Run installation ./install.sh ``` -------------------------------- ### SysML Action Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining an 'action' for 'SystemOperation' with input and output attributes, and a placeholder for action steps. ```SysML action def SystemOperation { in attribute input : InputData; out attribute output : OutputData; // action steps } ``` -------------------------------- ### Project Structure Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Illustrates a typical project directory layout for SysML/KerML models, including organization by type and purpose. ```text MyProject/ ├── models/ │ ├── infrastructure/ │ │ ├── Types.kerml │ │ ├── Behaviors.kerml │ │ └── Utilities.kerml │ ├── components/ │ │ ├── Component1.sysml │ │ ├── Component2.sysml │ │ └── Interfaces.kerml │ ├── requirements/ │ │ ├── Functional.sysml │ │ ├── NonFunctional.sysml │ │ └── Constraints.sysml │ └── main.sysml ├── notebooks/ │ ├── analysis.ipynb │ └── visualization.ipynb └── README.md ``` -------------------------------- ### SysML Package Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Illustrates how to define a custom package named 'MySystemModel' and a standard library package named 'StandardLibrary'. ```SysML package MySystemModel { // package members } ``` ```SysML standard library StandardLibrary { // normative library definitions } ``` -------------------------------- ### SysML State Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'state' for 'OperatingState' with nested states: Running, Idle, and Stopped. ```SysML state def OperatingState { state def Running; state def Idle; state def Stopped; } ``` -------------------------------- ### SysML Binding Connector Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a binding connector to link system properties to external interfaces. ```sysml part def System { binding connector { end system.property to interface.port; } } ``` -------------------------------- ### Multi-file Package Organization Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Example structure for organizing SysML models across multiple files, including metadata and configuration files. ```text library/ ├── .meta.json # Metadata index ├── .project.json # Project config ├── Infrastructure.sysml # Core types ├── Components.sysml # Component library ├── Behaviors.sysml # Behavior definitions └── Utilities.sysml # Helper functions ``` -------------------------------- ### Verify Jupyter Kernel Installation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Lists all installed Jupyter kernels to confirm that the 'sysml' kernel is present. ```bash jupyter kernelspec list ``` -------------------------------- ### Install Graphviz via Conda Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the Graphviz package using Conda after it has been installed via the system package manager. This ensures Conda recognizes the dependency. ```bash conda install graphviz -c conda-forge -y ``` -------------------------------- ### Check Java Version Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Verify the installed Java version. This command works on Linux, macOS, and Windows. ```bash java -version ``` -------------------------------- ### SysML Extends Specialization Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of specializing a part definition using 'extends'. ```sysml part def SpecificCar specializes Vehicle { // extends Vehicle with additional features } ``` -------------------------------- ### SysML Port Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'DataPort' with input and output attributes for messages and responses. ```SysML port def DataPort { in attribute data : Message; out attribute response : Response; } ``` -------------------------------- ### Jupyter Installation Script (Windows) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/01-overview.md This snippet shows the batch script for installing the Jupyter kernel and extension on Windows. It is used for interactive SysML/KerML modeling within a Jupyter environment. ```batch install.bat ``` -------------------------------- ### Navigate to Notebook Directory (Linux/macOS) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Change the current directory to your notebook root directory before starting JupyterLab. ```bash cd ``` -------------------------------- ### KerML Example: Address Book Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Demonstrates basic KerML syntax for defining types, associations, and instances, suitable for learning fundamental modeling concepts. ```kerml package AddressBook { // Define a Person type type Person { name: String; age: Integer; } // Define an association between Person and Person association PersonToPerson { from: Person; to: Person; label: "knows"; } // Create instances of Person instance alice: Person { name = "Alice"; age = 30; } instance bob: Person { name = "Bob"; age = 25; } // Establish an association instance instance aliceKnowsBob: PersonToPerson { source = alice; target = bob; } } ``` -------------------------------- ### Accessing and Parsing Example Models in Jupyter Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Demonstrates how to load, display, parse, and query SysML/KerML models from within a Jupyter notebook using Python and magic commands. ```python # Load and display model with open('kerml/src/examples/Address Book Example/AddressBookModel.kerml', 'r') as f: model_text = f.read() print(model_text) # Parse in kernel %parse model_text # Analyze structure %query select * from Model where type='class' ``` -------------------------------- ### Start JupyterLab on Alternative Port Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Starts JupyterLab using an alternative port (e.g., 8889) if the default port (8888) is already in use. ```bash jupyter lab --port 8889 ``` -------------------------------- ### SysML Subsets Specialization Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of specializing a part definition using 'subsets'. ```sysml part def Subsystem specializes ParentSystem { attribute specificProperty : Type subsets ParentSystem.property; } ``` -------------------------------- ### SysML Constraint Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a weight limit constraint. ```sysml constraint def WeightLimit { in attribute weight : Mass; in attribute maxAllowed : Mass; assert weight <= maxAllowed; } ``` -------------------------------- ### SysML Multiplicity Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example demonstrating the use of multiplicity constraints on parts and attributes. ```sysml part def Container { part items : Item[0..*]; // 0 or more items attribute name : String[1]; // exactly 1 name reference parent : Container[0..1]; // optional parent } ``` -------------------------------- ### Command-Line Validation Tools Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Examples of using command-line tools to validate different SysML model formats: textual, XMI, and KPAR. ```bash # Validate textual model %validate my-model.kerml # Validate XMI model %validate my-model.kermlx # Validate KPAR contents %validate my-library.kpar ``` -------------------------------- ### SysML Allocation Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining an allocation to link requirements to structural elements. ```sysml allocation def PerformanceAllocation { allocatedFrom requirement : FunctionalReq; allocatedTo part : Component; } ``` -------------------------------- ### Install SysML Components in Custom Environment Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the SysML kernel, JupyterLab, and other necessary components into a custom Conda environment. This is part of setting up a custom environment. ```bash conda install "jupyter-sysml-kernel=0.59.0" python jupyterlab graphviz nodejs -c conda-forge -y jupyter labextension install "@systems-modeling/jupyterlab-sysml@0.59.0" python /install/jupyter/install.py ``` -------------------------------- ### Jupyter Installation Script (Python) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/01-overview.md This snippet shows the Python script for installing the Jupyter kernel and extension. It is used for interactive SysML/KerML modeling within a Jupyter environment. ```python install.py ``` -------------------------------- ### SysML Flow Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'flow' for 'Transmission' with input 'source' and output 'target' items. ```SysML flow def Transmission { in item source; out item target; } ``` -------------------------------- ### SysML Example: Requirement Definition Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Shows how to define a SysML Requirement, including its ID, text, and verification criteria. Use for specifying system needs. ```sysml package Requirements { import SysML.Requirement; // Define a specific requirement requirement REQ_001 : Requirement { id = "REQ-001"; text = "The system shall provide a user interface."; verifiedBy = verifyUI; } // Define a verification method action verifyUI { // ... verification steps ... } } ``` -------------------------------- ### List Conda Environments Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Displays all Conda environments available on the system, useful for verifying the Python environment setup. ```bash conda env list ``` -------------------------------- ### SysML Example: Part Definition Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Demonstrates defining a SysML Part, which represents an instance of a type within a system structure. Use for component modeling. ```sysml package SystemStructure { import SysML.Part; import SysML.Port; import SysML.InterfaceBlock; // Define a type for a communication interface interfaceBlock NetworkInterface { port dataIn: Port; port dataOut: Port; } // Define a part representing a network card part networkCard : NetworkInterface { // ... specific configuration ... } } ``` -------------------------------- ### Jupyter Installation Script Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/01-overview.md This snippet shows the shell script for installing the Jupyter kernel and extension. It is used for interactive SysML/KerML modeling within a Jupyter environment. ```shell install.sh ``` -------------------------------- ### SysML Connection Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'connection' for 'PhysicalConnection' with two item ends, 'part1' and 'part2'. ```SysML connection def PhysicalConnection { end part1 : Item; end part2 : Item; } ``` -------------------------------- ### SysML v2 KPAR MANIFEST.MF Format Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Example content of the MANIFEST.MF file within a KPAR archive, providing metadata about the packaged library. ```properties Manifest-Version: 1.0 Implementation-Title: SysML Library Implementation-Version: 1.0 Created-Date: 2025-03-13T00:00:00Z Metamodel-Version: https://www.omg.org/spec/SysML/20250201 ``` -------------------------------- ### SysML Attribute Definition Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Shows how to define attributes for Mass, Temperature with units, and Location with a multiplicity constraint. ```SysML attribute def Mass : Real; ``` ```SysML attribute def Temperature : Real [unit = Celsius]; ``` ```SysML attribute def Location : Position [0..*]; ``` -------------------------------- ### SysML Individual Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a specific 'individual' instance 'MyVehicle' of type 'Vehicle', setting its ID and mass. ```SysML individual def MyVehicle : Vehicle { :>> id = 12345; :>> mass = 1500 [kg]; } ``` -------------------------------- ### Feature Modifiers Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Examples demonstrating the usage of various feature modifiers like derived, composite, portion, var, const, abstract, in, out, and inout. ```kerml derived attribute total : Real = a + b; composite part engine : Engine; portion attribute slice : Data; var attribute counter : Integer; const attribute PI : Real = 3.14159; abstract operation : Behavior; in attribute parameter : Type; out attribute result : Type; inout attribute data : Type; ``` -------------------------------- ### SysML Flow Connector Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a flow connector to represent the transfer of items, energy, or data. ```sysml part def FlowSystem { flow connector { end source : Component.output to sink : Component.input; } } ``` -------------------------------- ### UTF-8 Encoding Example in Kerml Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Example demonstrating the support for UTF-8 characters in Kerml textual format, including non-ASCII characters in type and attribute names. ```kerml // UTF-8 characters supported type 'Élément français' { attribute 'propriété' : String; } ``` -------------------------------- ### SysML v2 KPAR File Structure Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Example directory structure for a KPAR (SysML Packaged) file, which is a compressed archive for distributing model libraries. ```bash MyLibrary.kpar ├── META-INF/ │ └── MANIFEST.MF ├── content/ │ ├── base.kerml │ ├── types.kerml │ └── functions.kerml ├── .meta.json └── .project.json ``` -------------------------------- ### SysML Collection Expressions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Examples of expressions operating on collections, such as select and sum. ```sysml attribute selected : Item[*] = items->select(x | x.active); attribute total : Real = items->sum(x | x.value); ``` -------------------------------- ### SysML Enumeration Definition Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Provides examples for defining an enumeration for 'Color' with RED, GREEN, BLUE, and 'Status' with ACTIVE, INACTIVE, SUSPENDED. ```SysML enum def Color { RED; GREEN; BLUE; } ``` ```SysML enum def Status { ACTIVE; INACTIVE; SUSPENDED; } ``` -------------------------------- ### SysML v2 XMI Derived Properties Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Illustrates the difference between base and derived properties in XMI format. Derived properties are included only in the complete XMI variant. ```xml ``` -------------------------------- ### SysML Example: State Machine Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Illustrates the definition of a SysML State Machine to model the behavior of a system or component over time. Use for dynamic modeling. ```sysml package StateMachines { import SysML.StateMachine; import SysML.State; import SysML.Transition; import SysML.Trigger; // Define a state machine for a device stateMachine DeviceBehavior : StateMachine { state InitialState : State; state Running : State; state Stopped : State; // Transitions between states transition ToRunning : Transition { from = InitialState; to = Running; trigger = StartTrigger; } transition ToStopped : Transition { from = Running; to = Stopped; trigger = StopTrigger; } // Define triggers for transitions trigger StartTrigger; trigger StopTrigger; } } ``` -------------------------------- ### Install Conda Packages from Local Cache Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs packages from a local package cache on an offline system. The '--offline' flag ensures only local packages are used. ```bash conda install --offline --no-deps ``` -------------------------------- ### Kerml Import Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/02-kerml-grammar.md Imports elements or all elements from other namespaces. Use to make elements from other packages available in the current scope. ```kerml namespace MyPackage { private import OtherPackage::ElementName; public import AnotherPackage ::*; public import all OtherPackage ::*; } ``` -------------------------------- ### Repository Structure Overview Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/01-overview.md This snippet outlines the directory structure of the sysml-v2-release repository, indicating the location of official specification documents, grammar definitions, example models, and normative libraries. ```text sysml-v2-release/ ├── doc/ # Official specification documents (PDF) │ ├── 1-Kernel_Modeling_Language.pdf │ ├── 2a-OMG_Systems_Modeling_Language.pdf │ ├── 2b-SysML_v1_to_v2_Transformation.pdf │ ├── 3-Systems_Modeling_API_and_Services.pdf │ ├── Intro to SysML v2 Language-Textual Notation.pdf │ ├── Intro to SysML v2 Language-Graphical Notation.pdf │ └── images/ ├── bnf/ # Grammar specifications │ ├── KerML-textual-bnf.kebnf # KerML textual syntax (1467 lines) │ ├── SysML-textual-bnf.kebnf # SysML textual syntax (1705 lines) │ ├── SysML-graphical-bnf.kgbnf # SysML graphical syntax (2264 lines) │ ├── KerML-textual-bnf.html │ ├── SysML-textual-bnf.html │ ├── SysML-graphical-bnf.html │ ├── bnf_styles.css │ └── images/ ├── kerml/ # KerML example models │ └── src/examples/ │ ├── Address Book Example/ │ ├── Association Examples/ │ ├── Behavior Examples/ │ ├── Individuals Examples/ │ ├── KerML Spec Annex A Examples/ │ └── Mass Roll-up Example/ ├── sysml/ # SysML example models │ └── src/examples/ ├── sysml.library/ # Normative model libraries (textual) │ ├── Domain Libraries/ │ │ ├── Analysis/ │ │ ├── Cause and Effect/ │ │ ├── Geometry/ │ │ ├── Metadata/ │ │ ├── Quantities and Units/ │ │ └── Requirement Derivation/ │ └── Kernel Libraries/ │ ├── Kernel Data Type Library/ │ ├── Kernel Function Library/ │ ├── Kernel Semantic Library/ │ └── Systems Library/ ├── sysml.library.xmi/ # Normative libraries (XMI format, without derived properties) ├── sysml.library.xmi.implied/ # Normative libraries (XMI format, with derived properties) ├── sysml.library.kpar/ # Normative libraries (KerML Project Archive format) ├── install/ # Installation tools │ ├── jupyter/ # Jupyter kernel and extension installer │ │ ├── install.sh │ │ ├── install.bat │ │ ├── install.py │ │ └── README.adoc │ └── eclipse/ # Eclipse plugins installer ├── bnf/ # BNF grammar definitions └── README.md ``` -------------------------------- ### Integrate External Analysis Tooling Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/04-standard-library.md Example of integrating an external analysis tool by defining metadata for tool execution, including tool name and URI. ```sysml import Analysis::AnalysisTooling; part def SimulatedSystem { metadata ToolExecution { toolName = "MATLAB"; uri = "http://matlab.local/model"; } } ``` -------------------------------- ### References in KerML Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Examples of defining references in KerML, including simple, multiple, optional, and refined references. ```kerml reference refName : TargetType; reference refName : TargetType [1..*]; reference refName : TargetType [0..1]; reference refName : TargetType subsets parent; ``` -------------------------------- ### KerML Example: Vehicle Mass Roll-up Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Illustrates how to model hierarchical structures and calculate derived properties, useful for engineering analysis and system composition. ```kerml package VehicleMass { // Base type for a component with mass type MassComponent { mass: ScalarValue; } // Specific vehicle types inheriting from MassComponent type Engine : MassComponent { mass = 150.0 'kg'; } type Wheel : MassComponent { mass = 20.0 'kg'; } // A Vehicle is composed of other components type Vehicle { engine: Engine; wheels: Collection[Wheel]; // Derived feature for total mass derived totalMass: ScalarValue { value = engine.mass + sum(wheels.mass); } } // Instance of a vehicle instance myCar: Vehicle { engine = new Engine{}; wheels = [new Wheel{}, new Wheel{}, new Wheel{}, new Wheel{}]; } } ``` -------------------------------- ### Check Conda Version Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/install/jupyter/README.adoc Verify the installed Conda version. This command works on Linux, macOS, and Windows. ```bash conda --version ``` -------------------------------- ### Basic Initial Character Definition Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/bnf/KerML-textual-bnf.html Defines the allowed characters for the start of a basic name: an alphabetic character or an underscore. ```bnf BASIC_INITIAL_CHARACTER = [ALPHABETIC_CHARACTER](#ALPHABETIC_CHARACTER_) | '_' ``` -------------------------------- ### SysML Requirement Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a performance requirement for a system. ```sysml requirement def PerformanceReq { subject system; doc /* * The system shall achieve minimum response time */ attribute responseTime : Real; attribute maxAllowed : Real; } ``` -------------------------------- ### Project File Structure Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/README.md Illustrates the directory structure of the SysML v2 release documentation. This helps in understanding the organization of different documentation files. ```text output/ ├── INDEX.md # Navigation hub ├── 01-overview.md # Architecture overview ├── 02-kerml-grammar.md # KerML syntax reference ├── 03-sysml-grammar.md # SysML syntax reference ├── 04-standard-library.md # Type library reference ├── 05-installation-configuration.md # Setup guide ├── 06-example-models.md # Examples and patterns ├── 07-model-formats.md # File format specs ├── 08-quick-reference.md # Syntax quick reference └── README.md # This file ``` -------------------------------- ### SysML Redefines Specialization Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of specializing a part definition using 'redefines'. ```sysml part def EnhancedCar specializes Vehicle { attribute engine : ImprovedEngine redefines Vehicle.engine; } ``` -------------------------------- ### JupyterLab Notebook Tracker Configuration Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Example JSON configuration for JupyterLab's notebook tracker. This snippet shows how to enable line numbers, code folding, and set font properties for code cells. ```json { "@jupyterlab/notebook-extension:tracker": { "codeCellConfig": { "lineNumbers": true, "codeFolding": true, "fontSize": 14, "fontFamily": "monospace" } } } ``` -------------------------------- ### SysML-Specific Declarations and Usage Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/INDEX.md Illustrates SysML syntax for defining parts, requirements, and actions, as well as their usage and allocation. Refer to 03-sysml-grammar.md for full syntax. ```sysml // Definition part def Component { ... } requirement def Requirement { ... } action def Behavior { ... } // Usage part component : ComponentDef; // Allocation allocation { allocatedFrom A; allocatedTo B; } ``` -------------------------------- ### SysML v2 Textual Metadata (.meta.json) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Example JSON structure for metadata associated with textual SysML v2 models, including element indexing and creation information. ```json { "index": { "ElementName": "ElementName.sysml", "OtherElement": "OtherElement.sysml" }, "created": "2025-03-13T00:00:00Z", "metamodel": "https://www.omg.org/spec/SysML/20250201" } ``` -------------------------------- ### SysML Concern Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a performance concern with metric and priority. ```sysml concern def PerformanceConcern { attribute metric : String; attribute priority : String; } ``` -------------------------------- ### Create KPAR File (macOS/Linux) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Command to create a KPAR file using standard zip tools on macOS or Linux. It archives the library content and metadata. ```bash cd library-directory zip -r MyLibrary.kpar content/ META-INF/ .meta.json .project.json ``` -------------------------------- ### SysML Item Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining an 'item' for an 'Engine' with attributes for displacement and fuel type. ```SysML item def Engine { attribute displacement : Real; attribute fuelType : String; } ``` -------------------------------- ### SysML Occurrence Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining an 'occurrence' for a 'Vehicle' with attributes for ID, mass, and velocity. ```SysML occurrence def Vehicle { attribute id : Integer [1..1]; attribute mass : Mass; attribute velocity : Real; } ``` -------------------------------- ### Import All from Package Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/04-standard-library.md Imports all elements from a specified package, making them publicly available. ```sysml public import Parts::*; ``` -------------------------------- ### Basic Data Modeling with KerML Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Demonstrates basic class definitions, attributes with types, collections with multiplicity, and package structure. Use for foundational data modeling scenarios. ```kerml private import ScalarValues::*; package AddressBookModel { class Entry { name: String; address: String; } class AddressBook { entries: Entry[*]; } } ``` -------------------------------- ### Install Jupyter SysML Kernel Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Installs the 'jupyter-sysml-kernel' package from the conda-forge channel. The '-y' flag automatically confirms prompts. ```bash conda install "jupyter-sysml-kernel=0.59.0" -c conda-forge -y ``` -------------------------------- ### SysML Calculation Definition Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of defining a 'calc' function 'Distance' that calculates the Euclidean distance between two points. ```SysML calc def Distance(x1 : Real, y1 : Real, x2 : Real, y2 : Real) : Real { return sqrt((x2-x1)^2 + (y2-y1)^2); } ``` -------------------------------- ### Documentation Annotation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Using the 'doc' keyword to introduce documentation blocks for elements. ```kerml doc /* * This documents the following element */ ``` -------------------------------- ### Download Conda Packages for Offline Installation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Downloads specified Conda packages and their dependencies without installing them. These packages can then be transferred to an offline system. ```bash conda install --download-only "jupyter-sysml-kernel=0.59.0" \ python=3.10 jupyterlab graphviz nodejs -c conda-forge ``` -------------------------------- ### Import Standard Libraries in SysML Model Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Demonstrates how to import core SysML and KerML libraries, including quantities, into a SysML model. This allows access to predefined types and elements. ```sysml // Import from standard library public import Items.*; public import Parts.*; public import Ports.*; public import Quantities::SI; package MyModel { part def Component :> Part { attribute mass : Real [unit = kilogram]; } } ``` -------------------------------- ### Cross-File References in SysML Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Demonstrates how to reference types and definitions from different SysML files within a multi-file package structure. ```kerml // In Components.sysml package Components { private import Infrastructure::*; part def MyComponent { // Uses types from Infrastructure } } // In Behaviors.sysml package Behaviors { private import Infrastructure::*; private import Components::*; action def ComponentOperation { // Uses types from Components } } ``` -------------------------------- ### Analyzing Models with Standard Library Functions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Imports collections and control functions, then defines a 'DataSet' class with derived 'count' and 'selected' features. ```kerml private import Collections::*; private import ControlFunctions::*; class DataSet { items: Item[*]; derived count: Integer = items->size(); derived selected: Item[*] = items->select(x | x.active); } ``` -------------------------------- ### SysML Invocation Expressions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Examples of expressions involving function or method invocations. ```sysml attribute distance : Real = sqrt(x1*x1 + y1*y1); attribute result : Real = calculate(input1, input2); ``` -------------------------------- ### Define an Action with Input and Output Attributes Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/04-standard-library.md Defines an 'Action' as an executable behavior with specified input and output attributes. ```kerml action def Action { // Executable behavior in attribute input; out attribute output; } ``` -------------------------------- ### SysML Feature Reference Expressions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Examples of expressions referencing other features for calculations. ```sysml attribute total : Real = item1.weight + item2.weight; attribute name : String = self.label; ``` -------------------------------- ### Documentation in Kerml Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Shows how to add multi-line documentation blocks and inline comments to types and properties. ```kerml package DocumentedTypes { doc /* * Clear documentation of purpose and usage. * Can span multiple lines. */ type MyType { property: String; // Inline comments also supported } } ``` -------------------------------- ### SysML Literal Expressions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Examples of literal expressions for various data types. ```sysml attribute count : Integer = 5; attribute active : Boolean = true; attribute message : String = "Hello"; attribute temperature : Real = 25.5; ``` -------------------------------- ### SysML Conditional Expressions Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/03-sysml-grammar.md Example of a conditional expression to determine an attribute's value. ```sysml attribute status : String = if condition then "Active" else "Inactive"; ``` -------------------------------- ### Succession as Usage Textual Notation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/bnf/SysML-textual-bnf.html Defines the textual syntax for using a succession, linking a first and then connector end. ```bnf SuccessionAsUsage = [UsagePrefix](#UsagePrefix) ( 'succession' [UsageDeclaration](#UsageDeclaration) )? 'first' s.ownedRelationship += [ConnectorEndMember](#ConnectorEndMember) 'then' s.ownedRelationship += [ConnectorEndMember](#ConnectorEndMember) [UsageBody](#UsageBody) ``` -------------------------------- ### Allocation Usage Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Creating an instance of an allocation relationship. ```sysml allocation { allocatedFrom functionalReq; allocatedTo systemComponent; } ``` -------------------------------- ### Import Syntax Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Syntax for importing elements from other packages, including single, wildcard, recursive, and all imports. ```kerml private import Package::Element; public import Package::*; public import Package::**; public import all Package::*; ``` -------------------------------- ### Collection Operations Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/08-quick-reference.md Operations for manipulating collections, including getting size, filtering, mapping, and accessing elements. ```kerml count : Integer = items->size(); // Collection size selected : Item[*] = items->select(x | x.active); // Filter mapped : Real[*] = items->collect(x | x.value); // Map first : Item = items->first(); // First element isEmpty : Boolean = items->isEmpty(); // Check empty contains : Boolean = items->contains(item); // Check contains ``` -------------------------------- ### Library Imports in Kerml Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Demonstrates different visibility levels for importing libraries: private, public, and protected. ```kerml private import BaseLibrary::*; public import StandardTypes::*; protected import InternalTypes::*; ``` -------------------------------- ### Kerml Expression Examples Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/02-kerml-grammar.md Assigns literal values to attributes. Use for initializing features with constant or default values. ```kerml attribute total : Real = 100.5; attribute flag : Boolean = true; attribute message : String = "Hello World"; ``` -------------------------------- ### Single Line Note Definition Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/bnf/KerML-textual-bnf.html Defines the syntax for single-line comments, which start with '//' followed by line text. ```bnf SINGLE_LINE_NOTE = '//' [LINE_TEXT](#LINE_TEXT_) ``` -------------------------------- ### Port Usage Textual Notation Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/bnf/SysML-textual-bnf.html Defines the textual syntax for using a port. ```bnf PortUsage = [OccurrenceUsagePrefix](#OccurrenceUsagePrefix) 'port' [Usage](#Usage) ``` -------------------------------- ### Create KPAR File (Windows PowerShell) Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/07-model-formats.md Command to create a KPAR file using PowerShell on Windows. It archives the library content and metadata. ```powershell Compress-Archive -Path content, META-INF, .meta.json, .project.json \ -DestinationPath MyLibrary.kpar ``` -------------------------------- ### Define a Port with Input and Output Attributes Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/04-standard-library.md Defines a 'Port' as an interaction point with specified input and output attributes. ```kerml port def Port { // Interaction point with direction in attribute input; out attribute output; } ``` -------------------------------- ### Build JupyterLab Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Rebuilds the JupyterLab application to apply changes from installed extensions or themes. This command clears the cache and recompiles assets. ```bash jupyter lab build ``` -------------------------------- ### Kerml Feature Declaration Example Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/02-kerml-grammar.md Declares attributes and references within a type. Use for defining the properties and relationships of a model element. ```kerml type Car { attribute weight : Real; composite attribute engine : Engine; derived attribute totalMass : Real; reference manufacturer : Organization; } ``` -------------------------------- ### Reinstall JupyterLab SysML Extension Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/05-installation-configuration.md Uninstalls and then reinstalls the '@systems-modeling/jupyterlab-sysml' extension. This is useful for resolving issues with the extension not loading. ```bash jupyter labextension uninstall @systems-modeling/jupyterlab-sysml jupyter labextension install "@systems-modeling/jupyterlab-sysml@0.59.0" ``` -------------------------------- ### Parsing Models with Jupyter Kernel Source: https://github.com/systems-modeling/sysml-v2-release/blob/master/_autodocs/06-example-models.md Shows how to use the `%parse` magic command within a Jupyter cell to parse a SysML model file. ```bash # With Jupyter kernel jupyter lab # Create cell with: %parse AddressBookModel.kerml ```