eclipse-esmf / esmf-sdk

Load Aspect Models and their artifacts as Java code; share components to realize SAMM as code
https://eclipse-esmf.github.io/esmf-developer-guide/index.html
Mozilla Public License 2.0
25 stars 12 forks source link

[BUG] Model Resolution fails somewhere on the RDF-Level #381

Closed arnoweiss closed 1 year ago

arnoweiss commented 1 year ago

Describe the bug RIOT fails to read Aspect Model file.

Where AspectModelResolver with the FileSystemStrategy.

Screenshots Stacktrace:

Connected to the target VM, address: '127.0.0.1:49049', transport: 'socket'
2023-07-05 11:34:22 [WARN] Encountered legacy BAMM Aspect Model URN: urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned. Support for urn:bamm: will be removed! (org.eclipse.esmf.aspectmodel.urn.AspectModelUrn)
2023-07-05 11:34:26 [WARN] Encountered legacy BAMM Aspect Model URN: urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned. Support for urn:bamm: will be removed! (org.eclipse.esmf.aspectmodel.urn.AspectModelUrn)

java.lang.NoSuchMethodError: 'long[] org.apache.commons.codec.digest.MurmurHash3.hash128x64(byte[])'

    at org.apache.jena.riot.lang.BlankNodeAllocatorHash.alloc(BlankNodeAllocatorHash.java:138)
    at org.apache.jena.riot.lang.BlankNodeAllocatorHash.create(BlankNodeAllocatorHash.java:111)
    at org.apache.jena.riot.lang.LabelToNode$Alloc.create(LabelToNode.java:187)
    at org.apache.jena.riot.lang.LabelToNode$Alloc.create(LabelToNode.java:178)
    at org.apache.jena.riot.system.MapWithScope.create(MapWithScope.java:86)
    at org.apache.jena.riot.system.FactoryRDFStd.createBlankNode(FactoryRDFStd.java:97)
    at org.apache.jena.riot.system.ParserProfileStd.createBlankNode(ParserProfileStd.java:220)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesBlankNode(LangTurtleBase.java:495)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesNodeCompound(LangTurtleBase.java:484)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesNode(LangTurtleBase.java:469)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesList(LangTurtleBase.java:530)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesNodeCompound(LangTurtleBase.java:488)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesNode(LangTurtleBase.java:469)
    at org.apache.jena.riot.lang.LangTurtleBase.objectList(LangTurtleBase.java:419)
    at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectItem(LangTurtleBase.java:352)
    at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectList(LangTurtleBase.java:345)
    at org.apache.jena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:314)
    at org.apache.jena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:178)
    at org.apache.jena.riot.lang.LangTurtle.oneTopLevelElement(LangTurtle.java:46)
    at org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:79)
    at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:43)
    at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:186)
    at org.apache.jena.riot.RDFParser.read(RDFParser.java:366)
    at org.apache.jena.riot.RDFParser.parseNotUri(RDFParser.java:356)
    at org.apache.jena.riot.RDFParser.parse(RDFParser.java:306)
    at org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:552)
    at org.apache.jena.riot.RDFDataMgr.parseFromInputStream(RDFDataMgr.java:718)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:253)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:235)
    at org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:69)
    at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:253)
    at org.eclipse.esmf.aspectmodel.resolver.services.TurtleLoader.loadTurtle(TurtleLoader.java:63)
    at io.vavr.control.Try.flatMapTry(Try.java:490)
    at io.vavr.control.Try.flatMap(Try.java:472)
    at org.eclipse.esmf.aspectmodel.resolver.AbstractResolutionStrategy.loadFromUrl(AbstractResolutionStrategy.java:50)
    at org.eclipse.esmf.aspectmodel.resolver.AbstractResolutionStrategy.loadFromUri(AbstractResolutionStrategy.java:37)
    at org.eclipse.esmf.aspectmodel.resolver.FileSystemStrategy.apply(FileSystemStrategy.java:76)
    at org.eclipse.esmf.aspectmodel.resolver.FileSystemStrategy.apply(FileSystemStrategy.java:33)
    at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.getModelForUrn(AspectModelResolver.java:311)
    at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.resolve(AspectModelResolver.java:242)
    at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.resolveAspectModel(AspectModelResolver.java:170)
    at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.resolveAspectModel(AspectModelResolver.java:157)
    at org.eclipse.esmf.aspectmodel.resolver.AspectModelResolver.resolveAspectModel(AspectModelResolver.java:115)
    at com.sap.btp.ica.cxe2e.CxAasStarter.<init>(CxAasStarter.java:28)
    at com.sap.btp.ica.cxe2e.CxAasStarterTest.generateSmt(CxAasStarterTest.java:12)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
    at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Disconnected from the target VM, address: '127.0.0.1:49049', transport: 'socket'

Process finished with exit code 255

Additional context The base-directory for file resolution points to the top-level of the semantic models. I am getting the same error with urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned. Using ESMF-SDK 2.2.0.

RaMisess commented 1 year ago

Unfortunately, just from the stack trace, without additional information, it is difficult to understand which scenario led to the error. But from the hints I was able to divine, I tested with the latest version of the SDK (2.2.3), trying several operations which load and resolve models (such as "validate" command of the samm-cli), on the semantic model mentioned, with both the jar version and the native (Windows) version of the samm-cli but was not able to reproduce the error. All the operations I tried succeeded. To be able to further investigate the issue, we would need additional details, especially the OS the operation was executed on and more details as to the nature of the operation itself - from the stack trace it looks like an attempt to run unit tests - can the exact unit test causing the error be provided for investigation?

arnoweiss commented 1 year ago

Thanks for the answer! Have you tried reproducing with the models and repository linked at the very bottom?

Additional context The base-directory for file resolution points to the top-level of the semantic models. I am getting the same error with urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned. Using ESMF-SDK 2.2.0.

RaMisess commented 1 year ago

Yes.

arnoweiss commented 1 year ago
    @Test
    void loadModel() {
        final ResolutionStrategy fileSystemStrategy = new FileSystemStrategy( Path.of(BASE_DIR) );
        final Try<VersionedModel> tryModel = new AspectModelResolver().resolveAspectModel( fileSystemStrategy,
                AspectModelUrn.fromUrn( ASPECT_URN) );
        System.out.println(tryModel.get());
    }

BASE_DIR is the path of sldt-semantic-models ASPECT_URN "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" JDK: 17.0.7-sapmchn DIST: Ubuntu 22.04.2 LTS

Issue persists with esmf-sdk 2.2.3.

atextor commented 1 year ago

Hi @arnoweiss, I also can't reproduce the problem. I have prepared a minimal standalone demo project that (1) checks out the sldt-semantic-models repository, then (2) runs a unit test similar to yours, that loads the PartAsPlanned BAMM Aspect Model and asserts success:

https://github.com/atextor/esmf-sdk-bamm-resolution-demo

Clone the repo and run mvn clean test.

It uses esmf-sdk 2.2.3 (but it also works with the latest version, 2.3.1). Loading the model works using both Adoptium/Temurin JDK (17.0.8) and SAP Machine JDK (17.0.7).

Therefore I'll close the issue now; feel free to reopen if necessary.

arnoweiss commented 1 year ago

For some reason the https://github.com/atextor/esmf-sdk-bamm-resolution-demo works. No idea why. I've forked the repo and finished my project - so thanks!