Closed FlorianPatzerC0d3 closed 1 year ago
Hi @FlorianPatzerFraunhoferIOSB , resolution of model elements (in particular those model elements that are not defined in the same file) is done by mapping the namespace part of the URN to the file system directory structure. This is documented in Understanding the models directory structure: In order for this to work, the folder structure must look like explained there: .../com.foo.bar/1.0.0/MyModel.ttl. However, for cases where no model elements in other model files are referenced, this should still work with a different structure; for this reason I'd still consider this a bug.
The issue was fixed in the PR https://github.com/eclipse-esmf/esmf-sdk/pull/342
@ysrbo I don't think so. #342 fixed loading of legacy BAMM models, but it did not change the model resolver logic or the the FileSystemStrategy. I think loading a file from an "invalid" directory structure (i.e., an arbitrary structure that is different to com.foo.bar/1.0.0/File.ttl
) would still fail, even if it does not reference elements not defined in the same file.
Fixed by #395
It seems that samm-cli's standard resolver is not working as expected. If I use the Aspect Model Editor's Movement.ttl example as aspect, the resolution of the prefix fails. It takes the folder structure instead of the prefix definition of the Turtle file. If I call
samm aspect Movement.ttl validate
from within the folder structureTestfolder/Testsubfolder
results inorg.eclipse.esmf.aspectmodel.resolver.ModelResolutionException: The URN constructed from the input file path is invalid: urn:samm:Testfolder:Testsubfolder#Movement at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.lambda$fileToUrn$12(AspectModelResolver.java:403) at io.vavr.Value.getOrElse(Value.java:380) at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.fileToUrn(AspectModelResolver.java:402) at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.loadAndResolveModel(AspectModelResolver.java:360) at org.eclipse.esmf.AbstractCommand.loadAndResolveModel(AbstractCommand.java:53) at org.eclipse.esmf.aspect.AspectValidateCommand.run(AspectValidateCommand.java:59) at picocli.CommandLine.executeUserObject(CommandLine.java:1939) at picocli.CommandLine.access$1300(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) at org.eclipse.esmf.LoggingMixin.executionStrategy(LoggingMixin.java:41) at picocli.CommandLine.execute(CommandLine.java:2078) at org.eclipse.esmf.SammCli.main(SammCli.java:106)