I'm creating a website where logged in users can have a blog. My mid-tier is Spring Java so I'm using SDN 6.0.3 to try to take advantage of the SDN-RX dynamic relationship handling.
My Neo4j Desktop version is 1.4.1 and the database version is 4.2.2.
In the first image, each user (large orange) has a blog, and each blog has 3 posts with relationships that are named dynamically in the format suggested by Max De Marzi here:
In this image, blog test1 is friended to test3 and test4, and blog test4 is friended to test1 and test2. (No one is yet friended to test 5).
This is how my Blog class handles friend and blocking relationships.
@Relationship(type = "IS_BLOCKING", direction = Direction.OUTGOING) private List<Blog> blogsBlocked = new ArrayList<Blog>(); @Relationship(type = "IS_FRIENDED_TO", direction = Direction.OUTGOING) private List<Blog> blogsFriended = new ArrayList<Blog>();
This is how I've understood I should handle the dynamically named blog post relationships:
private Map<String, List<BlogPost>> allPosts = new HashMap<>();
I want to have the ability for users to block other users, so I tried to have test1 block test2, which resulted in the second image.
The block worked correctly, but each blog participating in the block lost its dynamically named relationships, and one regular friend relationship (between test1 and test3) was severed.
I really hope I'm not missing something obvious; I've searched on this forum and in stackoverflow for a couple of days but haven't been able to find an example that seems to explain the error I'm experiencing. I have seen a few issue reports (for example Support RelationshipProperties in dynamic relationships [DATAGRAPH-1385] · Issue #1947 · spring-projects/spring-data-neo4j · GitHub) that suggest that dynamic relationships may have some issues in general, which is why I moved away from having a relationship entity with properties for the time being.
I just started learning Neo4j in my spare time in 2020, so is this a known issue or do I have an error in my code?
Barring that, is there a way I can work around this with dynamic relationships in earlier versions of SDN, perhaps slightly more object-mapped than De Marzi's fine example?
Grateful in advance for any assistance anyone can give!
EDITED TO ADD: Tried the block just now with no posts in any of the tests blogs and test1 still lost its friendship to test3 so it's probably something I'm doing wrong. Any pointers for a newbie would be wonderful.