Search code examples
mysqlgraphneo4jorientdbarangodb

Graph engine for retrive movie relations


I have many small graphs (title relations: prequel, sequel, adaptation, ...) and I want to retrieve all graphs that contain the title from the given collection. For query: Harry Potter 2, Star Wars 3, Harry Potter 1 I want to get 2 vertex-edge collections.

I was checking Neo4j, GUN, OrientDB, Arango, but I don't find this.

Can you recommend a solution based on a free/FOSS graph db?


Solution

  • OrientDB is free open source software, you can download it here http://orientdb.com/download/

    Suppose you have a class called Movie with an attribute called title, you can write a query as follows:

    TRAVERSE bothE(), bothV() FROM (
       SELECT FROM Movie WHERE title IN ["Harry Potter 2", "Star Wars 3"]
    )
    

    You can also specify one or more edge classes if you want to limit the traversal:

    TRAVERSE bothE("prequel", "sequel"), bothV() FROM (
       SELECT FROM Movie WHERE title IN ["Harry Potter 2", "Star Wars 3"]
    )
    

    This will return all the vertices and edges connected to movies with those titles.

    You can also add a Lucene index to the title property and perform full text queries with stemming and all the rest

    I hope it helps