I've got a class that is supposed to represent RDF data.
@Getter
@Setter
@Node("Resource")
@Builder(setterPrefix = "with")
public class ClassNodeVo
{
@Id
@GeneratedValue
private Long id;
@DynamicLabels
private List<String> classLabels;
private Map<String, Object> properties;
@Relationship(direction = INCOMING)
private Map<String, List<ClassNodeVo>> neighbours;
private String relation;
private String uri;
private Long source;
}
RDF models that I want to save are densly connected, so often there are node that are circularly dependant.
For example (1) - linked -> (2). It's possible to create a relationship in the first place.
Let's add (1) <- linked-back - (2).
In my model I just have to add node (1) into 'neighbours' field of node (2) and save it.
Now circular dependency is created. If I would like to add another node (3) and connect it with either of these two and keep existing relationships it's impossible, beacuse I can't mapp neither (1) or (2). If would like to artificialy create node (1) and it happened to be connected to rest of some other graph I would have to recreate the graph on my own to not lose any relationship, I think that It would be the case, because I ran onto a bug (blame on me) that I used an object that had null-ed
neighbours (but in database it have neighbours) I saved it and it cut out all the previously persisted relationships.
Is there a way to solve my problem with use of SDN, I would love to avoid writing down plain Cypher queries.