/kg-example

Knowledge Graph Examples

Primary LanguagePython

Knowledge Graph Examples

Douban Movie Graph

Neo4j

Build graph

python cli.py import-to-neo4j --url bolt://localhost:7687/ \
                              --auth "neo4j:myneo4j" \
                              --data-dir movie/ \
                              --batch-size 1000 \
                              --drop-all
  • Example 1:

    match (c:Country)-[]-(m:Movie)-[]-(p:Person) return * limit 100

    Output:

    douban_movie_example1

  • Example 2:

    MATCH (m:Movie)-[r:actor]->(p:Person) WHERE p.name="黄渤" RETURN *

    Output

    douban_movie_example2

  • Example 3:

    MATCH (a:Person), (b:Person), p=shortestpath((a)-[:actor*]-(b))
    WHERE a.name="黄渤" and b.name="汤姆·克鲁斯"
    RETURN p

    Output

    douban_movie_example3