DAF-Digital-Transformation-Office / PySysML2

PySysML2 is a Python-based parser for the SysML 2.0 textual modeling language. Its main purpose is to parse a SysML 2.0 textual model into a Python object, and then transform that model into various data structures useful for data science and analysis.
https://dafdto.com
Apache License 2.0
11 stars 0 forks source link

Issues Discovered While Testing PySysML2 with SysML v2 Camera Example #2

Open j-simmons-phd opened 6 days ago

j-simmons-phd commented 6 days ago

I am testing out PySysML2 with some of the examples distributed in the 2024-09 - SysML v2 Pilot Implementation release. The example I am currently working on is the Camera Example (pulled into its own repo for ease of testing).

Observations so far.

  1. PySysML2 does not appear to leverage import statements to pull in content spread across multiple files. To address this behavior, I have added a step to combine all .sysml files into a single combined file for processing with PySysML2
  2. There appear to be a number of common key words not yet implemented in PySysML2, including private, import, and perform. See the following input and output (which can be recreated by cloning the repo above and running make.sh build.

Combined SysML Input File (CombinedCameraModel.sysml)

part def Camera {
    private import PictureTaking::*;

    perform action takePicture[*] :> PictureTaking::takePicture;

    part focusingSubsystem {
        perform takePicture.focus;
    }

    part imagingSubsystem {
        perform takePicture.shoot;
    }

}package PictureTaking {
    part def Exposure;

    action def Focus { out xrsl: Exposure; }
    action def Shoot { in xsf: Exposure; }  

    action takePicture {        
        action focus: Focus[1];
        flow focus.xrsl to shoot.xsf;
        action shoot: Shoot[1];
    }
}

PySysML2 command: pysysml2 export ./dist/CombinedCameraModel.sysml --output-dir ./dist --format json,png

PySysML2 CLI Output (e.g. errors)

ANTLR runtime and generated code versions disagree: 4.10!=4.13.2
ANTLR runtime and generated code versions disagree: 4.10!=4.13.2
line 2:1 mismatched input 'private' expecting {'}', 'actor', 'attribute', 'comment', 'connection', 'connect', 'doc', 'item', 'part', 'port', 'ref', 'in', 'out', COMMENT_LONG}
line 4:1 extraneous input 'perform' expecting {<EOF>, 'actor', 'attribute', 'comment', 'connect', 'doc', 'import', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
line 4:27 token recognition error at: '[*'
line 4:29 token recognition error at: ']'
line 7:2 mismatched input 'perform' expecting {'}', 'actor', 'attribute', 'comment', 'connection', 'connect', 'doc', 'item', 'part', 'port', 'ref', 'in', 'out', COMMENT_LONG}
line 11:2 mismatched input 'perform' expecting {'}', 'actor', 'attribute', 'comment', 'connection', 'connect', 'doc', 'item', 'part', 'port', 'ref', 'in', 'out', COMMENT_LONG}
line 17:1 extraneous input 'action' expecting {'}', 'actor', 'attribute', 'comment', 'connect', 'doc', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
line 18:1 extraneous input 'action' expecting {<EOF>, 'actor', 'attribute', 'comment', 'connect', 'doc', 'import', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
line 21:21 token recognition error at: '[1]'
line 23:21 token recognition error at: '[1]'
Using output directory: /home/kasm-user/Repos/sysmlv2-camera-example-tests/dist
Exporting to JSON...
Exporting to png...