Closed thortiede closed 5 years ago
The GraphModel has the following Relationship to Species
// List of all Species of the model
@Relationship(type = "hasSpecies", direction = Relationship.OUTGOING)
private List
and the Species has: @JsonIgnore @Relationship(type = "hasSpecies", direction = Relationship.INCOMING) private GraphModel model;
Should the direction of that Relationship be inverted? Can Problems arise when both sides are Lists of the other?
While changing the direction of the relationship and making it a List of References on both ends, I realised a general flaw in my data model. On creation of the model a) do we actually check if the model already exists? b) we create new nodes for each entity in the model, regardless of whether it exists, thus the GraphModel entity needs to check for that before creating a new GraphSpecies for instance. That then results in the fact, that the model needs to connect to the different services to check for that, which it should not hae to do. The controller or the Service needs to check for existing entites and update them with the new information.
As far as I can see this requires a complete remodel of the application. Gonna think about this for a bit and resume..
As described in the other thread:
I created a new NodeEntity GraphSBase
from which the other inherit.
Therefore
are all inheriting their
I also added various changes regarding checking for existing entities. This seems to work, as nodes are duplicated anymore, but are updated (check the version number of the node). Had some issues with optimisitic lookahed, and wrong versions on different types, but always SBase. There might be a problem lurking there with the inheritance and relationships. Still investigating. Should load indiviudal models without problem. When adding potentially overlapping models might run into trouble
Will push soon.
When loading a model that has a Species that already exists, that Species gets updated (as expected), but the connection to the old Model gets removed in favour of the new one.
All Entities could be part of multiple Models. The relationship to Model needs to be a List of Relations to account for that.