Skip to content

File Ingest

Full Recipe

Shared by: Landon Kuhn

This recipe ingests each line in a file ($in_file) as graph node with property of "line" that contains the original line from the file.

File Ingest Recipe
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: 1
title: Ingest
contributor: https://github.com/landon9720
summary: Ingest input file lines as graph nodes
description: Ingests each line in "$in_file" as graph node with property "line".
ingestStreams:
  - type: FileIngest
    path: $in_file
    format:
      type: CypherLine
      query: |-
        MATCH (n)
        WHERE id(n) = idFrom($that)
        SET n.line = $that
standingQueries: [ ]
nodeAppearances: [ ]
quickQueries: [ ]
sampleQueries: [ ]

Download Recipe

Scenario

In this scenario, we read lines from a text file into the graph to create a cloud of disconnected nodes that can be operated on later or analyzed individually.

This recipe demonstrates the most basic of ingest streams possible in Quine.

Sample Data

This recipe accepts any text file as input.

How it Works

The recipe reads lines from the source data file using an ingest stream to manifest a graph in Quine.

  - type: FileIngest
    path: $in_file
    format:
      type: CypherLine
      query: |-
        MATCH (n)
        WHERE id(n) = idFrom($that)
        SET n.line = $that
POST /api/v1/ingest/INGEST-1
{
  "type": "FileIngest",
  "path": "$in_file",
  "format": {
    "type": "CypherLine",
    "query": "MATCH (n)\nWHERE id(n) = idFrom($that)\nSET n.line = $that"
  }
}

Running the Recipe

 java -jar quine-1.7.3.jar -r ingest.yaml --recipe-value in_file={$filename}
Graph is ready
Running Recipe: Ingest
Running Ingest Stream INGEST-1
Quine web server available at http://localhost:8080
INGEST-1 status is completed and ingested 112 

Summary

Open your browser and navigate to http://localhost:8080. Click the query bar and select CALL recentNodes(10) from the drop down list, then click the "Query" button.

A jumbled graph will appear in your browser, hover over the nodes to see the text from the file stored in the "line" parameter.

Ingest Nodes