Hi guys. I'm new in graph databases and neo4j.
I need to use neo4j in my school project but i'm not sure if it ok to use it for what i planned. I'm planning to create site similar to 9gag where user can login upload images, like images, comment, etc.
Now is it good idea to use neo4j for this project? I was thinking every picture can be one node, and every picture will have relation to correct category, etc.
Is this ok plan or i have to change project? Do you have any idea for what type of project i can use neo4j.
Yeah i will build full stack ASP.net MVC application with redis and neo4j for database. But i'm not sure what will i use redis for but i need to use it Maybe you have some suggestion for what to use redis?
@Hazaaa You could use redis for caching credentials (access token) for logged in users. That would be a valid use-case. Hit the cache first, then fall back to the db.
So if you built the social network part (ask questions here as you go), with a few use cases, like login, make a friend, post some content, etc you could then refactor to store session in a cache.
About redis: I'm running a social network, using Neo4j, with 400,000 users, and still no need for it. But I understand that it is fun to play around with the tech, and see how things can fit together.
Jasper i have question for you.
I want to implement private messages in my project but i have two solutions how would i store messages in neo4j.
First is this:
I would have SEND and RECEIVED relationships between user and message and RESPONSE relationship between messages if message is response to received message.
And second one is: (no picture for this)
I have message node and it has one property named "mainMessageId" or something like that, that will save id of first message that was send from one user to another and every message after that will have this property set to that first message so when i pull them from db i just pull them by that id not with relationship.
I hope i made it clear how i want to implement it :) I really appreciate your suggestion and thank you in front.
So i should use response relationship but still to have id for first message?
After that when we want all response of one message we just match that first message node with id that we stored in response and start searching from that node?
Every user is unique. You want to be able to look up an individual, and know things. Since people can have the same first and last names. Therefore you give the user a unique ID. Most common is Universally unique identifier - Wikipedia
But once you look up a unique user, you can traverse the graph, eg, what messages did she send, and to who? In a graph database relationships are first class citizens.
If you're building a social network, and it has chat features, you want to look up a user and who they chatted with. Since you're looking up by user, individual messages and/or conversations probably don't need a unique ID. It won't hurt if you give them one, anyway.
For your follow relationships, you could maybe avoid having one in each direction, instead have a follow, and have two properties 'followDate' and 'reciprocatedDate'
Users will be unique by their username and aspId (that ASP authorization creates).
Yes now i understands that the power of graph database is in relationships. But in ASP i have to create model for every relationship and for now i am confused how should i use them...
I asked professor and he confirmed me that my first solution for messages is ok, and it's ok to have id of first message in every response so it's easier to get all response (like you said before).
We didn't really talked about bidirectional-relationships but it make sense what you said. I'm not just sure when i return relationship in C# from db to controller i need to map it somehow and how that model should look. Isn't easier to have one model that will store followed user and follower user and date when he followed?
I'm sure that all this sounds trivial for you but i'm really trying to understand neo4j and graph dbs at all. Hope i'm not really that annoying :)
Doing the right way depends on what you want to build and how you want to understand your data. As you continue to learn you can always adjust and restructure as you go. That is one of the best things about learning and using Neo4j. Just jump right in and make mistakes and learn.