Hi Michael,
thank you for your feedback about this pattern!
Since this is my first Neo4j project, I thought all these nodes and
relationships meant a bad design and your reassurance is really helpful to
me.
I'll be glad to share my experience with the community if someone else will
face similar situation.
PS: because I wasn't able to se my post published, I asked the same on SO,
so sorry for the duplicate.
Kind regards
Alessandro
Il giorno martedì 9 agosto 2016 13:21:28 UTC+2, Michael Hunger ha scritto:
>
> I think your model looks quite good so far. One node per Media is totally
> fine.
>
> In general I presume you want to see in your stream the 20 latest media of
> users you follow.
>
> MATCH (me:User
> {id:{userid}})-[:FOLLOW]->(u:User)-[:POSTS]->()-[:NEXT*0..20]->(m:Media)
> RETURN u, collect(m) as medias
>
> Make sure to generate a large graph of the user, media, tag and follows
> data to load-test your system and queries.
>
> HTH Michael
>
>
>
> On Mon, Aug 8, 2016 at 2:41 PM, <[email protected] <javascript:>> wrote:
>
>> Hello there,
>> as a new Neo4j user, I'm here to ask you design advices for the following
>> scenario.
>> I would like to develop a mobile app with a social section that broadly
>> acts like Instagram, therefore a feed with my last friends activity, their
>> profile page, suggestions based on common interests and so on.
>>
>> (please take a look at the sketch attached).
>>
>> And here my questions:
>>
>> 1) While (User)-[FOLLOWS]->(User) relationship seams clear to me, with
>> (User)-[POSTS]->(Media) first doubts come. Is it correct to add a node for
>> every media a user will publish? Suppose 100-1000 pictures per user, it's
>> clear that Neo4j should manage a lot of connections from early stages and I
>> don't know if it's affordable in terms of required resources.
>>
>> 2) (User)-[LIKES]->(Media)
>> Because I red there isn't an atomic counter that safety let me store a
>> property in a Media node (example: {likes: 291}, I thought of this
>> solution. But again, I see an exponential growth of relations: what are
>> your considerations about this?
>>
>> 3) In my schema, I represented a user feed like a tree, attaching new
>> media to the last one with the [NEXT] relationship.
>> This way, when a user opens someone else profile, I can fetch for Media
>> with descending order and arbitrary limit for paginated results. Am I
>> correct or is there a best strategy?
>> Maybe I could consider a Media root node, storing the last user's
>> activity: this way I think it should be easier, from a user profile,
>> querying for new followed user's activities, ins't it?
>>
>> Thanks in advance for any advice,
>> Alessandro
>>
>>
>> <https://lh3.googleusercontent.com/-3wYdcwObwyk/V6h98DgFLEI/AAAAAAAAAg0/X3j0_OVhCwg31sB1Xyx1evFs22l2bRNPACLcB/s1600/graph.png>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.