Comments (3)
If we go for mixed-type equality, can we assure that all (future) implementation of an interface like Property
will behave in the same expected way or is this up to the developer of each of those classes? If we can't ensure this, might this be a problem?
Does this even require major effort on our site to implement/support this as we only provide a single implementation of each interface?
In general I like the idea of allowing mixed-types equality but only if it makes sense and we don't find major downsides (besides complexity).
One potential downside I can think of is that currently the model code, i.e. also the equals methods, are auto-generated by our generator tool and I am not sure if such a complex pattern could also be auto-generated.
RelationshipElement
and AnnotatedRelationshipElement
are a special case and I guess an instance of AnnotatedRelationshipElement
should never be considered equal to an instance of RelationshipElement
. Reasoning is, that if you follow through with this logic you should also consider an empty Property
equal to an empty Range
element because both are instances of SubmodelElement
and in this case they would ne differ in attributes.
from aas4j.
If we go for mixed-type equality, can we assure that all (future) implementation of an interface like
Property
will behave in the same expected way or is this up to the developer of each of those classes? If we can't ensure this, might this be a problem? Does this even require major effort on our site to implement/support this as we only provide a single implementation of each interface? In general I like the idea of allowing mixed-types equality but only if it makes sense and we don't find major downsides (besides complexity). One potential downside I can think of is that currently the model code, i.e. also the equals methods, are auto-generated by our generator tool and I am not sure if such a complex pattern could also be auto-generated.
We can't control how people implement their equals, but all we can is to provide examples and sample test cases to guide them through a correct implementation.
I also don't say definitely that we should have such attribute for equals. The motivation was to test if a CustomProperty
can be serialized with RDF serializer, but the reconstructed object for now is always DefaultProperty
. So I can't compare them using equals method right now.
RelationshipElement
andAnnotatedRelationshipElement
are a special case and I guess an instance ofAnnotatedRelationshipElement
should never be considered equal to an instance ofRelationshipElement
. Reasoning is, that if you follow through with this logic you should also consider an emptyProperty
equal to an emptyRange
element because both are instances ofSubmodelElement
and in this case they would ne differ in attributes.
I also think so. In this case, I need to modify also the current PR if we want to have such behaviour.
from aas4j.
The motivation was to test if a CustomProperty can be serialized with RDF serializer, but the reconstructed object for now is always DefaultProperty. So I can't compare them using equals method right now.
Another possible solution for this problem would be to add a method similar to useImplementation(Class<T> aasInterface, Class>? extends T> implementation)
in JsonDeserializer.java#L59 also for RDF.
I think this would be very beneficial. And if you have something like this it would solve your problem related to testing.
However, this would not answer the question if we should change how equals work in AAS4J (or in certain classes at least).
from aas4j.
Related Issues (20)
- Prefix artifact names with "aas4j-" HOT 1
- Ensure that adding support for further DataSpecificationContent is possible in future without breaking changes
- Make APIs type safe according to AAS meta model spec HOT 5
- Wrong Relationship Type in *.rels HOT 3
- EmbeddedDataSpecifications inside XML SubmodelElements are not deserialised
- Trigger Final Release via Eclipse Foundations HOT 1
- Get Parent of Referable HOT 1
- Capitalization of class & method names changing back and forth HOT 3
- AASX containing Submodels with Files referencing files that are external to the AASX lead to a crash
- Enforce AASd-108
- interface attribute does not follow the naming pattern in Endpoint
- Thumbnail images are not properly referenced when writing AASX files HOT 1
- File paths are written to AASX with file:// URI scheme HOT 4
- Provide formatter configuration for AAS4J HOT 1
- Opening a `.aasx` file generated by this library creates a `.aasx.cpgz` file on MacOS HOT 1
- Reading Template Asset Interfaces Description is not possible HOT 4
- Support for JSON by AASXDeserializer HOT 1
- Validation of XML UTF-8 BOM file fails
- Relationship targets do not follow the OPC HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aas4j.