neo4jgraph-databasesarangodbarangodb-php

How can I list the users with the most similar entries with ArangoDB


I started new project today. I have users table, tags table and user_tags edge for graph results.

I attached to users some tags on graph. How can I list the users with the most similar entries with ArangoDB.

For example:

When i searched user id 112 user. The results should be similar to this:

  1. user id: 114 (3 matches, 51, 52, 53)
  2. user id: 113 (2 matches, 52, 53)

Non-common data should not come within results user id: 115

If no one knows arangodb solution, I can use neo4j if there is a solution with neo4j.

Thanks.


Solution

  • In cypher, this is the query :

    MATCH (u1:User {id:114})-[:HAS_TAG]->(tag:Tag),
          (u:User)-[:HAS_TAG]->(tag:Tag)
    WITH u, collect(id(tag)) AS tags
    RETURN u, tags, size(tags) AS score
    ORDER BY score DESC
    

    Cheers