Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
128 stars 24 forks source link

ST6RI-594: Cannot resolve names in the lastly loaded resource in Jupyter #398

Closed himi closed 2 years ago

himi commented 2 years ago

The approach I took to resolve ST6RI-594 is using a dummy resource as a context to get the global scope. A dummy resource is created with a bogus URI (new ResourceImpl(URI.createURI("dummy"))) to prevent local file lookups. SysMLInteractive.resolve() uses it for scopeProvider.getScope() to avoid exclusions from the local context.

I made a change how to create a Xtext resource by injecting xtextResourceFactory (createNonPersistentXtextResource). The previous code relies on suffix matching and might make a problem in resource creations.

Also I created a getter for resouceSet, getResourceSet() in SysMLUtil. So I made resourceSet private and I needed to modify KerML2XMI.createOutputResources().

I also made SysMLUtil.addResourceToIndex() public for other programs to put resources into the index.

seidewitz commented 2 years ago

The bug proposed to be addressed by this PR has not yet been confirmed.