version: 2
title: Harry Potter
contributor: https://github.com/harpocrates
summary: Small graph of connected nodes
description: |-
  This Recipe loads a small graph of connected nodes.
  Before running this Recipe, download the dataset using
  curl https://quine.io/recipes/images/harry_potter_data.json -o harry_potter_data.json

ingestStreams:
  - name: harry-potter-ingest
    source:
      type: File
      path: $in_file
      format:
        type: Json
    query: |-
      MATCH (p) WHERE id(p) = idFrom('name', $that.name)
      SET p = { name: $that.name, gender: $that.gender, birth_year: $that.birth_year },
        p: Person
      WITH $that.children AS childrenNames, p
      UNWIND childrenNames AS childName
      MATCH (c) WHERE id(c) = idFrom('name', childName)
      CREATE (c)-[:has_parent]->(p)

standingQueries: []
nodeAppearances: []
quickQueries:
  - predicate:
      propertyKeys: []
      knownValues: {}
    quickQuery:
      name: Adjacent Nodes
      querySuffix: MATCH (n)--(m) RETURN DISTINCT m
      sort:
        type: Node
  - predicate:
      propertyKeys: []
      knownValues: {}
    quickQuery:
      name: Siblings
      querySuffix: >-
        MATCH (n)-[:has_parent]->(p)<-[:has_parent]-(s)
        RETURN DISTINCT s
      sort:
        type: Node
      edgeLabel: has sibling
sampleQueries: []
