Coder Social home page Coder Social logo

Comments (9)

mhrimaz avatar mhrimaz commented on July 2, 2024 1

@lenaxus You are right.
the root cause is on this line probably.
@FrankSchnicke Maybe a deep copy and then removing the extra submodelelements would be a quick fix. I can try to fix it if no one is going to do.

from basyx-java-server-sdk.

mhrimaz avatar mhrimaz commented on July 2, 2024 1

@FrankSchnicke you can assign it to me, I will raise a PR.

from basyx-java-server-sdk.

FrankSchnicke avatar FrankSchnicke commented on July 2, 2024 1

The issue is fixed and a new SNAPSHOT version was uploaded to DockerHub. Thanks again for pointing this out!

from basyx-java-server-sdk.

mhrimaz avatar mhrimaz commented on July 2, 2024

However, what would be your suggestion for deep cloning? AAS4j doesn't offer any copy constructor, nor override clone method. I think there should be such a feature, when mutation is allowed and the structure is so complex. It will be difficult to keep track of these mutations.
So now the easy approach would be to serialize to JSON, and get back a new object again, which is not the most efficient way.

from basyx-java-server-sdk.

FrankSchnicke avatar FrankSchnicke commented on July 2, 2024

Thank you very much for pointing out this issue.

@mhrimaz : Currently the only way of creating a deep copy is serialization and deserialization, e.g., to JSON. However, we're planning on adding a deep copy function to AAS4J. Would you like to raise a PR? Otherwise, we will take a look at this and fix it.

from basyx-java-server-sdk.

FrankSchnicke avatar FrankSchnicke commented on July 2, 2024

@mhrimaz are you still interested in doing this PR? If yes, can you estimate until when the PR will be available?

from basyx-java-server-sdk.

mhrimaz avatar mhrimaz commented on July 2, 2024

@FrankSchnicke Yes.
Submodel to Json serialization was clear, but I am looking for a way to serialize json to Submodel. (for deep cloning)
If you have a hint here, I appreciate it, otherwise, I have to look in other places in the code to find a way for it.

from basyx-java-server-sdk.

FrankSchnicke avatar FrankSchnicke commented on July 2, 2024

You can use the readReferable method of AAS4J for this.

from basyx-java-server-sdk.

mhrimaz avatar mhrimaz commented on July 2, 2024

Exactly tried that:

Submodel submodelDeepCopy = new JsonDeserializer().readReferable(submodelAsJSON, Submodel.class);

but getting an error:

com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve subtype of [simple type, class org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement]: missing type id property 'modelType' (for POJO property 'submodelElements')

However, I am pretty sure my payload is correct, but I have to debug it further to spot the problem.

from basyx-java-server-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.