sysmlpy 0.77.0__tar.gz → 0.79.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/PKG-INFO +83 -60
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/README.md +82 -59
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/pyproject.toml +1 -1
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/__init__.py +6 -3
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/definition.py +126 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/formatting.py +17 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/store.py +205 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/usage.py +57 -8
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/LICENSE +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/__main__.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/README.md +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Parser.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr_parser.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/antlr_visitor.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/boxes_view.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/diff.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/evaluator.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/examples/attribute_values.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/examples/part_attributes.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/examples/tuples_sequences.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/README.md +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/desc.xml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/examples/camera.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/examples/toaster-system.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/antlr4/pom.xml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/grammar/classes.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/interchange.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/LICENSE +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/README.md +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/__init__.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Analysis/SampledFunctions.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Analysis/TradeStudies.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Geometry/ShapeItems.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Geometry/SpatialItems.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Metadata/ImageMetadata.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Metadata/RiskMetadata.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQ.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/Quantities.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/SI.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/Time.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Base.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/BaseFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/BooleanFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Clocks.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/CollectionFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Collections.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/ComplexFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/ControlFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/ControlPerformances.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/DataFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/IntegerFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/KerML.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Links.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Metaobjects.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/NaturalFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/NumericalFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Objects.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Observation.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/OccurrenceFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Occurrences.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Performances.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/RationalFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/RealFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/ScalarFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/ScalarValues.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/SequenceFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/SpatialFrames.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/StatePerformances.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/StringFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Transfers.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/TransitionPerformances.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/TrigFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/Triggers.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/VectorFunctions.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/kernel/VectorValues.kerml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Actions.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Allocations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/AnalysisCases.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Attributes.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Calculations.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Cases.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Connections.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Constraints.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Flows.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Interfaces.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Items.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Metadata.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Parts.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Ports.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Requirements.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/StandardViewDefinitions.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/States.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/SysML.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/UseCases.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/VerificationCases.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/library/systems/Views.sysml +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/lsp/__init__.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/lsp/__main__.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/lsp/protocol.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/lsp/server.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/lsp/stdio.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/navigate.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/plantuml.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/project.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/semantic.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/sim.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/spreadsheet.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/traceability.py +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/us_customary_units.txt +0 -0
- {sysmlpy-0.77.0 → sysmlpy-0.79.0}/src/sysmlpy/validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sysmlpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.79.0
|
|
4
4
|
Summary:
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Author: Jon R. Fox (mycr0ft)
|
|
@@ -45,23 +45,19 @@ and dropped the textX parser in favor of [an ANTLR4 parser grammar](https://gith
|
|
|
45
45
|
changed our unit library to pint.
|
|
46
46
|
The project had diverged so much from sysml2py that a new name, sysmlpy, was selected.
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
>
|
|
57
|
-
>
|
|
58
|
-
|
|
59
|
-
>
|
|
60
|
-
>
|
|
61
|
-
> unit checks) runs only when you call `analyze(model)` explicitly.
|
|
62
|
-
> Multiplication/division dimension *derivation* (inferring
|
|
63
|
-
> `[N]` from `[kg] * [m/s^2]`) is not yet implemented. See
|
|
64
|
-
> [STATUS.md §Known Issues](STATUS.md#known-issues).
|
|
48
|
+
**What you get**: full SysML v2 parsing (ANTLR4, 123/123 OMG XPect
|
|
49
|
+
conformance), round-trip `dump()`, a semantic analyzer with 31 rule
|
|
50
|
+
codes (name resolution, type/unit-checked expressions, OCL
|
|
51
|
+
well-formedness), 17 PlantUML views + Java-free boxes rendering,
|
|
52
|
+
state-machine simulation, Excel export, a `sysmlpy diff` semantic
|
|
53
|
+
model differ, and graph storage backends (memory / NetworkX / Kùzu /
|
|
54
|
+
Cayley).
|
|
55
|
+
|
|
56
|
+
> **Scope note** — a green parse result means the file **parsed
|
|
57
|
+
> syntactically**. Expression validation (name resolution, type,
|
|
58
|
+
> unit, and dimension checks) runs when you call `analyze(model)`.
|
|
59
|
+
> Expression validation also derives dimensions through `*` and `/`
|
|
60
|
+
> (`[N]` inferred from `[kg] * [m/s^2]`, v0.75.0).
|
|
65
61
|
|
|
66
62
|
For release history, see [CHANGELOG.md](CHANGELOG.md).
|
|
67
63
|
|
|
@@ -88,6 +84,50 @@ Multiple installation methods are supported by sysmlpy, including:
|
|
|
88
84
|
|  | PyPI | ``python -m pip install sysmlpy[cayley]`` (with Cayley graph DB) |
|
|
89
85
|
|  | GitHub | ``python -m pip install https://github.com/mycr0ft/sysmlpy/archive/refs/heads/main.zip`` |
|
|
90
86
|
|
|
87
|
+
## Command-Line Tools
|
|
88
|
+
|
|
89
|
+
sysmlpy ships a CLI (`sysmlpy`, plus `sysmlpy-lsp` for editor support).
|
|
90
|
+
Exit codes: `0` = success/clean, `1` = findings at/above the failure
|
|
91
|
+
threshold or operational error, `2` = parse/load failure — so
|
|
92
|
+
`analyze` and `diff` drop straight into CI pipelines.
|
|
93
|
+
|
|
94
|
+
| Command | Purpose |
|
|
95
|
+
|---------|---------|
|
|
96
|
+
| `sysmlpy parse <file>` | Parse a file and print a representation |
|
|
97
|
+
| `sysmlpy analyze <file...>` | Semantic analysis; CI-friendly exit codes |
|
|
98
|
+
| `sysmlpy diff <old> <new>` | Semantic model diff (text/markdown/json) |
|
|
99
|
+
| `sysmlpy view <file>` | Render a PlantUML / Markdown / HTML view |
|
|
100
|
+
| `sysmlpy format <file...>` | Pretty-print (canonicalize) SysML files (alias `fmt`) |
|
|
101
|
+
| `sysmlpy trace <file>` | Requirement traceability & verification coverage |
|
|
102
|
+
| `sysmlpy export <file>` | Export to the JSON interchange format |
|
|
103
|
+
| `sysmlpy import <file>` | Import a JSON interchange document as SysML text |
|
|
104
|
+
| `sysmlpy eval <file>` | Evaluate expressions, attribute values, constraints |
|
|
105
|
+
| `sysmlpy sim <file>` | Simulate a state machine (guards evaluated for real) |
|
|
106
|
+
| `sysmlpy xlsx <file>` | Export tabular views to an Excel workbook |
|
|
107
|
+
| `sysmlpy-lsp` | Language server (stdio) for SysML v2 editors |
|
|
108
|
+
|
|
109
|
+
Examples:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# CI gate: fail the build when analysis finds errors (threshold via --fail-on)
|
|
113
|
+
sysmlpy analyze model.sysml
|
|
114
|
+
|
|
115
|
+
# What changed between two revisions?
|
|
116
|
+
sysmlpy diff old.sysml new.sysml --format markdown > changes.md
|
|
117
|
+
|
|
118
|
+
# Canonicalize a model in place, and render a BDD-style view
|
|
119
|
+
sysmlpy format model.sysml
|
|
120
|
+
sysmlpy view model.sysml --view sv > model.puml
|
|
121
|
+
|
|
122
|
+
# Drive a state machine interactively
|
|
123
|
+
sysmlpy sim traffic_light.sysml
|
|
124
|
+
|
|
125
|
+
# Excel workbook of the tabular views
|
|
126
|
+
sysmlpy xlsx bill_of_materials.sysml -o bom.xlsx
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Every subcommand accepts `--help` for its own flags.
|
|
130
|
+
|
|
91
131
|
## Documentation
|
|
92
132
|
|
|
93
133
|
Documentation can be found [here.](https://mycr0ft.github.io/sysmlpy/)
|
|
@@ -130,36 +170,8 @@ for child in sensor:
|
|
|
130
170
|
"camera" in sensor # → True
|
|
131
171
|
```
|
|
132
172
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
part <'3.1'> Stage_1 {
|
|
136
|
-
attribute mass= 100 [kilogram];
|
|
137
|
-
attribute thrust= 1199.0 [newton];
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
The package is able to handle Items, Parts, and Attributes.
|
|
142
|
-
|
|
143
|
-
```python
|
|
144
|
-
a = Part(name='camera')
|
|
145
|
-
b = Item(name='lens')
|
|
146
|
-
d = Attribute(name='mass')
|
|
147
|
-
c = Part(name='sensor')
|
|
148
|
-
c.add_child(a)
|
|
149
|
-
c.add_child(b)
|
|
150
|
-
a.add_child(d)
|
|
151
|
-
print(c.dump())
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
will return:
|
|
155
|
-
```
|
|
156
|
-
part sensor {
|
|
157
|
-
part camera {
|
|
158
|
-
attribute mass;
|
|
159
|
-
}
|
|
160
|
-
item lens;
|
|
161
|
-
}
|
|
162
|
-
```
|
|
173
|
+
`print(sensor.dump())` renders the SysML text shown above:
|
|
174
|
+
`part sensor { part camera { attribute mass= 100[kilogram]; } item lens; }`.
|
|
163
175
|
|
|
164
176
|
Actions
|
|
165
177
|
-------
|
|
@@ -268,10 +280,11 @@ len(model) # → number of direct children
|
|
|
268
280
|
print(str(model))
|
|
269
281
|
# → package Vehicle { ... }
|
|
270
282
|
|
|
271
|
-
# Typed property accessors
|
|
272
|
-
|
|
273
|
-
model.
|
|
274
|
-
model.
|
|
283
|
+
# Typed property accessors (available on packages and usage elements;
|
|
284
|
+
# a Model root exposes .packages, package nodes expose .parts, etc.)
|
|
285
|
+
model.packages # direct Package children of the model root
|
|
286
|
+
pkg = model.find_one("Vehicle")
|
|
287
|
+
pkg.parts # direct Part children (definitions and usages)
|
|
275
288
|
```
|
|
276
289
|
|
|
277
290
|
All search methods accept `sysml_type=` (keyword string or class) and `recursive=`:
|
|
@@ -341,9 +354,9 @@ model = loads("""
|
|
|
341
354
|
part def Engine;
|
|
342
355
|
}
|
|
343
356
|
package Vehicle {
|
|
344
|
-
import Types::*;
|
|
345
|
-
part myCar : Engine;
|
|
346
|
-
part myWheel : Wheel;
|
|
357
|
+
private import Types::*;
|
|
358
|
+
part myCar : Engine; // resolved via import
|
|
359
|
+
part myWheel : Wheel; // undefined!
|
|
347
360
|
}
|
|
348
361
|
""")
|
|
349
362
|
|
|
@@ -397,6 +410,11 @@ The analyzer resolves three import patterns with visibility enforcement:
|
|
|
397
410
|
|
|
398
411
|
### OCL Well-Formedness Checks
|
|
399
412
|
|
|
413
|
+
The analyzer implements **31 rule codes** in total (severity-tagged
|
|
414
|
+
`error`/`warning`), spanning OCL well-formedness, state machines,
|
|
415
|
+
requirements, traceability, connectors, and unit-dimension checks —
|
|
416
|
+
see [STATUS.md](STATUS.md) for the complete catalogue. Highlights:
|
|
417
|
+
|
|
400
418
|
| Code | Rule | Description |
|
|
401
419
|
|------|------|-------------|
|
|
402
420
|
| `DUPLICATE_NAME` | Namespace.duplicate_names | No two members may share the same name in a scope |
|
|
@@ -523,16 +541,21 @@ centrality = store.centrality()
|
|
|
523
541
|
store.export_graphml("model.graphml")
|
|
524
542
|
```
|
|
525
543
|
|
|
526
|
-
**Running Cayley with Docker:**
|
|
544
|
+
**Running Cayley with Podman or Docker:**
|
|
527
545
|
|
|
528
546
|
```bash
|
|
529
|
-
#
|
|
530
|
-
|
|
547
|
+
# Simplest (tested): persistent BoltDB inside the container
|
|
548
|
+
podman run -d --name cayley -p 64210:64210 docker.io/cayleygraph/cayley
|
|
531
549
|
|
|
532
|
-
#
|
|
533
|
-
docker run -p 64210:64210
|
|
550
|
+
# Docker equivalents
|
|
551
|
+
docker run -p 64210:64210 --rm cayley/cayley # in-memory backend
|
|
552
|
+
docker run -p 64210:64210 -v /data:/data --rm cayley/cayley \
|
|
553
|
+
-db boltdb -dbpath /data/cayley.db # persistent
|
|
534
554
|
```
|
|
535
555
|
|
|
556
|
+
Stored subjects are label-namespaced (`<label>:<element_id>`), so
|
|
557
|
+
several stores can share one server without query bleed.
|
|
558
|
+
|
|
536
559
|
**Quad Model:** Elements are stored as quads where the subject is the element UUID, predicates are property names (e.g., `name`, `sysml_type`), and objects are property values. Relationships are stored as quads where the predicate is the relationship type (e.g., `parent_child`, `typed_by`). Labels provide namespace isolation for multi-tenant scenarios.
|
|
537
560
|
|
|
538
561
|
## PlantUML Visualizations
|
|
@@ -14,23 +14,19 @@ and dropped the textX parser in favor of [an ANTLR4 parser grammar](https://gith
|
|
|
14
14
|
changed our unit library to pint.
|
|
15
15
|
The project had diverged so much from sysml2py that a new name, sysmlpy, was selected.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>
|
|
26
|
-
>
|
|
27
|
-
|
|
28
|
-
>
|
|
29
|
-
>
|
|
30
|
-
> unit checks) runs only when you call `analyze(model)` explicitly.
|
|
31
|
-
> Multiplication/division dimension *derivation* (inferring
|
|
32
|
-
> `[N]` from `[kg] * [m/s^2]`) is not yet implemented. See
|
|
33
|
-
> [STATUS.md §Known Issues](STATUS.md#known-issues).
|
|
17
|
+
**What you get**: full SysML v2 parsing (ANTLR4, 123/123 OMG XPect
|
|
18
|
+
conformance), round-trip `dump()`, a semantic analyzer with 31 rule
|
|
19
|
+
codes (name resolution, type/unit-checked expressions, OCL
|
|
20
|
+
well-formedness), 17 PlantUML views + Java-free boxes rendering,
|
|
21
|
+
state-machine simulation, Excel export, a `sysmlpy diff` semantic
|
|
22
|
+
model differ, and graph storage backends (memory / NetworkX / Kùzu /
|
|
23
|
+
Cayley).
|
|
24
|
+
|
|
25
|
+
> **Scope note** — a green parse result means the file **parsed
|
|
26
|
+
> syntactically**. Expression validation (name resolution, type,
|
|
27
|
+
> unit, and dimension checks) runs when you call `analyze(model)`.
|
|
28
|
+
> Expression validation also derives dimensions through `*` and `/`
|
|
29
|
+
> (`[N]` inferred from `[kg] * [m/s^2]`, v0.75.0).
|
|
34
30
|
|
|
35
31
|
For release history, see [CHANGELOG.md](CHANGELOG.md).
|
|
36
32
|
|
|
@@ -57,6 +53,50 @@ Multiple installation methods are supported by sysmlpy, including:
|
|
|
57
53
|
|  | PyPI | ``python -m pip install sysmlpy[cayley]`` (with Cayley graph DB) |
|
|
58
54
|
|  | GitHub | ``python -m pip install https://github.com/mycr0ft/sysmlpy/archive/refs/heads/main.zip`` |
|
|
59
55
|
|
|
56
|
+
## Command-Line Tools
|
|
57
|
+
|
|
58
|
+
sysmlpy ships a CLI (`sysmlpy`, plus `sysmlpy-lsp` for editor support).
|
|
59
|
+
Exit codes: `0` = success/clean, `1` = findings at/above the failure
|
|
60
|
+
threshold or operational error, `2` = parse/load failure — so
|
|
61
|
+
`analyze` and `diff` drop straight into CI pipelines.
|
|
62
|
+
|
|
63
|
+
| Command | Purpose |
|
|
64
|
+
|---------|---------|
|
|
65
|
+
| `sysmlpy parse <file>` | Parse a file and print a representation |
|
|
66
|
+
| `sysmlpy analyze <file...>` | Semantic analysis; CI-friendly exit codes |
|
|
67
|
+
| `sysmlpy diff <old> <new>` | Semantic model diff (text/markdown/json) |
|
|
68
|
+
| `sysmlpy view <file>` | Render a PlantUML / Markdown / HTML view |
|
|
69
|
+
| `sysmlpy format <file...>` | Pretty-print (canonicalize) SysML files (alias `fmt`) |
|
|
70
|
+
| `sysmlpy trace <file>` | Requirement traceability & verification coverage |
|
|
71
|
+
| `sysmlpy export <file>` | Export to the JSON interchange format |
|
|
72
|
+
| `sysmlpy import <file>` | Import a JSON interchange document as SysML text |
|
|
73
|
+
| `sysmlpy eval <file>` | Evaluate expressions, attribute values, constraints |
|
|
74
|
+
| `sysmlpy sim <file>` | Simulate a state machine (guards evaluated for real) |
|
|
75
|
+
| `sysmlpy xlsx <file>` | Export tabular views to an Excel workbook |
|
|
76
|
+
| `sysmlpy-lsp` | Language server (stdio) for SysML v2 editors |
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# CI gate: fail the build when analysis finds errors (threshold via --fail-on)
|
|
82
|
+
sysmlpy analyze model.sysml
|
|
83
|
+
|
|
84
|
+
# What changed between two revisions?
|
|
85
|
+
sysmlpy diff old.sysml new.sysml --format markdown > changes.md
|
|
86
|
+
|
|
87
|
+
# Canonicalize a model in place, and render a BDD-style view
|
|
88
|
+
sysmlpy format model.sysml
|
|
89
|
+
sysmlpy view model.sysml --view sv > model.puml
|
|
90
|
+
|
|
91
|
+
# Drive a state machine interactively
|
|
92
|
+
sysmlpy sim traffic_light.sysml
|
|
93
|
+
|
|
94
|
+
# Excel workbook of the tabular views
|
|
95
|
+
sysmlpy xlsx bill_of_materials.sysml -o bom.xlsx
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Every subcommand accepts `--help` for its own flags.
|
|
99
|
+
|
|
60
100
|
## Documentation
|
|
61
101
|
|
|
62
102
|
Documentation can be found [here.](https://mycr0ft.github.io/sysmlpy/)
|
|
@@ -99,36 +139,8 @@ for child in sensor:
|
|
|
99
139
|
"camera" in sensor # → True
|
|
100
140
|
```
|
|
101
141
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
part <'3.1'> Stage_1 {
|
|
105
|
-
attribute mass= 100 [kilogram];
|
|
106
|
-
attribute thrust= 1199.0 [newton];
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The package is able to handle Items, Parts, and Attributes.
|
|
111
|
-
|
|
112
|
-
```python
|
|
113
|
-
a = Part(name='camera')
|
|
114
|
-
b = Item(name='lens')
|
|
115
|
-
d = Attribute(name='mass')
|
|
116
|
-
c = Part(name='sensor')
|
|
117
|
-
c.add_child(a)
|
|
118
|
-
c.add_child(b)
|
|
119
|
-
a.add_child(d)
|
|
120
|
-
print(c.dump())
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
will return:
|
|
124
|
-
```
|
|
125
|
-
part sensor {
|
|
126
|
-
part camera {
|
|
127
|
-
attribute mass;
|
|
128
|
-
}
|
|
129
|
-
item lens;
|
|
130
|
-
}
|
|
131
|
-
```
|
|
142
|
+
`print(sensor.dump())` renders the SysML text shown above:
|
|
143
|
+
`part sensor { part camera { attribute mass= 100[kilogram]; } item lens; }`.
|
|
132
144
|
|
|
133
145
|
Actions
|
|
134
146
|
-------
|
|
@@ -237,10 +249,11 @@ len(model) # → number of direct children
|
|
|
237
249
|
print(str(model))
|
|
238
250
|
# → package Vehicle { ... }
|
|
239
251
|
|
|
240
|
-
# Typed property accessors
|
|
241
|
-
|
|
242
|
-
model.
|
|
243
|
-
model.
|
|
252
|
+
# Typed property accessors (available on packages and usage elements;
|
|
253
|
+
# a Model root exposes .packages, package nodes expose .parts, etc.)
|
|
254
|
+
model.packages # direct Package children of the model root
|
|
255
|
+
pkg = model.find_one("Vehicle")
|
|
256
|
+
pkg.parts # direct Part children (definitions and usages)
|
|
244
257
|
```
|
|
245
258
|
|
|
246
259
|
All search methods accept `sysml_type=` (keyword string or class) and `recursive=`:
|
|
@@ -310,9 +323,9 @@ model = loads("""
|
|
|
310
323
|
part def Engine;
|
|
311
324
|
}
|
|
312
325
|
package Vehicle {
|
|
313
|
-
import Types::*;
|
|
314
|
-
part myCar : Engine;
|
|
315
|
-
part myWheel : Wheel;
|
|
326
|
+
private import Types::*;
|
|
327
|
+
part myCar : Engine; // resolved via import
|
|
328
|
+
part myWheel : Wheel; // undefined!
|
|
316
329
|
}
|
|
317
330
|
""")
|
|
318
331
|
|
|
@@ -366,6 +379,11 @@ The analyzer resolves three import patterns with visibility enforcement:
|
|
|
366
379
|
|
|
367
380
|
### OCL Well-Formedness Checks
|
|
368
381
|
|
|
382
|
+
The analyzer implements **31 rule codes** in total (severity-tagged
|
|
383
|
+
`error`/`warning`), spanning OCL well-formedness, state machines,
|
|
384
|
+
requirements, traceability, connectors, and unit-dimension checks —
|
|
385
|
+
see [STATUS.md](STATUS.md) for the complete catalogue. Highlights:
|
|
386
|
+
|
|
369
387
|
| Code | Rule | Description |
|
|
370
388
|
|------|------|-------------|
|
|
371
389
|
| `DUPLICATE_NAME` | Namespace.duplicate_names | No two members may share the same name in a scope |
|
|
@@ -492,16 +510,21 @@ centrality = store.centrality()
|
|
|
492
510
|
store.export_graphml("model.graphml")
|
|
493
511
|
```
|
|
494
512
|
|
|
495
|
-
**Running Cayley with Docker:**
|
|
513
|
+
**Running Cayley with Podman or Docker:**
|
|
496
514
|
|
|
497
515
|
```bash
|
|
498
|
-
#
|
|
499
|
-
|
|
516
|
+
# Simplest (tested): persistent BoltDB inside the container
|
|
517
|
+
podman run -d --name cayley -p 64210:64210 docker.io/cayleygraph/cayley
|
|
500
518
|
|
|
501
|
-
#
|
|
502
|
-
docker run -p 64210:64210
|
|
519
|
+
# Docker equivalents
|
|
520
|
+
docker run -p 64210:64210 --rm cayley/cayley # in-memory backend
|
|
521
|
+
docker run -p 64210:64210 -v /data:/data --rm cayley/cayley \
|
|
522
|
+
-db boltdb -dbpath /data/cayley.db # persistent
|
|
503
523
|
```
|
|
504
524
|
|
|
525
|
+
Stored subjects are label-namespaced (`<label>:<element_id>`), so
|
|
526
|
+
several stores can share one server without query bleed.
|
|
527
|
+
|
|
505
528
|
**Quad Model:** Elements are stored as quads where the subject is the element UUID, predicates are property names (e.g., `name`, `sysml_type`), and objects are property values. Relationships are stored as quads where the predicate is the relationship type (e.g., `parent_child`, `typed_by`). Labels provide namespace isolation for multi-tenant scenarios.
|
|
506
529
|
|
|
507
530
|
## PlantUML Visualizations
|
|
@@ -34,7 +34,7 @@ __all__ = [
|
|
|
34
34
|
"render_state_transition_view_svg", "boxes_view",
|
|
35
35
|
]
|
|
36
36
|
__author__ = "Jon Fox"
|
|
37
|
-
__version__ = "0.
|
|
37
|
+
__version__ = "0.79.0"
|
|
38
38
|
|
|
39
39
|
from sysmlpy.usage import (
|
|
40
40
|
Item, Attribute, Part, Port, Action, Reference, UseCase, Requirement, Interface, Message,
|
|
@@ -243,8 +243,11 @@ def load_partial(text):
|
|
|
243
243
|
partial, errors = _parse_with_recovery(source)
|
|
244
244
|
if errors:
|
|
245
245
|
raise PartialParseError(errors, partial, source)
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
# Success path returns a real Model (matching the docstring and
|
|
247
|
+
# load()); before v0.78.0 this returned a RootNamespace grammar
|
|
248
|
+
# object by mistake.
|
|
249
|
+
from sysmlpy.definition import Model
|
|
250
|
+
return Model()._load_definition(partial["ownedRelationship"])
|
|
248
251
|
|
|
249
252
|
|
|
250
253
|
def load(fp) -> Model:
|
|
@@ -117,6 +117,7 @@ class Model(Searchable):
|
|
|
117
117
|
p = Package().load_from_grammar(
|
|
118
118
|
PackageGrammar(de["ownedRelatedElement"])
|
|
119
119
|
)
|
|
120
|
+
p.parent = self
|
|
120
121
|
self.children.append(p)
|
|
121
122
|
member_grammar.append(p._get_definition(child="PackageBody"))
|
|
122
123
|
elif found_package:
|
|
@@ -164,6 +165,7 @@ class Model(Searchable):
|
|
|
164
165
|
p = Package().load_from_grammar(
|
|
165
166
|
PackageGrammar(synthetic_definition)
|
|
166
167
|
)
|
|
168
|
+
p.parent = self
|
|
167
169
|
self.children.append(p)
|
|
168
170
|
member_grammar.append(p._get_definition(child="PackageBody"))
|
|
169
171
|
else:
|
|
@@ -429,6 +431,130 @@ class Model(Searchable):
|
|
|
429
431
|
return path
|
|
430
432
|
return None
|
|
431
433
|
|
|
434
|
+
def resolve_types(self) -> int:
|
|
435
|
+
"""Resolve every usage's declared type name to its definition object.
|
|
436
|
+
|
|
437
|
+
``loads()`` preserves the *declared type name* on usages
|
|
438
|
+
(``usage.typed_by_name``), but the resolved definition *object*
|
|
439
|
+
(``usage.typedby``) is only set when the model is wired
|
|
440
|
+
programmatically via ``set_type()`` / ``set_typed_by()``. This
|
|
441
|
+
pass closes that gap: it indexes every definition in the model
|
|
442
|
+
(by simple name and by ``::``-qualified namespace path) and
|
|
443
|
+
links each usage's typing to the matching definition object.
|
|
444
|
+
|
|
445
|
+
Returns
|
|
446
|
+
-------
|
|
447
|
+
int
|
|
448
|
+
The number of usages resolved by this call.
|
|
449
|
+
|
|
450
|
+
Notes
|
|
451
|
+
-----
|
|
452
|
+
- Library typings (e.g. ``ScalarValues::Real``) match no
|
|
453
|
+
definition in the model and are left untouched —
|
|
454
|
+
:func:`~sysmlpy.analyze` already reports those as unresolved.
|
|
455
|
+
- Names that resolve to no definition are left untouched.
|
|
456
|
+
- An ambiguous simple name (same definition name in several
|
|
457
|
+
packages) resolves to the definition in the usage's own
|
|
458
|
+
package when one exists, otherwise to the first definition
|
|
459
|
+
in document order.
|
|
460
|
+
- Resolution is idempotent: already-linked elements are
|
|
461
|
+
skipped, and a second call returns ``0``.
|
|
462
|
+
- ``Reference``-kind elements store the link in ``ref_type``
|
|
463
|
+
(mirroring ``set_type``); other usages store it in
|
|
464
|
+
``typedby``. Serialization is unaffected either way —
|
|
465
|
+
``dump()`` output is identical before and after resolution.
|
|
466
|
+
"""
|
|
467
|
+
# ---- index definitions -------------------------------------
|
|
468
|
+
by_qualified = {} # "Pkg::Engine" -> definition
|
|
469
|
+
by_simple = {} # "Engine" -> [definitions in doc order]
|
|
470
|
+
pkg_paths = {} # id(package) -> qualified name parts
|
|
471
|
+
|
|
472
|
+
def _index(elem, path):
|
|
473
|
+
for child in getattr(elem, "children", []) or []:
|
|
474
|
+
name = getattr(child, "name", None)
|
|
475
|
+
is_package = getattr(child, "sysml_type", None) == "package"
|
|
476
|
+
is_definition = getattr(child, "is_definition", False)
|
|
477
|
+
if not (is_package or is_definition):
|
|
478
|
+
continue
|
|
479
|
+
if not name:
|
|
480
|
+
_index(child, path)
|
|
481
|
+
continue
|
|
482
|
+
child_path = path + [name]
|
|
483
|
+
by_qualified.setdefault("::".join(child_path), child)
|
|
484
|
+
by_simple.setdefault(name, []).append(child)
|
|
485
|
+
if is_package:
|
|
486
|
+
pkg_paths[id(child)] = child_path
|
|
487
|
+
_index(child, child_path)
|
|
488
|
+
|
|
489
|
+
_index(self, [])
|
|
490
|
+
|
|
491
|
+
def _lookup(type_name, packages):
|
|
492
|
+
"""Resolve a declared type name to a definition.
|
|
493
|
+
|
|
494
|
+
Tries the name as an absolute qualified path first, then as
|
|
495
|
+
a path relative to each enclosing package (nearest first) —
|
|
496
|
+
``Types::Wheel`` declared inside package ``Vehicle`` matches
|
|
497
|
+
``Vehicle::Types::Wheel``.
|
|
498
|
+
"""
|
|
499
|
+
if "::" in type_name:
|
|
500
|
+
hit = by_qualified.get(type_name)
|
|
501
|
+
if hit is not None:
|
|
502
|
+
return hit
|
|
503
|
+
parts = type_name.split("::")
|
|
504
|
+
for pkg in reversed(packages):
|
|
505
|
+
prefix = pkg_paths.get(id(pkg), [])
|
|
506
|
+
hit = by_qualified.get("::".join(prefix + parts))
|
|
507
|
+
if hit is not None:
|
|
508
|
+
return hit
|
|
509
|
+
return None
|
|
510
|
+
if "." in type_name:
|
|
511
|
+
# Feature-chain (dotted) names are not type paths.
|
|
512
|
+
return None
|
|
513
|
+
candidates = by_simple.get(type_name, [])
|
|
514
|
+
if len(candidates) == 1:
|
|
515
|
+
return candidates[0]
|
|
516
|
+
if len(candidates) > 1:
|
|
517
|
+
# Prefer the definition in the usage's own package
|
|
518
|
+
# (nearest enclosing scope), else first in doc order.
|
|
519
|
+
for pkg in reversed(packages):
|
|
520
|
+
for cand in candidates:
|
|
521
|
+
if getattr(cand, "parent", None) is pkg:
|
|
522
|
+
return cand
|
|
523
|
+
return candidates[0]
|
|
524
|
+
return None
|
|
525
|
+
|
|
526
|
+
# ---- link usages --------------------------------------------
|
|
527
|
+
resolved = 0
|
|
528
|
+
|
|
529
|
+
def _walk(elem, packages):
|
|
530
|
+
nonlocal resolved
|
|
531
|
+
for child in getattr(elem, "children", []) or []:
|
|
532
|
+
type_name = getattr(child, "_typed_by_name", None)
|
|
533
|
+
if type_name and not isinstance(type_name, str):
|
|
534
|
+
type_name = None
|
|
535
|
+
if type_name:
|
|
536
|
+
has_typedby = hasattr(child, "typedby")
|
|
537
|
+
has_ref = hasattr(child, "ref_type")
|
|
538
|
+
already = (
|
|
539
|
+
(has_typedby and child.typedby is not None)
|
|
540
|
+
or (has_ref and child.ref_type is not None)
|
|
541
|
+
)
|
|
542
|
+
if not already:
|
|
543
|
+
target = _lookup(type_name, packages)
|
|
544
|
+
if target is not None:
|
|
545
|
+
if has_ref:
|
|
546
|
+
child.ref_type = target
|
|
547
|
+
if has_typedby:
|
|
548
|
+
child.typedby = target
|
|
549
|
+
resolved += 1
|
|
550
|
+
child_packages = packages
|
|
551
|
+
if getattr(child, "sysml_type", None) == "package":
|
|
552
|
+
child_packages = packages + [child]
|
|
553
|
+
_walk(child, child_packages)
|
|
554
|
+
|
|
555
|
+
_walk(self, [])
|
|
556
|
+
return resolved
|
|
557
|
+
|
|
432
558
|
|
|
433
559
|
class Package(Searchable):
|
|
434
560
|
"""SysML v2 Package. Exposes typed accessors and ``find()`` / ``all()``
|
|
@@ -44,4 +44,21 @@ def reformat(model):
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def classtree(model):
|
|
47
|
+
"""Convert a model into a dumpable RootNamespace tree.
|
|
48
|
+
|
|
49
|
+
Accepts:
|
|
50
|
+
- a visitor grammar dict (historical input shape, e.g. from
|
|
51
|
+
``load_grammar(text)``),
|
|
52
|
+
- a public-API ``Model`` from ``loads(text)`` — its ``.grammar``
|
|
53
|
+
is already a ``RootNamespace`` and is returned directly.
|
|
54
|
+
|
|
55
|
+
``tree.dump()`` then renders SysML text. Passing a ``Model``
|
|
56
|
+
used to raise ``TypeError``; the README/TUTORIAL documented the
|
|
57
|
+
Model form, so it is now supported (v0.78.0).
|
|
58
|
+
"""
|
|
59
|
+
if isinstance(model, dict):
|
|
60
|
+
return RootNamespace(model)
|
|
61
|
+
grammar = getattr(model, "grammar", None)
|
|
62
|
+
if grammar is not None and grammar.__class__.__name__ == "RootNamespace":
|
|
63
|
+
return grammar
|
|
47
64
|
return RootNamespace(model)
|